mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #114017 from calvin0327/cleanup-containerruntime-options
cleanup container runtime options
This commit is contained in:
commit
a3ad4d7623
@ -1183,7 +1183,6 @@ PROMETHEUS_TO_SD_ENDPOINT: $(yaml-quote "${PROMETHEUS_TO_SD_ENDPOINT:-}")
|
|||||||
PROMETHEUS_TO_SD_PREFIX: $(yaml-quote "${PROMETHEUS_TO_SD_PREFIX:-}")
|
PROMETHEUS_TO_SD_PREFIX: $(yaml-quote "${PROMETHEUS_TO_SD_PREFIX:-}")
|
||||||
ENABLE_PROMETHEUS_TO_SD: $(yaml-quote "${ENABLE_PROMETHEUS_TO_SD:-false}")
|
ENABLE_PROMETHEUS_TO_SD: $(yaml-quote "${ENABLE_PROMETHEUS_TO_SD:-false}")
|
||||||
DISABLE_PROMETHEUS_TO_SD_IN_DS: $(yaml-quote "${DISABLE_PROMETHEUS_TO_SD_IN_DS:-false}")
|
DISABLE_PROMETHEUS_TO_SD_IN_DS: $(yaml-quote "${DISABLE_PROMETHEUS_TO_SD_IN_DS:-false}")
|
||||||
CONTAINER_RUNTIME: $(yaml-quote "${CONTAINER_RUNTIME:-}")
|
|
||||||
CONTAINER_RUNTIME_ENDPOINT: $(yaml-quote "${CONTAINER_RUNTIME_ENDPOINT:-}")
|
CONTAINER_RUNTIME_ENDPOINT: $(yaml-quote "${CONTAINER_RUNTIME_ENDPOINT:-}")
|
||||||
CONTAINER_RUNTIME_NAME: $(yaml-quote "${CONTAINER_RUNTIME_NAME:-}")
|
CONTAINER_RUNTIME_NAME: $(yaml-quote "${CONTAINER_RUNTIME_NAME:-}")
|
||||||
CONTAINER_RUNTIME_TEST_HANDLER: $(yaml-quote "${CONTAINER_RUNTIME_TEST_HANDLER:-}")
|
CONTAINER_RUNTIME_TEST_HANDLER: $(yaml-quote "${CONTAINER_RUNTIME_TEST_HANDLER:-}")
|
||||||
|
@ -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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ import (
|
|||||||
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -178,11 +177,6 @@ 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 {
|
|
||||||
return fmt.Errorf("unsupported CRI runtime: %q, only %q is currently supported", f.ContainerRuntime, kubetypes.RemoteContainerRuntime)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,8 +471,8 @@ func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfig
|
|||||||
fs.BoolVar(&c.MakeIPTablesUtilChains, "make-iptables-util-chains", c.MakeIPTablesUtilChains, "If true, kubelet will ensure iptables utility rules are present on host.")
|
fs.BoolVar(&c.MakeIPTablesUtilChains, "make-iptables-util-chains", c.MakeIPTablesUtilChains, "If true, kubelet will ensure iptables utility rules are present on host.")
|
||||||
fs.Int32Var(&c.IPTablesMasqueradeBit, "iptables-masquerade-bit", c.IPTablesMasqueradeBit, "The bit of the fwmark space to mark packets for SNAT. Must be within the range [0, 31]. Please match this parameter with corresponding parameter in kube-proxy.")
|
fs.Int32Var(&c.IPTablesMasqueradeBit, "iptables-masquerade-bit", c.IPTablesMasqueradeBit, "The bit of the fwmark space to mark packets for SNAT. Must be within the range [0, 31]. Please match this parameter with corresponding parameter in kube-proxy.")
|
||||||
fs.Int32Var(&c.IPTablesDropBit, "iptables-drop-bit", c.IPTablesDropBit, "The bit of the fwmark space to mark packets for dropping. Must be within the range [0, 31].")
|
fs.Int32Var(&c.IPTablesDropBit, "iptables-drop-bit", c.IPTablesDropBit, "The bit of the fwmark space to mark packets for dropping. Must be within the range [0, 31].")
|
||||||
fs.StringVar(&c.ContainerLogMaxSize, "container-log-max-size", c.ContainerLogMaxSize, "<Warning: Beta feature> Set the maximum size (e.g. 10Mi) of container log file before it is rotated. This flag can only be used with --container-runtime=remote.")
|
fs.StringVar(&c.ContainerLogMaxSize, "container-log-max-size", c.ContainerLogMaxSize, "<Warning: Beta feature> Set the maximum size (e.g. 10Mi) of container log file before it is rotated.")
|
||||||
fs.Int32Var(&c.ContainerLogMaxFiles, "container-log-max-files", c.ContainerLogMaxFiles, "<Warning: Beta feature> Set the maximum number of container log files that can be present for a container. The number must be >= 2. This flag can only be used with --container-runtime=remote.")
|
fs.Int32Var(&c.ContainerLogMaxFiles, "container-log-max-files", c.ContainerLogMaxFiles, "<Warning: Beta feature> Set the maximum number of container log files that can be present for a container. The number must be >= 2.")
|
||||||
fs.StringSliceVar(&c.AllowedUnsafeSysctls, "allowed-unsafe-sysctls", c.AllowedUnsafeSysctls, "Comma-separated whitelist of unsafe sysctls or unsafe sysctl patterns (ending in *). Use these at your own risk.")
|
fs.StringSliceVar(&c.AllowedUnsafeSysctls, "allowed-unsafe-sysctls", c.AllowedUnsafeSysctls, "Comma-separated whitelist of unsafe sysctls or unsafe sysctl patterns (ending in *). Use these at your own risk.")
|
||||||
|
|
||||||
fs.Int32Var(&c.NodeStatusMaxImages, "node-status-max-images", c.NodeStatusMaxImages, "The maximum number of images to report in Node.Status.Images. If -1 is specified, no cap will be applied.")
|
fs.Int32Var(&c.NodeStatusMaxImages, "node-status-max-images", c.NodeStatusMaxImages, "The maximum number of images to report in Node.Status.Images. If -1 is specified, no cap will be applied.")
|
||||||
|
@ -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,10 +179,8 @@ 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,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if tt.error && err == nil {
|
if tt.error && err == nil {
|
||||||
|
@ -218,7 +218,6 @@ LOG_LEVEL=${LOG_LEVEL:-3}
|
|||||||
LOG_SPEC=${LOG_SPEC:-""}
|
LOG_SPEC=${LOG_SPEC:-""}
|
||||||
LOG_DIR=${LOG_DIR:-"/tmp"}
|
LOG_DIR=${LOG_DIR:-"/tmp"}
|
||||||
TMP_DIR=${TMP_DIR:-$(kube::realpath "$(mktemp -d -t "$(basename "$0").XXXXXX")")}
|
TMP_DIR=${TMP_DIR:-$(kube::realpath "$(mktemp -d -t "$(basename "$0").XXXXXX")")}
|
||||||
CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-"remote"}
|
|
||||||
CONTAINER_RUNTIME_ENDPOINT=${CONTAINER_RUNTIME_ENDPOINT:-"unix:///run/containerd/containerd.sock"}
|
CONTAINER_RUNTIME_ENDPOINT=${CONTAINER_RUNTIME_ENDPOINT:-"unix:///run/containerd/containerd.sock"}
|
||||||
RUNTIME_REQUEST_TIMEOUT=${RUNTIME_REQUEST_TIMEOUT:-"2m"}
|
RUNTIME_REQUEST_TIMEOUT=${RUNTIME_REQUEST_TIMEOUT:-"2m"}
|
||||||
IMAGE_SERVICE_ENDPOINT=${IMAGE_SERVICE_ENDPOINT:-""}
|
IMAGE_SERVICE_ENDPOINT=${IMAGE_SERVICE_ENDPOINT:-""}
|
||||||
@ -713,7 +712,6 @@ function start_kubelet {
|
|||||||
all_kubelet_flags=(
|
all_kubelet_flags=(
|
||||||
"--v=${LOG_LEVEL}"
|
"--v=${LOG_LEVEL}"
|
||||||
"--vmodule=${LOG_SPEC}"
|
"--vmodule=${LOG_SPEC}"
|
||||||
"--container-runtime=${CONTAINER_RUNTIME}"
|
|
||||||
"--hostname-override=${HOSTNAME_OVERRIDE}"
|
"--hostname-override=${HOSTNAME_OVERRIDE}"
|
||||||
"${cloud_config_arg[@]}"
|
"${cloud_config_arg[@]}"
|
||||||
"--bootstrap-kubeconfig=${CERT_DIR}/kubelet.kubeconfig"
|
"--bootstrap-kubeconfig=${CERT_DIR}/kubelet.kubeconfig"
|
||||||
|
@ -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,11 +49,9 @@ 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 a future release. Image garbage collector will get sandbox image information from CRI.")
|
||||||
|
|
||||||
// Image credential provider settings.
|
// Image credential provider settings.
|
||||||
fs.StringVar(&s.ImageCredentialProviderConfigFile, "image-credential-provider-config", s.ImageCredentialProviderConfigFile, "The path to the credential provider plugin config file.")
|
fs.StringVar(&s.ImageCredentialProviderConfigFile, "image-credential-provider-config", s.ImageCredentialProviderConfigFile, "The path to the credential provider plugin config file.")
|
||||||
|
@ -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