Merge pull request #89128 from vincent178/move-runonce-kubeletconfiguration

move runonce from flag to config
This commit is contained in:
Kubernetes Prow Robot 2020-04-23 17:20:07 -07:00 committed by GitHub
commit 30cefca5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 8 deletions

View File

@ -61,13 +61,6 @@ type KubeletFlags struct {
// Crash immediately, rather than eating panics. // Crash immediately, rather than eating panics.
ReallyCrashForTesting bool ReallyCrashForTesting bool
// TODO(mtaufen): It is increasingly looking like nobody actually uses the
// Kubelet's runonce mode anymore, so it may be a candidate
// for deprecation and removal.
// If runOnce is true, the Kubelet will check the API server once for pods,
// run those in addition to the pods specified by static pod files, and exit.
RunOnce bool
// enableServer enables the Kubelet's server // enableServer enables the Kubelet's server
EnableServer bool EnableServer bool
@ -356,7 +349,6 @@ func (f *KubeletFlags) AddFlags(mainfs *pflag.FlagSet) {
fs.BoolVar(&f.ReallyCrashForTesting, "really-crash-for-testing", f.ReallyCrashForTesting, "If true, when panics occur crash. Intended for testing.") fs.BoolVar(&f.ReallyCrashForTesting, "really-crash-for-testing", f.ReallyCrashForTesting, "If true, when panics occur crash. Intended for testing.")
fs.Float64Var(&f.ChaosChance, "chaos-chance", f.ChaosChance, "If > 0.0, introduce random client errors and latency. Intended for testing.") fs.Float64Var(&f.ChaosChance, "chaos-chance", f.ChaosChance, "If > 0.0, introduce random client errors and latency. Intended for testing.")
fs.BoolVar(&f.RunOnce, "runonce", f.RunOnce, "If true, exit after spawning pods from static pod files or remote urls. Exclusive with --enable-server")
fs.BoolVar(&f.EnableServer, "enable-server", f.EnableServer, "Enable the Kubelet's server") fs.BoolVar(&f.EnableServer, "enable-server", f.EnableServer, "Enable the Kubelet's server")
fs.StringVar(&f.HostnameOverride, "hostname-override", f.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname. If --cloud-provider is set, the cloud provider determines the name of the node (consult cloud provider documentation to determine if and how the hostname is used).") fs.StringVar(&f.HostnameOverride, "hostname-override", f.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname. If --cloud-provider is set, the cloud provider determines the name of the node (consult cloud provider documentation to determine if and how the hostname is used).")
@ -524,6 +516,9 @@ func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfig
fs.Int64Var(&c.PodPidsLimit, "pod-max-pids", c.PodPidsLimit, "Set the maximum number of processes per pod. If -1, the kubelet defaults to the node allocatable pid capacity.") fs.Int64Var(&c.PodPidsLimit, "pod-max-pids", c.PodPidsLimit, "Set the maximum number of processes per pod. If -1, the kubelet defaults to the node allocatable pid capacity.")
fs.StringVar(&c.ResolverConfig, "resolv-conf", c.ResolverConfig, "Resolver configuration file used as the basis for the container DNS resolution configuration.") fs.StringVar(&c.ResolverConfig, "resolv-conf", c.ResolverConfig, "Resolver configuration file used as the basis for the container DNS resolution configuration.")
fs.BoolVar(&c.RunOnce, "runonce", c.RunOnce, "If true, exit after spawning pods from static pod files or remote urls. Exclusive with --enable-server")
fs.BoolVar(&c.CPUCFSQuota, "cpu-cfs-quota", c.CPUCFSQuota, "Enable CPU CFS quota enforcement for containers that specify CPU limits") fs.BoolVar(&c.CPUCFSQuota, "cpu-cfs-quota", c.CPUCFSQuota, "Enable CPU CFS quota enforcement for containers that specify CPU limits")
fs.DurationVar(&c.CPUCFSQuotaPeriod.Duration, "cpu-cfs-quota-period", c.CPUCFSQuotaPeriod.Duration, "Sets CPU CFS quota period value, cpu.cfs_period_us, defaults to Linux Kernel default") fs.DurationVar(&c.CPUCFSQuotaPeriod.Duration, "cpu-cfs-quota-period", c.CPUCFSQuotaPeriod.Duration, "Sets CPU CFS quota period value, cpu.cfs_period_us, defaults to Linux Kernel default")
fs.BoolVar(&c.EnableControllerAttachDetach, "enable-controller-attach-detach", c.EnableControllerAttachDetach, "Enables the Attach/Detach controller to manage attachment/detachment of volumes scheduled to this node, and disables kubelet from executing any attach/detach operations") fs.BoolVar(&c.EnableControllerAttachDetach, "enable-controller-attach-detach", c.EnableControllerAttachDetach, "Enables the Attach/Detach controller to manage attachment/detachment of volumes scheduled to this node, and disables kubelet from executing any attach/detach operations")

View File

@ -214,6 +214,7 @@ var (
"RegistryPullQPS", "RegistryPullQPS",
"ReservedSystemCPUs", "ReservedSystemCPUs",
"RuntimeRequestTimeout.Duration", "RuntimeRequestTimeout.Duration",
"RunOnce",
"SerializeImagePulls", "SerializeImagePulls",
"ShowHiddenMetricsForVersion", "ShowHiddenMetricsForVersion",
"StreamingConnectionIdleTimeout.Duration", "StreamingConnectionIdleTimeout.Duration",

View File

@ -241,6 +241,9 @@ type KubeletConfiguration struct {
// ResolverConfig is the resolver configuration file used as the basis // ResolverConfig is the resolver configuration file used as the basis
// for the container DNS resolution configuration. // for the container DNS resolution configuration.
ResolverConfig string ResolverConfig string
// RunOnce causes the Kubelet to check the API server once for pods,
// run those in addition to the pods specified by static pod files, and exit.
RunOnce bool
// cpuCFSQuota enables CPU CFS quota enforcement for containers that // cpuCFSQuota enables CPU CFS quota enforcement for containers that
// specify CPU limits // specify CPU limits
CPUCFSQuota bool CPUCFSQuota bool

View File

@ -280,6 +280,7 @@ func autoConvert_v1beta1_KubeletConfiguration_To_config_KubeletConfiguration(in
return err return err
} }
out.ResolverConfig = in.ResolverConfig out.ResolverConfig = in.ResolverConfig
out.RunOnce = in.RunOnce
if err := v1.Convert_Pointer_bool_To_bool(&in.CPUCFSQuota, &out.CPUCFSQuota, s); err != nil { if err := v1.Convert_Pointer_bool_To_bool(&in.CPUCFSQuota, &out.CPUCFSQuota, s); err != nil {
return err return err
} }
@ -416,6 +417,7 @@ func autoConvert_config_KubeletConfiguration_To_v1beta1_KubeletConfiguration(in
return err return err
} }
out.ResolverConfig = in.ResolverConfig out.ResolverConfig = in.ResolverConfig
out.RunOnce = in.RunOnce
if err := v1.Convert_bool_To_Pointer_bool(&in.CPUCFSQuota, &out.CPUCFSQuota, s); err != nil { if err := v1.Convert_bool_To_Pointer_bool(&in.CPUCFSQuota, &out.CPUCFSQuota, s); err != nil {
return err return err
} }

View File

@ -490,6 +490,11 @@ type KubeletConfiguration struct {
// Default: "/etc/resolv.conf" // Default: "/etc/resolv.conf"
// +optional // +optional
ResolverConfig string `json:"resolvConf,omitempty"` ResolverConfig string `json:"resolvConf,omitempty"`
// RunOnce causes the Kubelet to check the API server once for pods,
// run those in addition to the pods specified by static pod files, and exit.
// Default: false
// +optional
RunOnce bool `json:"runOnce,omitempty"`
// cpuCFSQuota enables CPU CFS quota enforcement for containers that // cpuCFSQuota enables CPU CFS quota enforcement for containers that
// specify CPU limits. // specify CPU limits.
// Dynamic Kubelet Config (beta): If dynamically updating this field, consider that // Dynamic Kubelet Config (beta): If dynamically updating this field, consider that