mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
cleanup container runtime options
Signed-off-by: calvin0327 <wen.chen@daocloud.io>
This commit is contained in:
parent
e390791e5f
commit
0ffac50126
@ -18,7 +18,6 @@ package options
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/kubernetes/pkg/kubelet/config"
|
"k8s.io/kubernetes/pkg/kubelet/config"
|
||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -36,7 +35,6 @@ var (
|
|||||||
// default values.
|
// default values.
|
||||||
func NewContainerRuntimeOptions() *config.ContainerRuntimeOptions {
|
func NewContainerRuntimeOptions() *config.ContainerRuntimeOptions {
|
||||||
return &config.ContainerRuntimeOptions{
|
return &config.ContainerRuntimeOptions{
|
||||||
ContainerRuntime: kubetypes.RemoteContainerRuntime,
|
|
||||||
PodSandboxImage: defaultPodSandboxImage,
|
PodSandboxImage: defaultPodSandboxImage,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ import (
|
|||||||
"k8s.io/kubelet/config/v1beta1"
|
"k8s.io/kubelet/config/v1beta1"
|
||||||
kubeletapis "k8s.io/kubelet/pkg/apis"
|
kubeletapis "k8s.io/kubelet/pkg/apis"
|
||||||
"k8s.io/kubernetes/pkg/cluster/ports"
|
"k8s.io/kubernetes/pkg/cluster/ports"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
|
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
|
||||||
kubeletscheme "k8s.io/kubernetes/pkg/kubelet/apis/config/scheme"
|
kubeletscheme "k8s.io/kubernetes/pkg/kubelet/apis/config/scheme"
|
||||||
kubeletconfigvalidation "k8s.io/kubernetes/pkg/kubelet/apis/config/validation"
|
kubeletconfigvalidation "k8s.io/kubernetes/pkg/kubelet/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/config"
|
"k8s.io/kubernetes/pkg/kubelet/config"
|
||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
|
||||||
utilflag "k8s.io/kubernetes/pkg/util/flag"
|
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, "; "))
|
return fmt.Errorf("invalid node labels: %s", strings.Join(labelErrs, "; "))
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.ContainerRuntime != kubetypes.RemoteContainerRuntime {
|
if f.SeccompDefault && !utilfeature.DefaultFeatureGate.Enabled(features.SeccompDefault) {
|
||||||
return fmt.Errorf("unsupported CRI runtime: %q, only %q is currently supported", f.ContainerRuntime, kubetypes.RemoteContainerRuntime)
|
return fmt.Errorf("the SeccompDefault feature gate must be enabled in order to use the --seccomp-default flag")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -26,7 +26,6 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/diff"
|
"k8s.io/apimachinery/pkg/util/diff"
|
||||||
cliflag "k8s.io/component-base/cli/flag"
|
cliflag "k8s.io/component-base/cli/flag"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/config"
|
"k8s.io/kubernetes/pkg/kubelet/config"
|
||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func newKubeletServerOrDie() *KubeletServer {
|
func newKubeletServerOrDie() *KubeletServer {
|
||||||
@ -180,9 +179,7 @@ func TestValidateKubeletFlags(t *testing.T) {
|
|||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
err := ValidateKubeletFlags(&KubeletFlags{
|
err := ValidateKubeletFlags(&KubeletFlags{
|
||||||
ContainerRuntimeOptions: config.ContainerRuntimeOptions{
|
ContainerRuntimeOptions: config.ContainerRuntimeOptions{},
|
||||||
ContainerRuntime: kubetypes.RemoteContainerRuntime,
|
|
||||||
},
|
|
||||||
NodeLabels: tt.labels,
|
NodeLabels: tt.labels,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -26,8 +26,6 @@ import (
|
|||||||
type ContainerRuntimeOptions struct {
|
type ContainerRuntimeOptions struct {
|
||||||
// General Options.
|
// General Options.
|
||||||
|
|
||||||
// ContainerRuntime is the container runtime to use.
|
|
||||||
ContainerRuntime string
|
|
||||||
// RuntimeCgroups that container runtime is expected to be isolated in.
|
// RuntimeCgroups that container runtime is expected to be isolated in.
|
||||||
RuntimeCgroups string
|
RuntimeCgroups string
|
||||||
// PodSandboxImage is the image whose network/ipc namespaces
|
// 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.
|
// AddFlags adds flags to the container runtime, according to ContainerRuntimeOptions.
|
||||||
func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet) {
|
func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet) {
|
||||||
// General settings.
|
// 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.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.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.")
|
fs.MarkDeprecated("pod-infra-container-image", "will be removed in 1.27. Image garbage collector will get sandbox image information from CRI.")
|
||||||
|
@ -25,11 +25,6 @@ const (
|
|||||||
RFC3339NanoLenient = "2006-01-02T15:04:05.999999999Z07:00"
|
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.
|
// User visible keys for managing node allocatable enforcement on the node.
|
||||||
const (
|
const (
|
||||||
NodeAllocatableEnforcementKey = "pods"
|
NodeAllocatableEnforcementKey = "pods"
|
||||||
|
Loading…
Reference in New Issue
Block a user