Move ungated 'alpha' KubeletConfiguration fields and self-registration fields to KubeletFlags

pull/6/head
Michael Taufen 2017-11-12 12:16:01 -08:00
parent 6f35d49079
commit 523c68ff65
17 changed files with 67 additions and 167 deletions

View File

@ -31,6 +31,7 @@ go_library(
deps = [ deps = [
"//cmd/kubelet/app/options:go_default_library", "//cmd/kubelet/app/options:go_default_library",
"//pkg/api/legacyscheme:go_default_library", "//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/core:go_default_library",
"//pkg/capabilities:go_default_library", "//pkg/capabilities:go_default_library",
"//pkg/client/chaosclient:go_default_library", "//pkg/client/chaosclient:go_default_library",
"//pkg/cloudprovider:go_default_library", "//pkg/cloudprovider:go_default_library",

View File

@ -15,6 +15,7 @@ go_library(
importpath = "k8s.io/kubernetes/cmd/kubelet/app/options", importpath = "k8s.io/kubernetes/cmd/kubelet/app/options",
deps = [ deps = [
"//pkg/apis/componentconfig:go_default_library", "//pkg/apis/componentconfig:go_default_library",
"//pkg/apis/core:go_default_library",
"//pkg/features:go_default_library", "//pkg/features:go_default_library",
"//pkg/kubelet/apis/kubeletconfig:go_default_library", "//pkg/kubelet/apis/kubeletconfig:go_default_library",
"//pkg/kubelet/apis/kubeletconfig/scheme:go_default_library", "//pkg/kubelet/apis/kubeletconfig/scheme:go_default_library",

View File

@ -29,6 +29,7 @@ import (
utilfeature "k8s.io/apiserver/pkg/util/feature" utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/apiserver/pkg/util/flag" "k8s.io/apiserver/pkg/util/flag"
"k8s.io/kubernetes/pkg/apis/componentconfig" "k8s.io/kubernetes/pkg/apis/componentconfig"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig" "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
kubeletscheme "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/scheme" kubeletscheme "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/scheme"
@ -105,6 +106,14 @@ type KubeletFlags struct {
// To use this flag, the KubeletConfigFile feature gate must be enabled. // To use this flag, the KubeletConfigFile feature gate must be enabled.
InitConfigDir flag.StringFlag InitConfigDir flag.StringFlag
// registerNode enables automatic registration with the apiserver.
RegisterNode bool
// registerWithTaints are an array of taints to add to a node object when
// the kubelet registers itself. This only takes effect when registerNode
// is true and upon the initial registration of the node.
RegisterWithTaints []core.Taint
// EXPERIMENTAL FLAGS // EXPERIMENTAL FLAGS
// Whitelist of unsafe sysctls or sysctl patterns (ending in *). // Whitelist of unsafe sysctls or sysctl patterns (ending in *).
// +optional // +optional
@ -131,6 +140,20 @@ type KubeletFlags struct {
// how pod resource requests are reserved at the QoS level. // how pod resource requests are reserved at the QoS level.
// Currently only memory is supported. [default=none]" // Currently only memory is supported. [default=none]"
ExperimentalQOSReserved kubeletconfig.ConfigurationMap ExperimentalQOSReserved kubeletconfig.ConfigurationMap
// Node Labels are the node labels to add when registering the node in the cluster
NodeLabels map[string]string
// volumePluginDir is the full path of the directory in which to search
// for additional third party volume plugins
VolumePluginDir string
// lockFilePath is the path that kubelet will use to as a lock file.
// It uses this file as a lock to synchronize with other kubelet processes
// that may be running.
LockFilePath string
// ExitOnLockContention is a flag that signifies to the kubelet that it is running
// in "bootstrap" mode. This requires that 'LockFilePath' has been set.
// This will cause the kubelet to listen to inotify events on the lock file,
// releasing it and exiting when another process tries to open that file.
ExitOnLockContention bool
// DEPRECATED FLAGS // DEPRECATED FLAGS
// minimumGCAge is the minimum age for a finished container before it is // minimumGCAge is the minimum age for a finished container before it is
@ -188,6 +211,9 @@ func NewKubeletFlags() *KubeletFlags {
RotateCertificates: false, RotateCertificates: false,
// TODO(#54161:v1.11.0): Remove --enable-custom-metrics flag, it is deprecated. // TODO(#54161:v1.11.0): Remove --enable-custom-metrics flag, it is deprecated.
EnableCustomMetrics: false, EnableCustomMetrics: false,
NodeLabels: make(map[string]string),
VolumePluginDir: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/",
RegisterNode: true,
} }
} }
@ -294,6 +320,9 @@ func (f *KubeletFlags) AddFlags(fs *pflag.FlagSet) {
fs.Var(&f.DynamicConfigDir, "dynamic-config-dir", "The Kubelet will use this directory for checkpointing downloaded configurations and tracking configuration health. The Kubelet will create this directory if it does not already exist. The path may be absolute or relative; relative paths start at the Kubelet's current working directory. Providing this flag enables dynamic Kubelet configuration. Presently, you must also enable the DynamicKubeletConfig feature gate to pass this flag.") fs.Var(&f.DynamicConfigDir, "dynamic-config-dir", "The Kubelet will use this directory for checkpointing downloaded configurations and tracking configuration health. The Kubelet will create this directory if it does not already exist. The path may be absolute or relative; relative paths start at the Kubelet's current working directory. Providing this flag enables dynamic Kubelet configuration. Presently, you must also enable the DynamicKubeletConfig feature gate to pass this flag.")
fs.Var(&f.InitConfigDir, "init-config-dir", "The Kubelet will look in this directory for the init configuration. The path may be absolute or relative; relative paths start at the Kubelet's current working directory. Omit this argument to use the built-in default configuration values. Presently, you must also enable the KubeletConfigFile feature gate to pass this flag.") fs.Var(&f.InitConfigDir, "init-config-dir", "The Kubelet will look in this directory for the init configuration. The path may be absolute or relative; relative paths start at the Kubelet's current working directory. Omit this argument to use the built-in default configuration values. Presently, you must also enable the KubeletConfigFile feature gate to pass this flag.")
fs.BoolVar(&f.RegisterNode, "register-node", f.RegisterNode, "Register the node with the apiserver. If --kubeconfig is not provided, this flag is irrelevant, as the Kubelet won't have an apiserver to register with. Default=true.")
fs.Var(utiltaints.NewTaintsVar(&f.RegisterWithTaints), "register-with-taints", "Register the node with the given list of taints (comma separated \"<key>=<value>:<effect>\"). No-op if register-node is false.")
// EXPERIMENTAL FLAGS // EXPERIMENTAL FLAGS
fs.StringVar(&f.ExperimentalMounterPath, "experimental-mounter-path", f.ExperimentalMounterPath, "[Experimental] Path of mounter binary. Leave empty to use the default mount.") fs.StringVar(&f.ExperimentalMounterPath, "experimental-mounter-path", f.ExperimentalMounterPath, "[Experimental] Path of mounter binary. Leave empty to use the default mount.")
fs.StringSliceVar(&f.AllowedUnsafeSysctls, "experimental-allowed-unsafe-sysctls", f.AllowedUnsafeSysctls, "Comma-separated whitelist of unsafe sysctls or unsafe sysctl patterns (ending in *). Use these at your own risk.") fs.StringSliceVar(&f.AllowedUnsafeSysctls, "experimental-allowed-unsafe-sysctls", f.AllowedUnsafeSysctls, "Comma-separated whitelist of unsafe sysctls or unsafe sysctl patterns (ending in *). Use these at your own risk.")
@ -304,6 +333,11 @@ func (f *KubeletFlags) AddFlags(fs *pflag.FlagSet) {
fs.BoolVar(&f.ExperimentalCheckNodeCapabilitiesBeforeMount, "experimental-check-node-capabilities-before-mount", f.ExperimentalCheckNodeCapabilitiesBeforeMount, "[Experimental] if set true, the kubelet will check the underlying node for required componenets (binaries, etc.) before performing the mount") fs.BoolVar(&f.ExperimentalCheckNodeCapabilitiesBeforeMount, "experimental-check-node-capabilities-before-mount", f.ExperimentalCheckNodeCapabilitiesBeforeMount, "[Experimental] if set true, the kubelet will check the underlying node for required componenets (binaries, etc.) before performing the mount")
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]") 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]")
fs.Var(&f.ExperimentalQOSReserved, "experimental-qos-reserved", "A set of ResourceName=Percentage (e.g. memory=50%) pairs that describe how pod resource requests are reserved at the QoS level. Currently only memory is supported. [default=none]") fs.Var(&f.ExperimentalQOSReserved, "experimental-qos-reserved", "A set of ResourceName=Percentage (e.g. memory=50%) pairs that describe how pod resource requests are reserved at the QoS level. Currently only memory is supported. [default=none]")
bindableNodeLabels := flag.ConfigurationMap(f.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.StringVar(&f.VolumePluginDir, "volume-plugin-dir", f.VolumePluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for additional third party volume plugins")
fs.StringVar(&f.LockFilePath, "lock-file", f.LockFilePath, "<Warning: Alpha feature> The path to file for kubelet to use as a lock file.")
fs.BoolVar(&f.ExitOnLockContention, "exit-on-lock-contention", f.ExitOnLockContention, "Whether kubelet should exit upon lock-file contention.")
// DEPRECATED FLAGS // DEPRECATED FLAGS
fs.DurationVar(&f.MinimumGCAge.Duration, "minimum-container-ttl-duration", f.MinimumGCAge.Duration, "Minimum age for a finished container before it is garbage collected. Examples: '300ms', '10s' or '2h45m'") fs.DurationVar(&f.MinimumGCAge.Duration, "minimum-container-ttl-duration", f.MinimumGCAge.Duration, "Minimum age for a finished container before it is garbage collected. Examples: '300ms', '10s' or '2h45m'")
@ -387,20 +421,15 @@ func AddKubeletConfigFlags(fs *pflag.FlagSet, c *kubeletconfig.KubeletConfigurat
fs.Int32Var(&c.HealthzPort, "healthz-port", c.HealthzPort, "The port of the localhost healthz endpoint (set to 0 to disable)") fs.Int32Var(&c.HealthzPort, "healthz-port", c.HealthzPort, "The port of the localhost healthz endpoint (set to 0 to disable)")
fs.Var(componentconfig.IPVar{Val: &c.HealthzBindAddress}, "healthz-bind-address", "The IP address for the healthz server to serve on. (set to 0.0.0.0 for all interfaces)") fs.Var(componentconfig.IPVar{Val: &c.HealthzBindAddress}, "healthz-bind-address", "The IP address for the healthz server to serve on. (set to 0.0.0.0 for all interfaces)")
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]") 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]")
fs.BoolVar(&c.RegisterNode, "register-node", c.RegisterNode, "Register the node with the apiserver. If --kubeconfig is not provided, this flag is irrelevant, as the Kubelet won't have an apiserver to register with. Default=true.")
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") 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")
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.") 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.")
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'") 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'")
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.") 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.")
c.NodeLabels = make(map[string]string)
bindableNodeLabels := flag.ConfigurationMap(c.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(&c.ImageMinimumGCAge.Duration, "minimum-image-ttl-duration", c.ImageMinimumGCAge.Duration, "Minimum age for an unused image before it is garbage collected. Examples: '300ms', '10s' or '2h45m'.") fs.DurationVar(&c.ImageMinimumGCAge.Duration, "minimum-image-ttl-duration", c.ImageMinimumGCAge.Duration, "Minimum age for an unused image before it is garbage collected. Examples: '300ms', '10s' or '2h45m'.")
fs.Int32Var(&c.ImageGCHighThresholdPercent, "image-gc-high-threshold", c.ImageGCHighThresholdPercent, "The percent of disk usage after which image garbage collection is always run.") fs.Int32Var(&c.ImageGCHighThresholdPercent, "image-gc-high-threshold", c.ImageGCHighThresholdPercent, "The percent of disk usage after which image garbage collection is always run.")
fs.Int32Var(&c.ImageGCLowThresholdPercent, "image-gc-low-threshold", c.ImageGCLowThresholdPercent, "The percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to.") fs.Int32Var(&c.ImageGCLowThresholdPercent, "image-gc-low-threshold", c.ImageGCLowThresholdPercent, "The percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to.")
fs.DurationVar(&c.VolumeStatsAggPeriod.Duration, "volume-stats-agg-period", c.VolumeStatsAggPeriod.Duration, "Specifies interval for kubelet to calculate and cache the volume disk usage for all pods and volumes. To disable volume calculations, set to 0.") fs.DurationVar(&c.VolumeStatsAggPeriod.Duration, "volume-stats-agg-period", c.VolumeStatsAggPeriod.Duration, "Specifies interval for kubelet to calculate and cache the volume disk usage for all pods and volumes. To disable volume calculations, set to 0.")
fs.StringVar(&c.VolumePluginDir, "volume-plugin-dir", c.VolumePluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for additional third party volume plugins")
fs.Var(flag.MapStringBool(c.FeatureGates), "feature-gates", "A set of key=value pairs that describe feature gates for alpha/experimental features. "+ fs.Var(flag.MapStringBool(c.FeatureGates), "feature-gates", "A set of key=value pairs that describe feature gates for alpha/experimental features. "+
"Options are:\n"+strings.Join(utilfeature.DefaultFeatureGate.KnownFeatures(), "\n")) "Options are:\n"+strings.Join(utilfeature.DefaultFeatureGate.KnownFeatures(), "\n"))
fs.StringVar(&c.KubeletCgroups, "kubelet-cgroups", c.KubeletCgroups, "Optional absolute name of cgroups to create and run the Kubelet in.") fs.StringVar(&c.KubeletCgroups, "kubelet-cgroups", c.KubeletCgroups, "Optional absolute name of cgroups to create and run the Kubelet in.")
@ -412,8 +441,6 @@ func AddKubeletConfigFlags(fs *pflag.FlagSet, c *kubeletconfig.KubeletConfigurat
fs.StringVar(&c.CPUManagerPolicy, "cpu-manager-policy", c.CPUManagerPolicy, "<Warning: Alpha feature> CPU Manager policy to use. Possible values: 'none', 'static'. Default: 'none'") fs.StringVar(&c.CPUManagerPolicy, "cpu-manager-policy", c.CPUManagerPolicy, "<Warning: Alpha feature> CPU Manager policy to use. Possible values: 'none', 'static'. Default: 'none'")
fs.DurationVar(&c.CPUManagerReconcilePeriod.Duration, "cpu-manager-reconcile-period", c.CPUManagerReconcilePeriod.Duration, "<Warning: Alpha feature> CPU Manager reconciliation period. Examples: '10s', or '1m'. If not supplied, defaults to `NodeStatusUpdateFrequency`") fs.DurationVar(&c.CPUManagerReconcilePeriod.Duration, "cpu-manager-reconcile-period", c.CPUManagerReconcilePeriod.Duration, "<Warning: Alpha feature> CPU Manager reconciliation period. Examples: '10s', or '1m'. If not supplied, defaults to `NodeStatusUpdateFrequency`")
fs.DurationVar(&c.RuntimeRequestTimeout.Duration, "runtime-request-timeout", c.RuntimeRequestTimeout.Duration, "Timeout of all runtime requests except long running request - pull, logs, exec and attach. When timeout exceeded, kubelet will cancel the request, throw out an error and retry later.") fs.DurationVar(&c.RuntimeRequestTimeout.Duration, "runtime-request-timeout", c.RuntimeRequestTimeout.Duration, "Timeout of all runtime requests except long running request - pull, logs, exec and attach. When timeout exceeded, kubelet will cancel the request, throw out an error and retry later.")
fs.StringVar(&c.LockFilePath, "lock-file", c.LockFilePath, "<Warning: Alpha feature> The path to file for kubelet to use as a lock file.")
fs.BoolVar(&c.ExitOnLockContention, "exit-on-lock-contention", c.ExitOnLockContention, "Whether kubelet should exit upon lock-file contention.")
fs.StringVar(&c.HairpinMode, "hairpin-mode", c.HairpinMode, "How should the kubelet setup hairpin NAT. This allows endpoints of a Service to loadbalance back to themselves if they should try to access their own Service. Valid values are \"promiscuous-bridge\", \"hairpin-veth\" and \"none\".") fs.StringVar(&c.HairpinMode, "hairpin-mode", c.HairpinMode, "How should the kubelet setup hairpin NAT. This allows endpoints of a Service to loadbalance back to themselves if they should try to access their own Service. Valid values are \"promiscuous-bridge\", \"hairpin-veth\" and \"none\".")
fs.Int32Var(&c.MaxPods, "max-pods", c.MaxPods, "Number of Pods that can run on this Kubelet.") fs.Int32Var(&c.MaxPods, "max-pods", c.MaxPods, "Number of Pods that can run on this Kubelet.")
@ -428,7 +455,6 @@ func AddKubeletConfigFlags(fs *pflag.FlagSet, c *kubeletconfig.KubeletConfigurat
// Flags intended for testing, not recommended used in production environments. // Flags intended for testing, not recommended used in production environments.
fs.Int64Var(&c.MaxOpenFiles, "max-open-files", c.MaxOpenFiles, "Number of files that can be opened by Kubelet process.") fs.Int64Var(&c.MaxOpenFiles, "max-open-files", c.MaxOpenFiles, "Number of files that can be opened by Kubelet process.")
fs.Var(utiltaints.NewTaintsVar(&c.RegisterWithTaints), "register-with-taints", "Register the node with the given list of taints (comma separated \"<key>=<value>:<effect>\"). No-op if register-node is false.")
fs.StringVar(&c.ContentType, "kube-api-content-type", c.ContentType, "Content type of requests sent to apiserver.") fs.StringVar(&c.ContentType, "kube-api-content-type", c.ContentType, "Content type of requests sent to apiserver.")
fs.Int32Var(&c.KubeAPIQPS, "kube-api-qps", c.KubeAPIQPS, "QPS to use while talking with kubernetes apiserver") fs.Int32Var(&c.KubeAPIQPS, "kube-api-qps", c.KubeAPIQPS, "QPS to use while talking with kubernetes apiserver")
fs.Int32Var(&c.KubeAPIBurst, "kube-api-burst", c.KubeAPIBurst, "Burst to use while talking with kubernetes apiserver") fs.Int32Var(&c.KubeAPIBurst, "kube-api-burst", c.KubeAPIBurst, "Burst to use while talking with kubernetes apiserver")

View File

@ -55,6 +55,7 @@ import (
"k8s.io/client-go/util/certificate" "k8s.io/client-go/util/certificate"
"k8s.io/kubernetes/cmd/kubelet/app/options" "k8s.io/kubernetes/cmd/kubelet/app/options"
"k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/legacyscheme"
api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/capabilities" "k8s.io/kubernetes/pkg/capabilities"
"k8s.io/kubernetes/pkg/client/chaosclient" "k8s.io/kubernetes/pkg/client/chaosclient"
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
@ -709,6 +710,8 @@ func RunKubelet(kubeFlags *options.KubeletFlags, kubeCfg *kubeletconfiginternal.
kubeFlags.CloudProvider, kubeFlags.CloudProvider,
kubeFlags.CertDirectory, kubeFlags.CertDirectory,
kubeFlags.RootDirectory, kubeFlags.RootDirectory,
kubeFlags.RegisterNode,
kubeFlags.RegisterWithTaints,
kubeFlags.AllowedUnsafeSysctls, kubeFlags.AllowedUnsafeSysctls,
kubeFlags.Containerized, kubeFlags.Containerized,
kubeFlags.RemoteRuntimeEndpoint, kubeFlags.RemoteRuntimeEndpoint,
@ -723,7 +726,8 @@ func RunKubelet(kubeFlags *options.KubeletFlags, kubeCfg *kubeletconfiginternal.
kubeFlags.MasterServiceNamespace, kubeFlags.MasterServiceNamespace,
kubeFlags.RegisterSchedulable, kubeFlags.RegisterSchedulable,
kubeFlags.NonMasqueradeCIDR, kubeFlags.NonMasqueradeCIDR,
kubeFlags.KeepTerminatedPodVolumes) kubeFlags.KeepTerminatedPodVolumes,
kubeFlags.NodeLabels)
if err != nil { if err != nil {
return fmt.Errorf("failed to create kubelet: %v", err) return fmt.Errorf("failed to create kubelet: %v", err)
} }
@ -778,6 +782,8 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
cloudProvider string, cloudProvider string,
certDirectory string, certDirectory string,
rootDirectory string, rootDirectory string,
registerNode bool,
registerWithTaints []api.Taint,
allowedUnsafeSysctls []string, allowedUnsafeSysctls []string,
containerized bool, containerized bool,
remoteRuntimeEndpoint string, remoteRuntimeEndpoint string,
@ -792,7 +798,8 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
masterServiceNamespace string, masterServiceNamespace string,
registerSchedulable bool, registerSchedulable bool,
nonMasqueradeCIDR string, nonMasqueradeCIDR string,
keepTerminatedPodVolumes bool) (k kubelet.Bootstrap, err error) { keepTerminatedPodVolumes bool,
nodeLabels map[string]string) (k kubelet.Bootstrap, err error) {
// TODO: block until all sources have delivered at least one update to the channel, or break the sync loop // TODO: block until all sources have delivered at least one update to the channel, or break the sync loop
// up into "per source" synchronizations // up into "per source" synchronizations
@ -807,6 +814,8 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
cloudProvider, cloudProvider,
certDirectory, certDirectory,
rootDirectory, rootDirectory,
registerNode,
registerWithTaints,
allowedUnsafeSysctls, allowedUnsafeSysctls,
containerized, containerized,
remoteRuntimeEndpoint, remoteRuntimeEndpoint,
@ -821,7 +830,8 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
masterServiceNamespace, masterServiceNamespace,
registerSchedulable, registerSchedulable,
nonMasqueradeCIDR, nonMasqueradeCIDR,
keepTerminatedPodVolumes) keepTerminatedPodVolumes,
nodeLabels)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -17,7 +17,6 @@ go_library(
], ],
importpath = "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig", importpath = "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig",
deps = [ deps = [
"//pkg/apis/core:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",

View File

@ -27,8 +27,5 @@ func KubeletConfigurationPathRefs(kc *KubeletConfiguration) []*string {
paths = append(paths, &kc.TLSPrivateKeyFile) paths = append(paths, &kc.TLSPrivateKeyFile)
paths = append(paths, &kc.SeccompProfileRoot) paths = append(paths, &kc.SeccompProfileRoot)
paths = append(paths, &kc.ResolverConfig) paths = append(paths, &kc.ResolverConfig)
// TODO(#55562): planning on moving two out of KubeletConfiguration
paths = append(paths, &kc.VolumePluginDir)
paths = append(paths, &kc.LockFilePath)
return paths return paths
} }

View File

@ -134,8 +134,6 @@ var (
"TLSPrivateKeyFile", "TLSPrivateKeyFile",
"SeccompProfileRoot", "SeccompProfileRoot",
"ResolverConfig", "ResolverConfig",
"VolumePluginDir",
"LockFilePath",
) )
// KubeletConfiguration fields that do not contain file paths. // KubeletConfiguration fields that do not contain file paths.
@ -172,7 +170,6 @@ var (
"EvictionPressureTransitionPeriod.Duration", "EvictionPressureTransitionPeriod.Duration",
"EvictionSoft", "EvictionSoft",
"EvictionSoftGracePeriod", "EvictionSoftGracePeriod",
"ExitOnLockContention",
"FailSwapOn", "FailSwapOn",
"FeatureGates[*]", "FeatureGates[*]",
"FileCheckFrequency.Duration", "FileCheckFrequency.Duration",
@ -198,7 +195,6 @@ var (
"ManifestURLHeader[*][*]", "ManifestURLHeader[*][*]",
"MaxOpenFiles", "MaxOpenFiles",
"MaxPods", "MaxPods",
"NodeLabels[*]",
"NodeStatusUpdateFrequency.Duration", "NodeStatusUpdateFrequency.Duration",
"OOMScoreAdj", "OOMScoreAdj",
"PodCIDR", "PodCIDR",
@ -206,25 +202,6 @@ var (
"Port", "Port",
"ProtectKernelDefaults", "ProtectKernelDefaults",
"ReadOnlyPort", "ReadOnlyPort",
"RegisterNode",
"RegisterWithTaints[*].Effect",
"RegisterWithTaints[*].Key",
"RegisterWithTaints[*].TimeAdded.Time.ext",
"RegisterWithTaints[*].TimeAdded.Time.loc.cacheEnd",
"RegisterWithTaints[*].TimeAdded.Time.loc.cacheStart",
"RegisterWithTaints[*].TimeAdded.Time.loc.cacheZone.isDST",
"RegisterWithTaints[*].TimeAdded.Time.loc.cacheZone.name",
"RegisterWithTaints[*].TimeAdded.Time.loc.cacheZone.offset",
"RegisterWithTaints[*].TimeAdded.Time.loc.name",
"RegisterWithTaints[*].TimeAdded.Time.loc.tx[*].index",
"RegisterWithTaints[*].TimeAdded.Time.loc.tx[*].isstd",
"RegisterWithTaints[*].TimeAdded.Time.loc.tx[*].isutc",
"RegisterWithTaints[*].TimeAdded.Time.loc.tx[*].when",
"RegisterWithTaints[*].TimeAdded.Time.loc.zone[*].isDST",
"RegisterWithTaints[*].TimeAdded.Time.loc.zone[*].name",
"RegisterWithTaints[*].TimeAdded.Time.loc.zone[*].offset",
"RegisterWithTaints[*].TimeAdded.Time.wall",
"RegisterWithTaints[*].Value",
"RegistryBurst", "RegistryBurst",
"RegistryPullQPS", "RegistryPullQPS",
"RuntimeRequestTimeout.Duration", "RuntimeRequestTimeout.Duration",

View File

@ -22,7 +22,6 @@ import (
"strings" "strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
api "k8s.io/kubernetes/pkg/apis/core"
) )
// HairpinMode denotes how the kubelet should configure networking to handle // HairpinMode denotes how the kubelet should configure networking to handle
@ -138,8 +137,6 @@ type KubeletConfiguration struct {
// oomScoreAdj is The oom-score-adj value for kubelet process. Values // oomScoreAdj is The oom-score-adj value for kubelet process. Values
// must be within the range [-1000, 1000]. // must be within the range [-1000, 1000].
OOMScoreAdj int32 OOMScoreAdj int32
// registerNode enables automatic registration with the apiserver.
RegisterNode bool
// clusterDomain is the DNS domain for this cluster. If set, kubelet will // clusterDomain is the DNS domain for this cluster. If set, kubelet will
// configure all containers to search this domain in addition to the // configure all containers to search this domain in addition to the
// host's search domains. // host's search domains.
@ -167,9 +164,6 @@ type KubeletConfiguration struct {
ImageGCLowThresholdPercent int32 ImageGCLowThresholdPercent int32
// How frequently to calculate and cache volume disk usage for all pods // How frequently to calculate and cache volume disk usage for all pods
VolumeStatsAggPeriod metav1.Duration VolumeStatsAggPeriod metav1.Duration
// volumePluginDir is the full path of the directory in which to search
// for additional third party volume plugins
VolumePluginDir string
// KubeletCgroups is the absolute name of cgroups to isolate the kubelet in. // KubeletCgroups is the absolute name of cgroups to isolate the kubelet in.
// +optional // +optional
KubeletCgroups string KubeletCgroups string
@ -198,15 +192,6 @@ type KubeletConfiguration struct {
// requests - pull, logs, exec and attach. // requests - pull, logs, exec and attach.
// +optional // +optional
RuntimeRequestTimeout metav1.Duration RuntimeRequestTimeout metav1.Duration
// lockFilePath is the path that kubelet will use to as a lock file.
// It uses this file as a lock to synchronize with other kubelet processes
// that may be running.
LockFilePath string
// ExitOnLockContention is a flag that signifies to the kubelet that it is running
// in "bootstrap" mode. This requires that 'LockFilePath' has been set.
// This will cause the kubelet to listen to inotify events on the lock file,
// releasing it and exiting when another process tries to open that file.
ExitOnLockContention bool
// How should the kubelet configure the container bridge for hairpin packets. // How should the kubelet configure the container bridge for hairpin packets.
// Setting this flag allows endpoints in a Service to loadbalance back to // Setting this flag allows endpoints in a Service to loadbalance back to
// themselves if they should try to access their own Service. Values: // themselves if they should try to access their own Service. Values:
@ -229,10 +214,6 @@ type KubeletConfiguration struct {
CPUCFSQuota bool CPUCFSQuota bool
// maxOpenFiles is Number of files that can be opened by Kubelet process. // maxOpenFiles is Number of files that can be opened by Kubelet process.
MaxOpenFiles int64 MaxOpenFiles int64
// registerWithTaints are an array of taints to add to a node object when
// the kubelet registers itself. This only takes effect when registerNode
// is true and upon the initial registration of the node.
RegisterWithTaints []api.Taint
// contentType is contentType of requests sent to apiserver. // contentType is contentType of requests sent to apiserver.
ContentType string ContentType string
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver // kubeAPIQPS is the QPS to use while talking with kubernetes apiserver
@ -245,8 +226,6 @@ type KubeletConfiguration struct {
// run docker daemon with version < 1.9 or an Aufs storage backend. // run docker daemon with version < 1.9 or an Aufs storage backend.
// Issue #10959 has more details. // Issue #10959 has more details.
SerializeImagePulls bool SerializeImagePulls bool
// nodeLabels to add when registering the node in the cluster.
NodeLabels map[string]string
// Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'. // Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'.
// +optional // +optional
EvictionHard string EvictionHard string

View File

@ -18,13 +18,11 @@ go_library(
], ],
importpath = "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/v1alpha1", importpath = "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/v1alpha1",
deps = [ deps = [
"//pkg/apis/core:go_default_library",
"//pkg/kubelet/apis/kubeletconfig:go_default_library", "//pkg/kubelet/apis/kubeletconfig:go_default_library",
"//pkg/kubelet/qos:go_default_library", "//pkg/kubelet/qos:go_default_library",
"//pkg/kubelet/types:go_default_library", "//pkg/kubelet/types:go_default_library",
"//pkg/master/ports:go_default_library", "//pkg/master/ports:go_default_library",
"//pkg/util/pointer:go_default_library", "//pkg/util/pointer:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library", "//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",

View File

@ -145,9 +145,6 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
if obj.MaxPods == 0 { if obj.MaxPods == 0 {
obj.MaxPods = 110 obj.MaxPods = 110
} }
if obj.VolumePluginDir == "" {
obj.VolumePluginDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/"
}
if obj.NodeStatusUpdateFrequency == zeroDuration { if obj.NodeStatusUpdateFrequency == zeroDuration {
obj.NodeStatusUpdateFrequency = metav1.Duration{Duration: 10 * time.Second} obj.NodeStatusUpdateFrequency = metav1.Duration{Duration: 10 * time.Second}
} }
@ -167,9 +164,6 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
if obj.ReadOnlyPort == nil { if obj.ReadOnlyPort == nil {
obj.ReadOnlyPort = utilpointer.Int32Ptr(ports.KubeletReadOnlyPort) obj.ReadOnlyPort = utilpointer.Int32Ptr(ports.KubeletReadOnlyPort)
} }
if obj.RegisterNode == nil {
obj.RegisterNode = boolVar(true)
}
if obj.RegistryBurst == 0 { if obj.RegistryBurst == 0 {
obj.RegistryBurst = 10 obj.RegistryBurst = 10
} }

View File

@ -17,7 +17,6 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
@ -134,8 +133,6 @@ type KubeletConfiguration struct {
// oomScoreAdj is The oom-score-adj value for kubelet process. Values // oomScoreAdj is The oom-score-adj value for kubelet process. Values
// must be within the range [-1000, 1000]. // must be within the range [-1000, 1000].
OOMScoreAdj *int32 `json:"oomScoreAdj"` OOMScoreAdj *int32 `json:"oomScoreAdj"`
// registerNode enables automatic registration with the apiserver.
RegisterNode *bool `json:"registerNode"`
// clusterDomain is the DNS domain for this cluster. If set, kubelet will // clusterDomain is the DNS domain for this cluster. If set, kubelet will
// configure all containers to search this domain in addition to the // configure all containers to search this domain in addition to the
// host's search domains. // host's search domains.
@ -164,9 +161,6 @@ type KubeletConfiguration struct {
ImageGCLowThresholdPercent *int32 `json:"imageGCLowThresholdPercent"` ImageGCLowThresholdPercent *int32 `json:"imageGCLowThresholdPercent"`
// How frequently to calculate and cache volume disk usage for all pods // How frequently to calculate and cache volume disk usage for all pods
VolumeStatsAggPeriod metav1.Duration `json:"volumeStatsAggPeriod"` VolumeStatsAggPeriod metav1.Duration `json:"volumeStatsAggPeriod"`
// volumePluginDir is the full path of the directory in which to search
// for additional third party volume plugins
VolumePluginDir string `json:"volumePluginDir"`
// kubeletCgroups is the absolute name of cgroups to isolate the kubelet in. // kubeletCgroups is the absolute name of cgroups to isolate the kubelet in.
KubeletCgroups string `json:"kubeletCgroups"` KubeletCgroups string `json:"kubeletCgroups"`
// systemCgroups is absolute name of cgroups in which to place // systemCgroups is absolute name of cgroups in which to place
@ -191,15 +185,6 @@ type KubeletConfiguration struct {
// runtimeRequestTimeout is the timeout for all runtime requests except long running // runtimeRequestTimeout is the timeout for all runtime requests except long running
// requests - pull, logs, exec and attach. // requests - pull, logs, exec and attach.
RuntimeRequestTimeout metav1.Duration `json:"runtimeRequestTimeout"` RuntimeRequestTimeout metav1.Duration `json:"runtimeRequestTimeout"`
// lockFilePath is the path that kubelet will use to as a lock file.
// It uses this file as a lock to synchronize with other kubelet processes
// that may be running.
LockFilePath *string `json:"lockFilePath"`
// ExitOnLockContention is a flag that signifies to the kubelet that it is running
// in "bootstrap" mode. This requires that 'LockFilePath' has been set.
// This will cause the kubelet to listen to inotify events on the lock file,
// releasing it and exiting when another process tries to open that file.
ExitOnLockContention bool `json:"exitOnLockContention"`
// How should the kubelet configure the container bridge for hairpin packets. // How should the kubelet configure the container bridge for hairpin packets.
// Setting this flag allows endpoints in a Service to loadbalance back to // Setting this flag allows endpoints in a Service to loadbalance back to
// themselves if they should try to access their own Service. Values: // themselves if they should try to access their own Service. Values:
@ -222,10 +207,6 @@ type KubeletConfiguration struct {
CPUCFSQuota *bool `json:"cpuCFSQuota"` CPUCFSQuota *bool `json:"cpuCFSQuota"`
// maxOpenFiles is Number of files that can be opened by Kubelet process. // maxOpenFiles is Number of files that can be opened by Kubelet process.
MaxOpenFiles int64 `json:"maxOpenFiles"` MaxOpenFiles int64 `json:"maxOpenFiles"`
// registerWithTaints are an array of taints to add to a node object when
// the kubelet registers itself. This only takes effect when registerNode
// is true and upon the initial registration of the node.
RegisterWithTaints []v1.Taint `json:"registerWithTaints"`
// contentType is contentType of requests sent to apiserver. // contentType is contentType of requests sent to apiserver.
ContentType string `json:"contentType"` ContentType string `json:"contentType"`
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver // kubeAPIQPS is the QPS to use while talking with kubernetes apiserver
@ -238,8 +219,6 @@ type KubeletConfiguration struct {
// run docker daemon with version < 1.9 or an Aufs storage backend. // run docker daemon with version < 1.9 or an Aufs storage backend.
// Issue #10959 has more details. // Issue #10959 has more details.
SerializeImagePulls *bool `json:"serializeImagePulls"` SerializeImagePulls *bool `json:"serializeImagePulls"`
// nodeLabels to add when registering the node in the cluster.
NodeLabels map[string]string `json:"nodeLabels"`
// Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'. // Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'.
EvictionHard *string `json:"evictionHard"` EvictionHard *string `json:"evictionHard"`
// Comma-delimited list of soft eviction expressions. For example, 'memory.available<300Mi'. // Comma-delimited list of soft eviction expressions. For example, 'memory.available<300Mi'.

View File

@ -21,11 +21,9 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
core_v1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
core "k8s.io/kubernetes/pkg/apis/core"
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig" kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
unsafe "unsafe" unsafe "unsafe"
) )
@ -194,9 +192,6 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
if err := v1.Convert_Pointer_int32_To_int32(&in.OOMScoreAdj, &out.OOMScoreAdj, s); err != nil { if err := v1.Convert_Pointer_int32_To_int32(&in.OOMScoreAdj, &out.OOMScoreAdj, s); err != nil {
return err return err
} }
if err := v1.Convert_Pointer_bool_To_bool(&in.RegisterNode, &out.RegisterNode, s); err != nil {
return err
}
out.ClusterDomain = in.ClusterDomain out.ClusterDomain = in.ClusterDomain
out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS)) out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS))
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
@ -209,7 +204,6 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
return err return err
} }
out.VolumeStatsAggPeriod = in.VolumeStatsAggPeriod out.VolumeStatsAggPeriod = in.VolumeStatsAggPeriod
out.VolumePluginDir = in.VolumePluginDir
out.KubeletCgroups = in.KubeletCgroups out.KubeletCgroups = in.KubeletCgroups
out.SystemCgroups = in.SystemCgroups out.SystemCgroups = in.SystemCgroups
out.CgroupRoot = in.CgroupRoot out.CgroupRoot = in.CgroupRoot
@ -220,10 +214,6 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
out.CPUManagerPolicy = in.CPUManagerPolicy out.CPUManagerPolicy = in.CPUManagerPolicy
out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod
out.RuntimeRequestTimeout = in.RuntimeRequestTimeout out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
if err := v1.Convert_Pointer_string_To_string(&in.LockFilePath, &out.LockFilePath, s); err != nil {
return err
}
out.ExitOnLockContention = in.ExitOnLockContention
out.HairpinMode = in.HairpinMode out.HairpinMode = in.HairpinMode
out.MaxPods = in.MaxPods out.MaxPods = in.MaxPods
out.PodCIDR = in.PodCIDR out.PodCIDR = in.PodCIDR
@ -232,7 +222,6 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
return err return err
} }
out.MaxOpenFiles = in.MaxOpenFiles out.MaxOpenFiles = in.MaxOpenFiles
out.RegisterWithTaints = *(*[]core.Taint)(unsafe.Pointer(&in.RegisterWithTaints))
out.ContentType = in.ContentType out.ContentType = in.ContentType
if err := v1.Convert_Pointer_int32_To_int32(&in.KubeAPIQPS, &out.KubeAPIQPS, s); err != nil { if err := v1.Convert_Pointer_int32_To_int32(&in.KubeAPIQPS, &out.KubeAPIQPS, s); err != nil {
return err return err
@ -241,7 +230,6 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
if err := v1.Convert_Pointer_bool_To_bool(&in.SerializeImagePulls, &out.SerializeImagePulls, s); err != nil { if err := v1.Convert_Pointer_bool_To_bool(&in.SerializeImagePulls, &out.SerializeImagePulls, s); err != nil {
return err return err
} }
out.NodeLabels = *(*map[string]string)(unsafe.Pointer(&in.NodeLabels))
if err := v1.Convert_Pointer_string_To_string(&in.EvictionHard, &out.EvictionHard, s); err != nil { if err := v1.Convert_Pointer_string_To_string(&in.EvictionHard, &out.EvictionHard, s); err != nil {
return err return err
} }
@ -332,9 +320,6 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
if err := v1.Convert_int32_To_Pointer_int32(&in.OOMScoreAdj, &out.OOMScoreAdj, s); err != nil { if err := v1.Convert_int32_To_Pointer_int32(&in.OOMScoreAdj, &out.OOMScoreAdj, s); err != nil {
return err return err
} }
if err := v1.Convert_bool_To_Pointer_bool(&in.RegisterNode, &out.RegisterNode, s); err != nil {
return err
}
out.ClusterDomain = in.ClusterDomain out.ClusterDomain = in.ClusterDomain
out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS)) out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS))
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
@ -347,7 +332,6 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
return err return err
} }
out.VolumeStatsAggPeriod = in.VolumeStatsAggPeriod out.VolumeStatsAggPeriod = in.VolumeStatsAggPeriod
out.VolumePluginDir = in.VolumePluginDir
out.KubeletCgroups = in.KubeletCgroups out.KubeletCgroups = in.KubeletCgroups
if err := v1.Convert_bool_To_Pointer_bool(&in.CgroupsPerQOS, &out.CgroupsPerQOS, s); err != nil { if err := v1.Convert_bool_To_Pointer_bool(&in.CgroupsPerQOS, &out.CgroupsPerQOS, s); err != nil {
return err return err
@ -358,10 +342,6 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
out.CPUManagerPolicy = in.CPUManagerPolicy out.CPUManagerPolicy = in.CPUManagerPolicy
out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod
out.RuntimeRequestTimeout = in.RuntimeRequestTimeout out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
if err := v1.Convert_string_To_Pointer_string(&in.LockFilePath, &out.LockFilePath, s); err != nil {
return err
}
out.ExitOnLockContention = in.ExitOnLockContention
out.HairpinMode = in.HairpinMode out.HairpinMode = in.HairpinMode
out.MaxPods = in.MaxPods out.MaxPods = in.MaxPods
out.PodCIDR = in.PodCIDR out.PodCIDR = in.PodCIDR
@ -370,7 +350,6 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
return err return err
} }
out.MaxOpenFiles = in.MaxOpenFiles out.MaxOpenFiles = in.MaxOpenFiles
out.RegisterWithTaints = *(*[]core_v1.Taint)(unsafe.Pointer(&in.RegisterWithTaints))
out.ContentType = in.ContentType out.ContentType = in.ContentType
if err := v1.Convert_int32_To_Pointer_int32(&in.KubeAPIQPS, &out.KubeAPIQPS, s); err != nil { if err := v1.Convert_int32_To_Pointer_int32(&in.KubeAPIQPS, &out.KubeAPIQPS, s); err != nil {
return err return err
@ -379,7 +358,6 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
if err := v1.Convert_bool_To_Pointer_bool(&in.SerializeImagePulls, &out.SerializeImagePulls, s); err != nil { if err := v1.Convert_bool_To_Pointer_bool(&in.SerializeImagePulls, &out.SerializeImagePulls, s); err != nil {
return err return err
} }
out.NodeLabels = *(*map[string]string)(unsafe.Pointer(&in.NodeLabels))
if err := v1.Convert_string_To_Pointer_string(&in.EvictionHard, &out.EvictionHard, s); err != nil { if err := v1.Convert_string_To_Pointer_string(&in.EvictionHard, &out.EvictionHard, s); err != nil {
return err return err
} }

View File

@ -21,7 +21,6 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
core_v1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
) )
@ -213,15 +212,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
**out = **in **out = **in
} }
} }
if in.RegisterNode != nil {
in, out := &in.RegisterNode, &out.RegisterNode
if *in == nil {
*out = nil
} else {
*out = new(bool)
**out = **in
}
}
if in.ClusterDNS != nil { if in.ClusterDNS != nil {
in, out := &in.ClusterDNS, &out.ClusterDNS in, out := &in.ClusterDNS, &out.ClusterDNS
*out = make([]string, len(*in)) *out = make([]string, len(*in))
@ -260,15 +250,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
} }
out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod
out.RuntimeRequestTimeout = in.RuntimeRequestTimeout out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
if in.LockFilePath != nil {
in, out := &in.LockFilePath, &out.LockFilePath
if *in == nil {
*out = nil
} else {
*out = new(string)
**out = **in
}
}
if in.CPUCFSQuota != nil { if in.CPUCFSQuota != nil {
in, out := &in.CPUCFSQuota, &out.CPUCFSQuota in, out := &in.CPUCFSQuota, &out.CPUCFSQuota
if *in == nil { if *in == nil {
@ -278,13 +259,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
**out = **in **out = **in
} }
} }
if in.RegisterWithTaints != nil {
in, out := &in.RegisterWithTaints, &out.RegisterWithTaints
*out = make([]core_v1.Taint, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.KubeAPIQPS != nil { if in.KubeAPIQPS != nil {
in, out := &in.KubeAPIQPS, &out.KubeAPIQPS in, out := &in.KubeAPIQPS, &out.KubeAPIQPS
if *in == nil { if *in == nil {
@ -303,13 +277,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
**out = **in **out = **in
} }
} }
if in.NodeLabels != nil {
in, out := &in.NodeLabels, &out.NodeLabels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.EvictionHard != nil { if in.EvictionHard != nil {
in, out := &in.EvictionHard, &out.EvictionHard in, out := &in.EvictionHard, &out.EvictionHard
if *in == nil { if *in == nil {

View File

@ -23,7 +23,6 @@ package kubeletconfig
import ( import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
core "k8s.io/kubernetes/pkg/apis/core"
) )
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -134,20 +133,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
out.VolumeStatsAggPeriod = in.VolumeStatsAggPeriod out.VolumeStatsAggPeriod = in.VolumeStatsAggPeriod
out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod
out.RuntimeRequestTimeout = in.RuntimeRequestTimeout out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
if in.RegisterWithTaints != nil {
in, out := &in.RegisterWithTaints, &out.RegisterWithTaints
*out = make([]core.Taint, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.NodeLabels != nil {
in, out := &in.NodeLabels, &out.NodeLabels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod
if in.FeatureGates != nil { if in.FeatureGates != nil {
in, out := &in.FeatureGates, &out.FeatureGates in, out := &in.FeatureGates, &out.FeatureGates

View File

@ -200,6 +200,8 @@ type Builder func(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
cloudProvider string, cloudProvider string,
certDirectory string, certDirectory string,
rootDirectory string, rootDirectory string,
registerNode bool,
registerWithTaints []api.Taint,
allowedUnsafeSysctls []string, allowedUnsafeSysctls []string,
containerized bool, containerized bool,
remoteRuntimeEndpoint string, remoteRuntimeEndpoint string,
@ -214,7 +216,8 @@ type Builder func(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
masterServiceNamespace string, masterServiceNamespace string,
registerSchedulable bool, registerSchedulable bool,
nonMasqueradeCIDR string, nonMasqueradeCIDR string,
keepTerminatedPodVolumes bool) (Bootstrap, error) keepTerminatedPodVolumes bool,
nodeLabels map[string]string) (Bootstrap, error)
// Dependencies is a bin for things we might consider "injected dependencies" -- objects constructed // Dependencies is a bin for things we might consider "injected dependencies" -- objects constructed
// at runtime that are necessary for running the Kubelet. This is a temporary solution for grouping // at runtime that are necessary for running the Kubelet. This is a temporary solution for grouping
@ -323,6 +326,8 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
cloudProvider string, cloudProvider string,
certDirectory string, certDirectory string,
rootDirectory string, rootDirectory string,
registerNode bool,
registerWithTaints []api.Taint,
allowedUnsafeSysctls []string, allowedUnsafeSysctls []string,
containerized bool, containerized bool,
remoteRuntimeEndpoint string, remoteRuntimeEndpoint string,
@ -337,7 +342,8 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
masterServiceNamespace string, masterServiceNamespace string,
registerSchedulable bool, registerSchedulable bool,
nonMasqueradeCIDR string, nonMasqueradeCIDR string,
keepTerminatedPodVolumes bool) (*Kubelet, error) { keepTerminatedPodVolumes bool,
nodeLabels map[string]string) (*Kubelet, error) {
if rootDirectory == "" { if rootDirectory == "" {
return nil, fmt.Errorf("invalid root directory %q", rootDirectory) return nil, fmt.Errorf("invalid root directory %q", rootDirectory)
} }
@ -486,7 +492,8 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
rootDirectory: rootDirectory, rootDirectory: rootDirectory,
resyncInterval: kubeCfg.SyncFrequency.Duration, resyncInterval: kubeCfg.SyncFrequency.Duration,
sourcesReady: config.NewSourcesReady(kubeDeps.PodConfig.SeenAllSources), sourcesReady: config.NewSourcesReady(kubeDeps.PodConfig.SeenAllSources),
registerNode: kubeCfg.RegisterNode, registerNode: registerNode,
registerWithTaints: registerWithTaints,
registerSchedulable: registerSchedulable, registerSchedulable: registerSchedulable,
clusterDomain: kubeCfg.ClusterDomain, clusterDomain: kubeCfg.ClusterDomain,
clusterDNS: clusterDNS, clusterDNS: clusterDNS,
@ -501,7 +508,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
externalCloudProvider: cloudprovider.IsExternal(cloudProvider), externalCloudProvider: cloudprovider.IsExternal(cloudProvider),
providerID: providerID, providerID: providerID,
nodeRef: nodeRef, nodeRef: nodeRef,
nodeLabels: kubeCfg.NodeLabels, nodeLabels: nodeLabels,
nodeStatusUpdateFrequency: kubeCfg.NodeStatusUpdateFrequency.Duration, nodeStatusUpdateFrequency: kubeCfg.NodeStatusUpdateFrequency.Duration,
os: kubeDeps.OSInterface, os: kubeDeps.OSInterface,
oomWatcher: oomWatcher, oomWatcher: oomWatcher,
@ -943,6 +950,8 @@ type Kubelet struct {
// Set to true to have the node register itself with the apiserver. // Set to true to have the node register itself with the apiserver.
registerNode bool registerNode bool
// List of taints to add to a node object when the kubelet registers itself.
registerWithTaints []api.Taint
// Set to true to have the node register itself as schedulable. // Set to true to have the node register itself as schedulable.
registerSchedulable bool registerSchedulable bool
// for internal book keeping; access only from within registerWithApiserver // for internal book keeping; access only from within registerWithApiserver

View File

@ -233,10 +233,10 @@ func (kl *Kubelet) initialNode() (*v1.Node, error) {
}, },
} }
nodeTaints := make([]v1.Taint, 0) nodeTaints := make([]v1.Taint, 0)
if len(kl.kubeletConfiguration.RegisterWithTaints) > 0 { if len(kl.registerWithTaints) > 0 {
taints := make([]v1.Taint, len(kl.kubeletConfiguration.RegisterWithTaints)) taints := make([]v1.Taint, len(kl.registerWithTaints))
for i := range kl.kubeletConfiguration.RegisterWithTaints { for i := range kl.registerWithTaints {
if err := k8s_api_v1.Convert_core_Taint_To_v1_Taint(&kl.kubeletConfiguration.RegisterWithTaints[i], &taints[i], nil); err != nil { if err := k8s_api_v1.Convert_core_Taint_To_v1_Taint(&kl.registerWithTaints[i], &taints[i], nil); err != nil {
return nil, err return nil, err
} }
} }

View File

@ -115,6 +115,7 @@ func GetHollowKubeletConfig(
f.MinimumGCAge = metav1.Duration{Duration: 1 * time.Minute} f.MinimumGCAge = metav1.Duration{Duration: 1 * time.Minute}
f.MaxContainerCount = 100 f.MaxContainerCount = 100
f.MaxPerPodContainerCount = 2 f.MaxPerPodContainerCount = 2
f.RegisterNode = true
f.RegisterSchedulable = true f.RegisterSchedulable = true
// Config struct // Config struct
@ -150,7 +151,6 @@ func GetHollowKubeletConfig(
// set promiscuous mode on docker0. // set promiscuous mode on docker0.
c.HairpinMode = kubeletconfig.HairpinVeth c.HairpinMode = kubeletconfig.HairpinVeth
c.MaxOpenFiles = 1024 c.MaxOpenFiles = 1024
c.RegisterNode = true
c.RegistryBurst = 10 c.RegistryBurst = 10
c.RegistryPullQPS = 5.0 c.RegistryPullQPS = 5.0
c.ResolverConfig = kubetypes.ResolvConfDefault c.ResolverConfig = kubetypes.ResolvConfDefault