mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-19 08:54:44 +00:00
pkg/util: move flags from pkg/util/config to pkg/util/flags
This commit is contained in:
@@ -24,8 +24,8 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1"
|
||||
utilconfig "k8s.io/kubernetes/pkg/util/config"
|
||||
"k8s.io/kubernetes/pkg/util/flag"
|
||||
utilflag "k8s.io/kubernetes/pkg/util/flag"
|
||||
utiltaints "k8s.io/kubernetes/pkg/util/taints"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
@@ -169,7 +169,7 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.DurationVar(&s.StreamingConnectionIdleTimeout.Duration, "streaming-connection-idle-timeout", s.StreamingConnectionIdleTimeout.Duration, "Maximum time a streaming connection can be idle before the connection is automatically closed. 0 indicates no timeout. Example: '5m'")
|
||||
fs.DurationVar(&s.NodeStatusUpdateFrequency.Duration, "node-status-update-frequency", s.NodeStatusUpdateFrequency.Duration, "Specifies how often kubelet posts node status to master. Note: be cautious when changing the constant, it must work with nodeMonitorGracePeriod in nodecontroller. Default: 10s")
|
||||
s.NodeLabels = make(map[string]string)
|
||||
bindableNodeLabels := utilconfig.ConfigurationMap(s.NodeLabels)
|
||||
bindableNodeLabels := utilflag.ConfigurationMap(s.NodeLabels)
|
||||
fs.Var(&bindableNodeLabels, "node-labels", "<Warning: Alpha feature> Labels to add when registering the node in the cluster. Labels must be key=value pairs separated by ','.")
|
||||
fs.DurationVar(&s.ImageMinimumGCAge.Duration, "minimum-image-ttl-duration", s.ImageMinimumGCAge.Duration, "Minimum age for an unused image before it is garbage collected. Examples: '300ms', '10s' or '2h45m'. Default: '2m'")
|
||||
fs.Int32Var(&s.ImageGCHighThresholdPercent, "image-gc-high-threshold", s.ImageGCHighThresholdPercent, "The percent of disk usage after which image garbage collection is always run. Default: 90%")
|
||||
@@ -185,7 +185,7 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&s.CloudProvider, "cloud-provider", s.CloudProvider, "The provider for cloud services. By default, kubelet will attempt to auto-detect the cloud provider. Specify empty string for running with no cloud provider. [default=auto-detect]")
|
||||
fs.StringVar(&s.CloudConfigFile, "cloud-config", s.CloudConfigFile, "The path to the cloud provider configuration file. Empty string for no configuration file.")
|
||||
fs.StringVar(&s.FeatureGates, "feature-gates", s.FeatureGates, "A set of key=value pairs that describe feature gates for alpha/experimental features. "+
|
||||
"Options are:\n"+strings.Join(utilconfig.DefaultFeatureGate.KnownFeatures(), "\n"))
|
||||
"Options are:\n"+strings.Join(utilflag.DefaultFeatureGate.KnownFeatures(), "\n"))
|
||||
|
||||
fs.StringVar(&s.KubeletCgroups, "resource-container", s.KubeletCgroups, "Optional absolute name of the resource-only container to create and run the Kubelet in.")
|
||||
fs.MarkDeprecated("resource-container", "Use --kubelet-cgroups instead. Will be removed in a future version.")
|
||||
|
@@ -70,8 +70,8 @@ import (
|
||||
"k8s.io/kubernetes/pkg/kubelet/dockertools"
|
||||
"k8s.io/kubernetes/pkg/kubelet/server"
|
||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
utilconfig "k8s.io/kubernetes/pkg/util/config"
|
||||
"k8s.io/kubernetes/pkg/util/configz"
|
||||
utilflag "k8s.io/kubernetes/pkg/util/flag"
|
||||
"k8s.io/kubernetes/pkg/util/flock"
|
||||
kubeio "k8s.io/kubernetes/pkg/util/io"
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
@@ -328,14 +328,14 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.KubeletDeps) (err error) {
|
||||
}
|
||||
|
||||
// Set feature gates based on the value in KubeletConfiguration
|
||||
err = utilconfig.DefaultFeatureGate.Set(s.KubeletConfiguration.FeatureGates)
|
||||
err = utilflag.DefaultFeatureGate.Set(s.KubeletConfiguration.FeatureGates)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Register current configuration with /configz endpoint
|
||||
cfgz, cfgzErr := initConfigz(&s.KubeletConfiguration)
|
||||
if utilconfig.DefaultFeatureGate.DynamicKubeletConfig() {
|
||||
if utilflag.DefaultFeatureGate.DynamicKubeletConfig() {
|
||||
// Look for config on the API server. If it exists, replace s.KubeletConfiguration
|
||||
// with it and continue. initKubeletConfigSync also starts the background thread that checks for new config.
|
||||
|
||||
@@ -352,7 +352,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.KubeletDeps) (err error) {
|
||||
setConfigz(cfgz, &s.KubeletConfiguration)
|
||||
}
|
||||
// Update feature gates from the new config
|
||||
err = utilconfig.DefaultFeatureGate.Set(s.KubeletConfiguration.FeatureGates)
|
||||
err = utilflag.DefaultFeatureGate.Set(s.KubeletConfiguration.FeatureGates)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"k8s.io/kubernetes/pkg/kubelet"
|
||||
"k8s.io/kubernetes/pkg/util/config"
|
||||
utilflag "k8s.io/kubernetes/pkg/util/flag"
|
||||
)
|
||||
|
||||
func TestValueOfAllocatableResources(t *testing.T) {
|
||||
@@ -51,8 +51,8 @@ func TestValueOfAllocatableResources(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
kubeReservedCM := make(config.ConfigurationMap)
|
||||
systemReservedCM := make(config.ConfigurationMap)
|
||||
kubeReservedCM := make(utilflag.ConfigurationMap)
|
||||
systemReservedCM := make(utilflag.ConfigurationMap)
|
||||
|
||||
kubeReservedCM.Set(test.kubeReserved)
|
||||
systemReservedCM.Set(test.systemReserved)
|
||||
|
Reference in New Issue
Block a user