Skip to content

Commit 6c49931

Browse files
authored
Merge pull request kubernetes#88480 from savitharaghunathan/kubelet_flag_migration_1
Kubelet flag migration - Part 1
2 parents 105c0c6 + 3234d34 commit 6c49931

File tree

8 files changed

+20
-5
lines changed

8 files changed

+20
-5
lines changed

cmd/kubelet/app/options/options.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ type KubeletFlags struct {
144144
ExperimentalNodeAllocatableIgnoreEvictionThreshold bool
145145
// Node Labels are the node labels to add when registering the node in the cluster
146146
NodeLabels map[string]string
147-
// volumePluginDir is the full path of the directory in which to search
148-
// for additional third party volume plugins
149-
VolumePluginDir string
150147
// lockFilePath is the path that kubelet will use to as a lock file.
151148
// It uses this file as a lock to synchronize with other kubelet processes
152149
// that may be running.
@@ -214,7 +211,6 @@ func NewKubeletFlags() *KubeletFlags {
214211
ExperimentalKernelMemcgNotification: false,
215212
RemoteRuntimeEndpoint: remoteRuntimeEndpoint,
216213
NodeLabels: make(map[string]string),
217-
VolumePluginDir: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/",
218214
RegisterNode: true,
219215
SeccompProfileRoot: filepath.Join(defaultRootDir, "seccomp"),
220216
// prior to the introduction of this flag, there was a hardcoded cap of 50 images
@@ -391,7 +387,6 @@ func (f *KubeletFlags) AddFlags(mainfs *pflag.FlagSet) {
391387
fs.BoolVar(&f.ExperimentalNodeAllocatableIgnoreEvictionThreshold, "experimental-allocatable-ignore-eviction", f.ExperimentalNodeAllocatableIgnoreEvictionThreshold, "When set to 'true', Hard Eviction Thresholds will be ignored while calculating Node Allocatable. See https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/ for more details. [default=false]")
392388
bindableNodeLabels := cliflag.ConfigurationMap(f.NodeLabels)
393389
fs.Var(&bindableNodeLabels, "node-labels", fmt.Sprintf("<Warning: Alpha feature> Labels to add when registering the node in the cluster. Labels must be key=value pairs separated by ','. Labels in the 'kubernetes.io' namespace must begin with an allowed prefix (%s) or be in the specifically allowed set (%s)", strings.Join(kubeletapis.KubeletLabelNamespaces(), ", "), strings.Join(kubeletapis.KubeletLabels(), ", ")))
394-
fs.StringVar(&f.VolumePluginDir, "volume-plugin-dir", f.VolumePluginDir, "The full path of the directory in which to search for additional third party volume plugins")
395390
fs.StringVar(&f.LockFilePath, "lock-file", f.LockFilePath, "<Warning: Alpha feature> The path to file for kubelet to use as a lock file.")
396391
fs.BoolVar(&f.ExitOnLockContention, "exit-on-lock-contention", f.ExitOnLockContention, "Whether kubelet should exit upon lock-file contention.")
397392
fs.StringVar(&f.SeccompProfileRoot, "seccomp-profile-root", f.SeccompProfileRoot, "<Warning: Alpha feature> Directory path for seccomp profiles.")
@@ -501,6 +496,7 @@ func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfig
501496
fs.Int32Var(&c.OOMScoreAdj, "oom-score-adj", c.OOMScoreAdj, "The oom-score-adj value for kubelet process. Values must be within the range [-1000, 1000]")
502497
fs.StringVar(&c.ClusterDomain, "cluster-domain", c.ClusterDomain, "Domain for this cluster. If set, kubelet will configure all containers to search this domain in addition to the host's search domains")
503498

499+
fs.StringVar(&c.VolumePluginDir, "volume-plugin-dir", c.VolumePluginDir, "The full path of the directory in which to search for additional third party volume plugins")
504500
fs.StringSliceVar(&c.ClusterDNS, "cluster-dns", c.ClusterDNS, "Comma-separated list of DNS server IP address. This value is used for containers DNS server in case of Pods with \"dnsPolicy=ClusterFirst\". Note: all DNS servers appearing in the list MUST serve the same set of records otherwise name resolution within the cluster may not work correctly. There is no guarantee as to which DNS server may be contacted for name resolution.")
505501
fs.DurationVar(&c.StreamingConnectionIdleTimeout.Duration, "streaming-connection-idle-timeout", c.StreamingConnectionIdleTimeout.Duration, "Maximum time a streaming connection can be idle before the connection is automatically closed. 0 indicates no timeout. Example: '5m'")
506502
fs.DurationVar(&c.NodeStatusUpdateFrequency.Duration, "node-status-update-frequency", c.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.")

pkg/kubelet/apis/config/fuzzer/fuzzer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
9696
obj.ContainerLogMaxSize = "10Mi"
9797
obj.ConfigMapAndSecretChangeDetectionStrategy = "Watch"
9898
obj.AllowedUnsafeSysctls = []string{}
99+
obj.VolumePluginDir = kubeletconfigv1beta1.DefaultVolumePluginDir
99100
},
100101
}
101102
}

pkg/kubelet/apis/config/helpers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ func KubeletConfigurationPathRefs(kc *KubeletConfiguration) []*string {
2626
paths = append(paths, &kc.TLSCertFile)
2727
paths = append(paths, &kc.TLSPrivateKeyFile)
2828
paths = append(paths, &kc.ResolverConfig)
29+
paths = append(paths, &kc.VolumePluginDir)
2930
return paths
3031
}

pkg/kubelet/apis/config/helpers_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,5 +224,6 @@ var (
224224
"TypeMeta.APIVersion",
225225
"TypeMeta.Kind",
226226
"VolumeStatsAggPeriod.Duration",
227+
"VolumePluginDir",
227228
)
228229
)

