New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Initial-cut of cri-dockerd #74051
Closed
dims
wants to merge
3
commits into
kubernetes:master
from
dims:separate-binary-for-running-docker-shim
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=kubelet: The Kubernetes Node Agent | ||
Documentation=http://kubernetes.io/docs/ | ||
|
||
[Service] | ||
ExecStart=/usr/bin/cri-dockerd | ||
Restart=always | ||
StartLimitInterval=0 | ||
RestartSec=10 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=kubelet: The Kubernetes Node Agent | ||
Documentation=http://kubernetes.io/docs/ | ||
|
||
[Service] | ||
ExecStart=/usr/bin/cri-dockerd | ||
Restart=always | ||
StartLimitInterval=0 | ||
RestartSec=10 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load( | ||
"@io_bazel_rules_go//go:def.bzl", | ||
"go_binary", | ||
"go_library", | ||
) | ||
load("//pkg/version:def.bzl", "version_x_defs") | ||
|
||
go_binary( | ||
name = "cri-dockerd", | ||
embed = [":go_default_library"], | ||
x_defs = version_x_defs(), | ||
) | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["cri-dockerd.go"], | ||
importpath = "k8s.io/kubernetes/cmd/cri-dockerd", | ||
deps = [ | ||
"//cmd/cri-dockerd/app:go_default_library", | ||
"//staging/src/k8s.io/apiserver/pkg/server:go_default_library", | ||
"//staging/src/k8s.io/component-base/logs:go_default_library", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [ | ||
":package-srcs", | ||
"//cmd/cri-dockerd/app:all-srcs", | ||
], | ||
tags = ["automanaged"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# See the OWNERS docs at https://go.k8s.io/owners | ||
|
||
approvers: | ||
- dchen1107 | ||
- derekwaynecarr | ||
- Random-Liu | ||
- vishh | ||
- yujuhong | ||
- dims | ||
reviewers: | ||
- sig-node-reviewers | ||
labels: | ||
- area/kubelet | ||
- sig/node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["server.go"], | ||
importpath = "k8s.io/kubernetes/cmd/cri-dockerd/app", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//cmd/cri-dockerd/app/options:go_default_library", | ||
"//pkg/kubelet/dockershim:go_default_library", | ||
"//pkg/kubelet/dockershim/remote:go_default_library", | ||
"//pkg/kubelet/server/streaming:go_default_library", | ||
"//pkg/util/flag:go_default_library", | ||
"//pkg/version/verflag:go_default_library", | ||
"//staging/src/k8s.io/component-base/cli/flag:go_default_library", | ||
"//vendor/github.com/spf13/cobra:go_default_library", | ||
"//vendor/github.com/spf13/pflag:go_default_library", | ||
"//vendor/k8s.io/klog:go_default_library", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [ | ||
":package-srcs", | ||
"//cmd/cri-dockerd/app/config:all-srcs", | ||
"//cmd/cri-dockerd/app/options:all-srcs", | ||
], | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["types.go"], | ||
importpath = "k8s.io/kubernetes/cmd/cri-dockerd/app/config", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", | ||
"//vendor/github.com/spf13/pflag:go_default_library", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [":package-srcs"], | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package config | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/pflag" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// ContainerRuntimeOptions contains runtime options | ||
type ContainerRuntimeOptions struct { | ||
// General options. | ||
|
||
//// driver that the kubelet uses to manipulate cgroups on the host (cgroupfs or systemd) | ||
CgroupDriver string | ||
// RuntimeCgroups that container runtime is expected to be isolated in. | ||
RuntimeCgroups string | ||
|
||
// Docker-specific options. | ||
|
||
// DockershimRootDirectory is the path to the dockershim root directory. Defaults to | ||
// /var/lib/dockershim if unset. Exposed for integration testing (e.g. in OpenShift). | ||
DockershimRootDirectory string | ||
// PodSandboxImage is the image whose network/ipc namespaces | ||
// containers in each pod will use. | ||
PodSandboxImage string | ||
// DockerEndpoint is the path to the docker endpoint to communicate with. | ||
DockerEndpoint string | ||
// If no pulling progress is made before the deadline imagePullProgressDeadline, | ||
// the image pulling will be cancelled. Defaults to 1m0s. | ||
// +optional | ||
ImagePullProgressDeadline metav1.Duration | ||
// runtimeRequestTimeout is the timeout for all runtime requests except long running | ||
// requests - pull, logs, exec and attach. | ||
RuntimeRequestTimeout metav1.Duration | ||
// streamingConnectionIdleTimeout is the maximum time a streaming connection | ||
// can be idle before the connection is automatically closed. | ||
StreamingConnectionIdleTimeout metav1.Duration | ||
} | ||
|
||
// AddFlags has the set of flags needed by cri-dockerd | ||
func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet) { | ||
// General settings. | ||
fs.StringVar(&s.RuntimeCgroups, "runtime-cgroups", s.RuntimeCgroups, "Optional absolute name of cgroups to create and run the runtime in.") | ||
|
||
// Docker-specific settings. | ||
fs.StringVar(&s.DockershimRootDirectory, "dockershim-root-directory", s.DockershimRootDirectory, "Path to the dockershim root directory.") | ||
fs.StringVar(&s.PodSandboxImage, "pod-infra-container-image", s.PodSandboxImage, fmt.Sprintf("The image whose network/ipc namespaces containers in each pod will use")) | ||
fs.StringVar(&s.DockerEndpoint, "docker-endpoint", s.DockerEndpoint, fmt.Sprintf("Use this for the docker endpoint to communicate with.")) | ||
fs.DurationVar(&s.ImagePullProgressDeadline.Duration, "image-pull-progress-deadline", s.ImagePullProgressDeadline.Duration, fmt.Sprintf("If no pulling progress is made before this deadline, the image pulling will be cancelled.")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = [ | ||
"container_runtime.go", | ||
"globalflags.go", | ||
"options.go", | ||
], | ||
importpath = "k8s.io/kubernetes/cmd/cri-dockerd/app/options", | ||
deps = [ | ||
"//cmd/cri-dockerd/app/config:go_default_library", | ||
"//pkg/version/verflag:go_default_library", | ||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", | ||
"//staging/src/k8s.io/component-base/logs:go_default_library", | ||
"//vendor/github.com/spf13/pflag:go_default_library", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [":package-srcs"], | ||
tags = ["automanaged"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
Copyright 2017 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package options | ||
|
||
import ( | ||
"runtime" | ||
"time" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/kubernetes/cmd/cri-dockerd/app/config" | ||
) | ||
|
||
const ( | ||
// When these values are updated, also update test/e2e/framework/util.go | ||
defaultPodSandboxImageName = "k8s.gcr.io/pause" | ||
defaultPodSandboxImageVersion = "3.1" | ||
) | ||
|
||
var ( | ||
dockerContainerRuntime = "docker" | ||
defaultPodSandboxImage = defaultPodSandboxImageName + | ||
":" + defaultPodSandboxImageVersion | ||
) | ||
|
||
// NewContainerRuntimeOptions will create a new ContainerRuntimeOptions with | ||
// default values. | ||
func NewContainerRuntimeOptions() *config.ContainerRuntimeOptions { | ||
dockerEndpoint := "" | ||
if runtime.GOOS != "windows" { | ||
dockerEndpoint = "unix:///var/run/docker.sock" | ||
} | ||
|
||
return &config.ContainerRuntimeOptions{ | ||
DockerEndpoint: dockerEndpoint, | ||
DockershimRootDirectory: "/var/lib/dockershim", | ||
PodSandboxImage: defaultPodSandboxImage, | ||
ImagePullProgressDeadline: metav1.Duration{Duration: 1 * time.Minute}, | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this file in the PR. Perhaps it's missing or uncommitted?
Anyway, I presume it's going to be roughly equivalent to kubelet's systemd service file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, i missed this, will add one