Skip to content
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

Make EnableCRI default to true #41378

Merged
merged 1 commit into from
Feb 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions cmd/kubelet/app/options/options.go
Expand Up @@ -247,9 +247,17 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
fs.BoolVar(&s.KeepTerminatedPodVolumes, "keep-terminated-pod-volumes", s.KeepTerminatedPodVolumes, "Keep terminated pod volumes mounted to the node after the pod terminates. Can be useful for debugging volume related issues.")

// CRI flags.
fs.BoolVar(&s.EnableCRI, "experimental-cri", s.EnableCRI, "[Experimental] Enable the Container Runtime Interface (CRI) integration. If --container-runtime is set to \"remote\", Kubelet will communicate with the runtime/image CRI server listening on the endpoint specified by --remote-runtime-endpoint/--remote-image-endpoint. If --container-runtime is set to \"docker\", Kubelet will launch a in-process CRI server on behalf of docker, and communicate over a default endpoint.")
fs.StringVar(&s.RemoteRuntimeEndpoint, "container-runtime-endpoint", s.RemoteRuntimeEndpoint, "[Experimental] The unix socket endpoint of remote runtime service. The endpoint is used only when CRI integration is enabled (--experimental-cri)")
fs.StringVar(&s.RemoteImageEndpoint, "image-service-endpoint", s.RemoteImageEndpoint, "[Experimental] The unix socket endpoint of remote image service. If not specified, it will be the same with container-runtime-endpoint by default. The endpoint is used only when CRI integration is enabled (--experimental-cri)")
// TODO: Remove experimental-cri in kubernetes 1.7.
fs.BoolVar(&s.EnableCRI, "experimental-cri", s.EnableCRI, "Same as --enable-cri. [default=true]")
fs.MarkDeprecated("experimental-cri", "Please use --enable-cri instead.")
fs.MarkHidden("experimental-cri")
// TODO: Remove enable-cri once we stop supporting the non-cri
// implementation.
fs.BoolVar(&s.EnableCRI, "enable-cri", s.EnableCRI, "Enable the Container Runtime Interface (CRI) integration. If --container-runtime is set to \"remote\", Kubelet will communicate with the runtime/image CRI server listening on the endpoint specified by --remote-runtime-endpoint/--remote-image-endpoint. If --container-runtime is set to \"docker\", Kubelet will launch a in-process CRI server on behalf of docker, and communicate over a default endpoint. If --container-runtime is \"rkt\", the flag will be ignored because rkt integration doesn't support CRI yet. [default=true]")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried whether there will be an order here?

Copy link
Contributor Author

@yujuhong yujuhong Feb 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, verified through manual testing. enable-cri always overrides experimental-cri, as stated in the PR description.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool~ :)

fs.MarkDeprecated("enable-cri", "The non-CRI implementation will be deprecated and removed in a future version.")

fs.StringVar(&s.RemoteRuntimeEndpoint, "container-runtime-endpoint", s.RemoteRuntimeEndpoint, "[Experimental] The unix socket endpoint of remote runtime service. The endpoint is used only when CRI integration is enabled (--enable-cri)")
fs.StringVar(&s.RemoteImageEndpoint, "image-service-endpoint", s.RemoteImageEndpoint, "[Experimental] The unix socket endpoint of remote image service. If not specified, it will be the same with container-runtime-endpoint by default. The endpoint is used only when CRI integration is enabled (--enable-cri)")

fs.BoolVar(&s.ExperimentalCheckNodeCapabilitiesBeforeMount, "experimental-check-node-capabilities-before-mount", s.ExperimentalCheckNodeCapabilitiesBeforeMount, "[Experimental] if set true, the kubelet will check the underlying node for required componenets (binaries, etc.) before performing the mount")
}
1 change: 1 addition & 0 deletions hack/verify-flags/known-flags.txt
Expand Up @@ -161,6 +161,7 @@ duration-sec
e2e-output-dir
e2e-verify-service-account
enable-controller-attach-detach
enable-cri
enable-custom-metrics
enable-debugging-handlers
enable-dynamic-provisioning
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/componentconfig/v1alpha1/defaults.go
Expand Up @@ -411,6 +411,9 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
}
}
}
if obj.EnableCRI == nil {
obj.EnableCRI = boolVar(true)
}
}

func boolVar(b bool) *bool {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/componentconfig/v1alpha1/types.go
Expand Up @@ -511,7 +511,7 @@ type KubeletConfiguration struct {
FeatureGates string `json:"featureGates,omitempty"`
// Enable Container Runtime Interface (CRI) integration.
// +optional
EnableCRI bool `json:"enableCRI,omitempty"`
EnableCRI *bool `json:"enableCRI,omitempty"`
// TODO(#34726:1.8.0): Remove the opt-in for failing when swap is enabled.
// Tells the Kubelet to fail to start if swap is enabled on the node.
ExperimentalFailSwapOn bool `json:"experimentalFailSwapOn,omitempty"`
Expand Down
8 changes: 6 additions & 2 deletions pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go
Expand Up @@ -410,7 +410,9 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_componentconfig_KubeletConfigu
}
out.AllowedUnsafeSysctls = *(*[]string)(unsafe.Pointer(&in.AllowedUnsafeSysctls))
out.FeatureGates = in.FeatureGates
out.EnableCRI = in.EnableCRI
if err := v1.Convert_Pointer_bool_To_bool(&in.EnableCRI, &out.EnableCRI, s); err != nil {
return err
}
out.ExperimentalFailSwapOn = in.ExperimentalFailSwapOn
out.ExperimentalCheckNodeCapabilitiesBeforeMount = in.ExperimentalCheckNodeCapabilitiesBeforeMount
out.KeepTerminatedPodVolumes = in.KeepTerminatedPodVolumes
Expand Down Expand Up @@ -582,7 +584,9 @@ func autoConvert_componentconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigu
}
out.AllowedUnsafeSysctls = *(*[]string)(unsafe.Pointer(&in.AllowedUnsafeSysctls))
out.FeatureGates = in.FeatureGates
out.EnableCRI = in.EnableCRI
if err := v1.Convert_bool_To_Pointer_bool(&in.EnableCRI, &out.EnableCRI, s); err != nil {
return err
}
out.ExperimentalFailSwapOn = in.ExperimentalFailSwapOn
out.ExperimentalCheckNodeCapabilitiesBeforeMount = in.ExperimentalCheckNodeCapabilitiesBeforeMount
out.KeepTerminatedPodVolumes = in.KeepTerminatedPodVolumes
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/componentconfig/v1alpha1/zz_generated.deepcopy.go
Expand Up @@ -295,6 +295,11 @@ func DeepCopy_v1alpha1_KubeletConfiguration(in interface{}, out interface{}, c *
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.EnableCRI != nil {
in, out := &in.EnableCRI, &out.EnableCRI
*out = new(bool)
**out = **in
}
return nil
}
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/kubelet/kubelet.go
Expand Up @@ -532,7 +532,8 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
var nl *noOpLegacyHost
pluginSettings.LegacyRuntimeHost = nl

if kubeCfg.EnableCRI {
// rktnetes cannot be run with CRI.
if kubeCfg.ContainerRuntime != "rkt" && kubeCfg.EnableCRI {
// kubelet defers to the runtime shim to setup networking. Setting
// this to nil will prevent it from trying to invoke the plugin.
// It's easier to always probe and initialize plugins till cri
Expand Down