pkg/kubelet/apis/config/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ type KubeletConfiguration struct {
9797
// readOnlyPort is the read-only port for the Kubelet to serve on with
9898
// no authentication/authorization (set to 0 to disable)
9999
ReadOnlyPort int32
100+
// volumePluginDir is the full path of the directory in which to search
101+
// for additional third party volume plugins.
102+
VolumePluginDir string
100103
// tlsCertFile is the file containing x509 Certificate for HTTPS. (CA cert,
101104
// if any, concatenated after server cert). If tlsCertFile and
102105
// tlsPrivateKeyFile are not provided, a self-signed certificate

pkg/kubelet/apis/config/v1beta1/defaults.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const (
3333
// TODO: Move these constants to k8s.io/kubelet/config/v1beta1 instead?
3434
DefaultIPTablesMasqueradeBit = 14
3535
DefaultIPTablesDropBit = 15
36+
DefaultVolumePluginDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/"
3637
)
3738

3839
var (
@@ -223,4 +224,7 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
223224
if obj.EnforceNodeAllocatable == nil {
224225
obj.EnforceNodeAllocatable = DefaultNodeAllocatableEnforcement
225226
}
227+
if obj.VolumePluginDir == "" {
228+
obj.VolumePluginDir = DefaultVolumePluginDir
229+
}
226230
}

pkg/kubelet/apis/config/v1beta1/zz_generated.conversion.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/kubelet/config/v1beta1/types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,13 @@ type KubeletConfiguration struct {
755755
// Default: []
756756
// +optional
757757
AllowedUnsafeSysctls []string `json:"allowedUnsafeSysctls,omitempty"`
758+
// volumePluginDir is the full path of the directory in which to search
759+
// for additional third party volume plugins.
760+
// Dynamic Kubelet Config (beta): If dynamically updating this field, consider that changing
761+
// the volumePluginDir may disrupt workloads relying on third party volume plugins.
762+
// Default: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/"
763+
// +optional
764+
VolumePluginDir string `json:"volumePluginDir,omitempty"`
758765
}
759766

760767
type KubeletAuthorizationMode string

0 commit comments

Comments
 (0)