cleanup container runtime options

Signed-off-by: calvin0327 <wen.chen@daocloud.io>
This commit is contained in:
calvin0327 2022-11-19 15:45:09 +08:00 committed by Paco Xu
parent e390791e5f
commit 0ffac50126
5 changed files with 6 additions and 20 deletions

View File

@ -18,7 +18,6 @@ package options
import (
"k8s.io/kubernetes/pkg/kubelet/config"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
)
const (
@ -36,7 +35,6 @@ var (
// default values.
func NewContainerRuntimeOptions() *config.ContainerRuntimeOptions {
return &config.ContainerRuntimeOptions{
ContainerRuntime: kubetypes.RemoteContainerRuntime,
PodSandboxImage: defaultPodSandboxImage,
PodSandboxImage: defaultPodSandboxImage,
}
}

View File

@ -33,11 +33,11 @@ import (
"k8s.io/kubelet/config/v1beta1"
kubeletapis "k8s.io/kubelet/pkg/apis"
"k8s.io/kubernetes/pkg/cluster/ports"
"k8s.io/kubernetes/pkg/features"
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
kubeletscheme "k8s.io/kubernetes/pkg/kubelet/apis/config/scheme"
kubeletconfigvalidation "k8s.io/kubernetes/pkg/kubelet/apis/config/validation"
"k8s.io/kubernetes/pkg/kubelet/config"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
utilflag "k8s.io/kubernetes/pkg/util/flag"
)
@ -179,8 +179,8 @@ func ValidateKubeletFlags(f *KubeletFlags) error {
return fmt.Errorf("invalid node labels: %s", strings.Join(labelErrs, "; "))
}
if f.ContainerRuntime != kubetypes.RemoteContainerRuntime {
return fmt.Errorf("unsupported CRI runtime: %q, only %q is currently supported", f.ContainerRuntime, kubetypes.RemoteContainerRuntime)
if f.SeccompDefault && !utilfeature.DefaultFeatureGate.Enabled(features.SeccompDefault) {
return fmt.Errorf("the SeccompDefault feature gate must be enabled in order to use the --seccomp-default flag")
}
return nil

View File

@ -26,7 +26,6 @@ import (
"k8s.io/apimachinery/pkg/util/diff"
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/kubernetes/pkg/kubelet/config"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
)
func newKubeletServerOrDie() *KubeletServer {
@ -180,10 +179,8 @@ func TestValidateKubeletFlags(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := ValidateKubeletFlags(&KubeletFlags{
ContainerRuntimeOptions: config.ContainerRuntimeOptions{
ContainerRuntime: kubetypes.RemoteContainerRuntime,
},
NodeLabels: tt.labels,
ContainerRuntimeOptions: config.ContainerRuntimeOptions{},
NodeLabels: tt.labels,
})
if tt.error && err == nil {

View File

@ -26,8 +26,6 @@ import (
type ContainerRuntimeOptions struct {
// General Options.
// ContainerRuntime is the container runtime to use.
ContainerRuntime string
// RuntimeCgroups that container runtime is expected to be isolated in.
RuntimeCgroups string
// PodSandboxImage is the image whose network/ipc namespaces
@ -51,8 +49,6 @@ type ContainerRuntimeOptions struct {
// AddFlags adds flags to the container runtime, according to ContainerRuntimeOptions.
func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet) {
// General settings.
fs.StringVar(&s.ContainerRuntime, "container-runtime", s.ContainerRuntime, "The container runtime to use. Possible value: 'remote'.")
fs.MarkDeprecated("container-runtime", "will be removed in 1.27 as the only valid value is 'remote'")
fs.StringVar(&s.RuntimeCgroups, "runtime-cgroups", s.RuntimeCgroups, "Optional absolute name of cgroups to create and run the runtime in.")
fs.StringVar(&s.PodSandboxImage, "pod-infra-container-image", s.PodSandboxImage, fmt.Sprintf("Specified image will not be pruned by the image garbage collector. CRI implementations have their own configuration to set this image."))
fs.MarkDeprecated("pod-infra-container-image", "will be removed in 1.27. Image garbage collector will get sandbox image information from CRI.")

View File

@ -25,11 +25,6 @@ const (
RFC3339NanoLenient = "2006-01-02T15:04:05.999999999Z07:00"
)
// Different container runtimes.
const (
RemoteContainerRuntime = "remote"
)
// User visible keys for managing node allocatable enforcement on the node.
const (
NodeAllocatableEnforcementKey = "pods"