Commit 3bba9144 authored by Shyam JVS's avatar Shyam JVS Committed by GitHub

Revert "Remove deprecated and experimental fields from KubeletConfiguration"

parent 9934d12c
...@@ -102,7 +102,6 @@ go_library( ...@@ -102,7 +102,6 @@ go_library(
"//vendor/github.com/spf13/pflag:go_default_library", "//vendor/github.com/spf13/pflag:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
......
...@@ -38,7 +38,6 @@ import ( ...@@ -38,7 +38,6 @@ import (
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
utilruntime "k8s.io/apimachinery/pkg/util/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
...@@ -673,30 +672,7 @@ func RunKubelet(kubeFlags *options.KubeletFlags, kubeCfg *kubeletconfiginternal. ...@@ -673,30 +672,7 @@ func RunKubelet(kubeFlags *options.KubeletFlags, kubeCfg *kubeletconfiginternal.
kubeDeps.OSInterface = kubecontainer.RealOS{} kubeDeps.OSInterface = kubecontainer.RealOS{}
} }
k, err := builder(kubeCfg, k, err := builder(kubeCfg, kubeDeps, &kubeFlags.ContainerRuntimeOptions, kubeFlags.HostnameOverride, kubeFlags.NodeIP, kubeFlags.ProviderID, kubeFlags.CloudProvider, kubeFlags.CertDirectory, kubeFlags.RootDirectory)
kubeDeps,
&kubeFlags.ContainerRuntimeOptions,
kubeFlags.HostnameOverride,
kubeFlags.NodeIP,
kubeFlags.ProviderID,
kubeFlags.CloudProvider,
kubeFlags.CertDirectory,
kubeFlags.RootDirectory,
kubeFlags.AllowedUnsafeSysctls,
kubeFlags.Containerized,
kubeFlags.RemoteRuntimeEndpoint,
kubeFlags.RemoteImageEndpoint,
kubeFlags.ExperimentalMounterPath,
kubeFlags.ExperimentalKernelMemcgNotification,
kubeFlags.ExperimentalCheckNodeCapabilitiesBeforeMount,
kubeFlags.ExperimentalNodeAllocatableIgnoreEvictionThreshold,
kubeFlags.MinimumGCAge,
kubeFlags.MaxPerPodContainerCount,
kubeFlags.MaxContainerCount,
kubeFlags.MasterServiceNamespace,
kubeFlags.RegisterSchedulable,
kubeFlags.NonMasqueradeCIDR,
kubeFlags.KeepTerminatedPodVolumes)
if err != nil { if err != nil {
return fmt.Errorf("failed to create kubelet: %v", err) return fmt.Errorf("failed to create kubelet: %v", err)
} }
...@@ -743,54 +719,16 @@ func startKubelet(k kubelet.Bootstrap, podCfg *config.PodConfig, kubeCfg *kubele ...@@ -743,54 +719,16 @@ func startKubelet(k kubelet.Bootstrap, podCfg *config.PodConfig, kubeCfg *kubele
func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration, func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
kubeDeps *kubelet.Dependencies, kubeDeps *kubelet.Dependencies,
crOptions *options.ContainerRuntimeOptions, crOptions *options.ContainerRuntimeOptions,
hostnameOverride string, hostnameOverride,
nodeIP string, nodeIP,
providerID string, providerID,
cloudProvider string, cloudProvider,
certDirectory string, certDirectory,
rootDirectory string, rootDirectory string) (k kubelet.Bootstrap, err error) {
allowedUnsafeSysctls []string,
containerized bool,
remoteRuntimeEndpoint string,
remoteImageEndpoint string,
experimentalMounterPath string,
experimentalKernelMemcgNotification bool,
experimentalCheckNodeCapabilitiesBeforeMount bool,
experimentalNodeAllocatableIgnoreEvictionThreshold bool,
minimumGCAge metav1.Duration,
maxPerPodContainerCount int32,
maxContainerCount int32,
masterServiceNamespace string,
registerSchedulable bool,
nonMasqueradeCIDR string,
keepTerminatedPodVolumes bool) (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
k, err = kubelet.NewMainKubelet(kubeCfg, k, err = kubelet.NewMainKubelet(kubeCfg, kubeDeps, crOptions, hostnameOverride, nodeIP, providerID, cloudProvider, certDirectory, rootDirectory)
kubeDeps,
crOptions,
hostnameOverride,
nodeIP,
providerID,
cloudProvider,
certDirectory,
rootDirectory,
allowedUnsafeSysctls,
containerized,
remoteRuntimeEndpoint,
remoteImageEndpoint,
experimentalMounterPath,
experimentalKernelMemcgNotification,
experimentalCheckNodeCapabilitiesBeforeMount,
experimentalNodeAllocatableIgnoreEvictionThreshold,
minimumGCAge,
maxPerPodContainerCount,
maxContainerCount,
masterServiceNamespace,
registerSchedulable,
nonMasqueradeCIDR,
keepTerminatedPodVolumes)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -864,8 +802,7 @@ func BootstrapKubeletConfigController(defaultConfig *kubeletconfiginternal.Kubel ...@@ -864,8 +802,7 @@ func BootstrapKubeletConfigController(defaultConfig *kubeletconfiginternal.Kubel
// RunDockershim only starts the dockershim in current process. This is only used for cri validate testing purpose // RunDockershim only starts the dockershim in current process. This is only used for cri validate testing purpose
// TODO(random-liu): Move this to a separate binary. // TODO(random-liu): Move this to a separate binary.
func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConfiguration) error { func RunDockershim(c *kubeletconfiginternal.KubeletConfiguration, r *options.ContainerRuntimeOptions) error {
r := &f.ContainerRuntimeOptions
// Create docker client. // Create docker client.
dockerClient := libdocker.ConnectToDockerOrDie(r.DockerEndpoint, c.RuntimeRequestTimeout.Duration, dockerClient := libdocker.ConnectToDockerOrDie(r.DockerEndpoint, c.RuntimeRequestTimeout.Duration,
r.ImagePullProgressDeadline.Duration) r.ImagePullProgressDeadline.Duration)
...@@ -878,7 +815,7 @@ func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConf ...@@ -878,7 +815,7 @@ func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConf
nh := &kubelet.NoOpLegacyHost{} nh := &kubelet.NoOpLegacyHost{}
pluginSettings := dockershim.NetworkPluginSettings{ pluginSettings := dockershim.NetworkPluginSettings{
HairpinMode: kubeletconfiginternal.HairpinMode(c.HairpinMode), HairpinMode: kubeletconfiginternal.HairpinMode(c.HairpinMode),
NonMasqueradeCIDR: f.NonMasqueradeCIDR, NonMasqueradeCIDR: c.NonMasqueradeCIDR,
PluginName: r.NetworkPluginName, PluginName: r.NetworkPluginName,
PluginConfDir: r.CNIConfDir, PluginConfDir: r.CNIConfDir,
PluginBinDir: binDir, PluginBinDir: binDir,
...@@ -906,7 +843,7 @@ func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConf ...@@ -906,7 +843,7 @@ func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConf
} }
glog.V(2).Infof("Starting the GRPC server for the docker CRI shim.") glog.V(2).Infof("Starting the GRPC server for the docker CRI shim.")
server := dockerremote.NewDockerServer(f.RemoteRuntimeEndpoint, ds) server := dockerremote.NewDockerServer(c.RemoteRuntimeEndpoint, ds)
if err := server.Start(); err != nil { if err := server.Start(); err != nil {
return err return err
} }
......
...@@ -97,7 +97,7 @@ func main() { ...@@ -97,7 +97,7 @@ func main() {
// start the experimental docker shim, if enabled // start the experimental docker shim, if enabled
if kubeletFlags.ExperimentalDockershim { if kubeletFlags.ExperimentalDockershim {
if err := app.RunDockershim(kubeletFlags, kubeletConfig); err != nil { if err := app.RunDockershim(kubeletConfig, &kubeletFlags.ContainerRuntimeOptions); err != nil {
die(err) die(err)
} }
} }
......
...@@ -45,10 +45,13 @@ const ( ...@@ -45,10 +45,13 @@ const (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// A configuration field should go in KubeletFlags instead of KubeletConfiguration if // A configuration field should go in KubeletFlags instead of KubeletConfiguration if any of these are true:
// its value cannot be safely shared between nodes at the same time (e.g. a hostname) // - its value will never, or cannot safely be changed during the lifetime of a node
// - its value cannot be safely shared between nodes at the same time (e.g. a hostname)
// KubeletConfiguration is intended to be shared between nodes
// In general, please try to avoid adding flags or configuration fields, // In general, please try to avoid adding flags or configuration fields,
// we already have a confusingly large amount of them. // we already have a confusingly large amount of them.
// TODO: curate the ordering and structure of this config object
type KubeletConfiguration struct { type KubeletConfiguration struct {
metav1.TypeMeta metav1.TypeMeta
...@@ -128,6 +131,15 @@ type KubeletConfiguration struct { ...@@ -128,6 +131,15 @@ type KubeletConfiguration struct {
EnableDebuggingHandlers bool EnableDebuggingHandlers bool
// enableContentionProfiling enables lock contention profiling, if enableDebuggingHandlers is true. // enableContentionProfiling enables lock contention profiling, if enableDebuggingHandlers is true.
EnableContentionProfiling bool EnableContentionProfiling bool
// minimumGCAge is the minimum age for a finished container before it is
// garbage collected.
MinimumGCAge metav1.Duration
// maxPerPodContainerCount is the maximum number of old instances to
// retain per container. Each container takes up some disk space.
MaxPerPodContainerCount int32
// maxContainerCount is the maximum number of old instances of containers
// to retain globally. Each container takes up some disk space.
MaxContainerCount int32
// cAdvisorPort is the port of the localhost cAdvisor endpoint (set to 0 to disable) // cAdvisorPort is the port of the localhost cAdvisor endpoint (set to 0 to disable)
CAdvisorPort int32 CAdvisorPort int32
// healthzPort is the port of the localhost healthz endpoint (set to 0 to disable) // healthzPort is the port of the localhost healthz endpoint (set to 0 to disable)
...@@ -144,6 +156,9 @@ type KubeletConfiguration struct { ...@@ -144,6 +156,9 @@ type KubeletConfiguration struct {
// 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.
ClusterDomain string ClusterDomain string
// masterServiceNamespace is The namespace from which the kubernetes
// master services should be injected into pods.
MasterServiceNamespace string
// clusterDNS is a list of IP address for a cluster DNS server. If set, // clusterDNS is a list of IP address for a cluster DNS server. If set,
// kubelet will configure all containers to use this for DNS resolution // kubelet will configure all containers to use this for DNS resolution
// instead of the host's DNS servers // instead of the host's DNS servers
...@@ -195,10 +210,16 @@ type KubeletConfiguration struct { ...@@ -195,10 +210,16 @@ type KubeletConfiguration struct {
CgroupRoot string CgroupRoot string
// containerRuntime is the container runtime to use. // containerRuntime is the container runtime to use.
ContainerRuntime string ContainerRuntime string
// remoteRuntimeEndpoint is the endpoint of remote runtime service
RemoteRuntimeEndpoint string
// remoteImageEndpoint is the endpoint of remote image service
RemoteImageEndpoint string
// 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.
// +optional // +optional
RuntimeRequestTimeout metav1.Duration RuntimeRequestTimeout metav1.Duration
// experimentalMounterPath is the path of mounter binary. Leave empty to use the default mount path
ExperimentalMounterPath string
// lockFilePath is the path that kubelet will use to as a lock file. // 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 // It uses this file as a lock to synchronize with other kubelet processes
// that may be running. // that may be running.
...@@ -228,8 +249,14 @@ type KubeletConfiguration struct { ...@@ -228,8 +249,14 @@ type KubeletConfiguration struct {
// cpuCFSQuota is Enable CPU CFS quota enforcement for containers that // cpuCFSQuota is Enable CPU CFS quota enforcement for containers that
// specify CPU limits // specify CPU limits
CPUCFSQuota bool CPUCFSQuota bool
// containerized should be set to true if kubelet is running in a container.
Containerized 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
// registerSchedulable tells the kubelet to register the node as
// schedulable. Won't have any effect if register-node is false.
// DEPRECATED: use registerWithTaints instead
RegisterSchedulable bool
// registerWithTaints are an array of taints to add to a node object when // registerWithTaints are an array of taints to add to a node object when
// the kubelet registers itself. This only takes effect when registerNode // the kubelet registers itself. This only takes effect when registerNode
// is true and upon the initial registration of the node. // is true and upon the initial registration of the node.
...@@ -248,6 +275,8 @@ type KubeletConfiguration struct { ...@@ -248,6 +275,8 @@ type KubeletConfiguration struct {
SerializeImagePulls bool SerializeImagePulls bool
// nodeLabels to add when registering the node in the cluster. // nodeLabels to add when registering the node in the cluster.
NodeLabels map[string]string NodeLabels map[string]string
// nonMasqueradeCIDR configures masquerading: traffic to IPs outside this range will use IP masquerade.
NonMasqueradeCIDR string
// enable gathering custom metrics. // enable gathering custom metrics.
EnableCustomMetrics bool EnableCustomMetrics bool
// Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'. // Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'.
...@@ -268,12 +297,19 @@ type KubeletConfiguration struct { ...@@ -268,12 +297,19 @@ type KubeletConfiguration struct {
// Comma-delimited list of minimum reclaims (e.g. imagefs.available=2Gi) that describes the minimum amount of resource the kubelet will reclaim when performing a pod eviction if that resource is under pressure. // Comma-delimited list of minimum reclaims (e.g. imagefs.available=2Gi) that describes the minimum amount of resource the kubelet will reclaim when performing a pod eviction if that resource is under pressure.
// +optional // +optional
EvictionMinimumReclaim string EvictionMinimumReclaim string
// If enabled, the kubelet will integrate with the kernel memcg notification to determine if memory eviction thresholds are crossed rather than polling.
// +optional
ExperimentalKernelMemcgNotification bool
// Maximum number of pods per core. Cannot exceed MaxPods // Maximum number of pods per core. Cannot exceed MaxPods
PodsPerCore int32 PodsPerCore int32
// enableControllerAttachDetach enables the Attach/Detach controller to // enableControllerAttachDetach enables the Attach/Detach controller to
// manage attachment/detachment of volumes scheduled to this node, and // manage attachment/detachment of volumes scheduled to this node, and
// disables kubelet from executing any attach/detach operations // disables kubelet from executing any attach/detach operations
EnableControllerAttachDetach bool EnableControllerAttachDetach bool
// 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]"
ExperimentalQOSReserved ConfigurationMap
// Default behaviour for kernel tuning // Default behaviour for kernel tuning
ProtectKernelDefaults bool ProtectKernelDefaults bool
// If true, Kubelet ensures a set of iptables rules are present on host. // If true, Kubelet ensures a set of iptables rules are present on host.
...@@ -288,11 +324,21 @@ type KubeletConfiguration struct { ...@@ -288,11 +324,21 @@ type KubeletConfiguration struct {
// iptablesDropBit is the bit of the iptables fwmark space to use for dropping packets. Kubelet will ensure iptables mark and drop rules. // iptablesDropBit is the bit of the iptables fwmark space to use for dropping packets. Kubelet will ensure iptables mark and drop rules.
// Values must be within the range [0, 31]. Must be different from IPTablesMasqueradeBit // Values must be within the range [0, 31]. Must be different from IPTablesMasqueradeBit
IPTablesDropBit int32 IPTablesDropBit int32
// Whitelist of unsafe sysctls or sysctl patterns (ending in *).
// +optional
AllowedUnsafeSysctls []string
// featureGates is a string of comma-separated key=value pairs that describe feature // featureGates is a string of comma-separated key=value pairs that describe feature
// gates for alpha/experimental features. // gates for alpha/experimental features.
FeatureGates string FeatureGates string
// Tells the Kubelet to fail to start if swap is enabled on the node. // Tells the Kubelet to fail to start if swap is enabled on the node.
FailSwapOn bool FailSwapOn bool
// This flag, if set, enables a check prior to mount operations to verify that the required components
// (binaries, etc.) to mount the volume are available on the underlying node. If the check is enabled
// and fails the mount operation fails.
ExperimentalCheckNodeCapabilitiesBeforeMount bool
// This flag, if set, instructs the kubelet to keep volumes from terminated pods mounted to the node.
// This can be useful for debugging volume related issues.
KeepTerminatedPodVolumes bool
/* following flags are meant for Node Allocatable */ /* following flags are meant for Node Allocatable */
...@@ -316,6 +362,9 @@ type KubeletConfiguration struct { ...@@ -316,6 +362,9 @@ type KubeletConfiguration struct {
// This flag accepts a list of options. Acceptable options are `pods`, `system-reserved` & `kube-reserved`. // This flag accepts a list of options. Acceptable options are `pods`, `system-reserved` & `kube-reserved`.
// Refer to [Node Allocatable](https://git.k8s.io/community/contributors/design-proposals/node-allocatable.md) doc for more information. // Refer to [Node Allocatable](https://git.k8s.io/community/contributors/design-proposals/node-allocatable.md) doc for more information.
EnforceNodeAllocatable []string EnforceNodeAllocatable []string
// This flag, if set, will avoid including `EvictionHard` limits while computing Node Allocatable.
// Refer to [Node Allocatable](https://git.k8s.io/community/contributors/design-proposals/node-allocatable.md) doc for more information.
ExperimentalNodeAllocatableIgnoreEvictionThreshold bool
} }
type KubeletAuthorizationMode string type KubeletAuthorizationMode string
......
...@@ -18,6 +18,7 @@ package v1alpha1 ...@@ -18,6 +18,7 @@ package v1alpha1
import ( import (
"path/filepath" "path/filepath"
"runtime"
"time" "time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
...@@ -142,12 +143,28 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) { ...@@ -142,12 +143,28 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
temp := int32(80) temp := int32(80)
obj.ImageGCLowThresholdPercent = &temp obj.ImageGCLowThresholdPercent = &temp
} }
if obj.MasterServiceNamespace == "" {
obj.MasterServiceNamespace = metav1.NamespaceDefault
}
if obj.MaxContainerCount == nil {
temp := int32(-1)
obj.MaxContainerCount = &temp
}
if obj.MaxPerPodContainerCount == 0 {
obj.MaxPerPodContainerCount = 1
}
if obj.MaxOpenFiles == 0 { if obj.MaxOpenFiles == 0 {
obj.MaxOpenFiles = 1000000 obj.MaxOpenFiles = 1000000
} }
if obj.MaxPods == 0 { if obj.MaxPods == 0 {
obj.MaxPods = 110 obj.MaxPods = 110
} }
if obj.MinimumGCAge == zeroDuration {
obj.MinimumGCAge = metav1.Duration{Duration: 0}
}
if obj.NonMasqueradeCIDR == "" {
obj.NonMasqueradeCIDR = "10.0.0.0/8"
}
if obj.VolumePluginDir == "" { if obj.VolumePluginDir == "" {
obj.VolumePluginDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/" obj.VolumePluginDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/"
} }
...@@ -167,6 +184,9 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) { ...@@ -167,6 +184,9 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
if obj.RegisterNode == nil { if obj.RegisterNode == nil {
obj.RegisterNode = boolVar(true) obj.RegisterNode = boolVar(true)
} }
if obj.RegisterSchedulable == nil {
obj.RegisterSchedulable = boolVar(true)
}
if obj.RegistryBurst == 0 { if obj.RegistryBurst == 0 {
obj.RegistryBurst = 10 obj.RegistryBurst = 10
} }
...@@ -209,12 +229,18 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) { ...@@ -209,12 +229,18 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
if obj.EvictionPressureTransitionPeriod == zeroDuration { if obj.EvictionPressureTransitionPeriod == zeroDuration {
obj.EvictionPressureTransitionPeriod = metav1.Duration{Duration: 5 * time.Minute} obj.EvictionPressureTransitionPeriod = metav1.Duration{Duration: 5 * time.Minute}
} }
if obj.ExperimentalKernelMemcgNotification == nil {
obj.ExperimentalKernelMemcgNotification = boolVar(false)
}
if obj.SystemReserved == nil { if obj.SystemReserved == nil {
obj.SystemReserved = make(map[string]string) obj.SystemReserved = make(map[string]string)
} }
if obj.KubeReserved == nil { if obj.KubeReserved == nil {
obj.KubeReserved = make(map[string]string) obj.KubeReserved = make(map[string]string)
} }
if obj.ExperimentalQOSReserved == nil {
obj.ExperimentalQOSReserved = make(map[string]string)
}
if obj.MakeIPTablesUtilChains == nil { if obj.MakeIPTablesUtilChains == nil {
obj.MakeIPTablesUtilChains = boolVar(true) obj.MakeIPTablesUtilChains = boolVar(true)
} }
...@@ -236,6 +262,13 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) { ...@@ -236,6 +262,13 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
if obj.EnforceNodeAllocatable == nil { if obj.EnforceNodeAllocatable == nil {
obj.EnforceNodeAllocatable = defaultNodeAllocatableEnforcement obj.EnforceNodeAllocatable = defaultNodeAllocatableEnforcement
} }
if obj.RemoteRuntimeEndpoint == "" {
if runtime.GOOS == "linux" {
obj.RemoteRuntimeEndpoint = "unix:///var/run/dockershim.sock"
} else if runtime.GOOS == "windows" {
obj.RemoteRuntimeEndpoint = "tcp://localhost:3735"
}
}
} }
func boolVar(b bool) *bool { func boolVar(b bool) *bool {
......
...@@ -41,8 +41,10 @@ const ( ...@@ -41,8 +41,10 @@ const (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// A configuration field should go in KubeletFlags instead of KubeletConfiguration if // A configuration field should go in KubeletFlags instead of KubeletConfiguration if any of these are true:
// its value cannot be safely shared between nodes at the same time (e.g. a hostname) // - its value will never, or cannot safely be changed during the lifetime of a node
// - its value cannot be safely shared between nodes at the same time (e.g. a hostname)
// KubeletConfiguration is intended to be shared between nodes
// In general, please try to avoid adding flags or configuration fields, // In general, please try to avoid adding flags or configuration fields,
// we already have a confusingly large amount of them. // we already have a confusingly large amount of them.
type KubeletConfiguration struct { type KubeletConfiguration struct {
...@@ -124,6 +126,15 @@ type KubeletConfiguration struct { ...@@ -124,6 +126,15 @@ type KubeletConfiguration struct {
EnableDebuggingHandlers *bool `json:"enableDebuggingHandlers"` EnableDebuggingHandlers *bool `json:"enableDebuggingHandlers"`
// enableContentionProfiling enables lock contention profiling, if enableDebuggingHandlers is true. // enableContentionProfiling enables lock contention profiling, if enableDebuggingHandlers is true.
EnableContentionProfiling bool `json:"enableContentionProfiling"` EnableContentionProfiling bool `json:"enableContentionProfiling"`
// minimumGCAge is the minimum age for a finished container before it is
// garbage collected.
MinimumGCAge metav1.Duration `json:"minimumGCAge"`
// maxPerPodContainerCount is the maximum number of old instances to
// retain per container. Each container takes up some disk space.
MaxPerPodContainerCount int32 `json:"maxPerPodContainerCount"`
// maxContainerCount is the maximum number of old instances of containers
// to retain globally. Each container takes up some disk space.
MaxContainerCount *int32 `json:"maxContainerCount"`
// cAdvisorPort is the port of the localhost cAdvisor endpoint (set to 0 to disable) // cAdvisorPort is the port of the localhost cAdvisor endpoint (set to 0 to disable)
CAdvisorPort *int32 `json:"cAdvisorPort"` CAdvisorPort *int32 `json:"cAdvisorPort"`
// healthzPort is the port of the localhost healthz endpoint (set to 0 to disable) // healthzPort is the port of the localhost healthz endpoint (set to 0 to disable)
...@@ -140,6 +151,9 @@ type KubeletConfiguration struct { ...@@ -140,6 +151,9 @@ type KubeletConfiguration struct {
// 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.
ClusterDomain string `json:"clusterDomain"` ClusterDomain string `json:"clusterDomain"`
// masterServiceNamespace is The namespace from which the kubernetes
// master services should be injected into pods.
MasterServiceNamespace string `json:"masterServiceNamespace"`
// clusterDNS is a list of IP address for the cluster DNS server. If set, // clusterDNS is a list of IP address for the cluster DNS server. If set,
// kubelet will configure all containers to use this for DNS resolution // kubelet will configure all containers to use this for DNS resolution
// instead of the host's DNS servers // instead of the host's DNS servers
...@@ -188,9 +202,16 @@ type KubeletConfiguration struct { ...@@ -188,9 +202,16 @@ type KubeletConfiguration struct {
CgroupDriver string `json:"cgroupDriver,omitempty"` CgroupDriver string `json:"cgroupDriver,omitempty"`
// containerRuntime is the container runtime to use. // containerRuntime is the container runtime to use.
ContainerRuntime string `json:"containerRuntime"` ContainerRuntime string `json:"containerRuntime"`
// remoteRuntimeEndpoint is the endpoint of remote runtime service
RemoteRuntimeEndpoint string `json:"remoteRuntimeEndpoint"`
// remoteImageEndpoint is the endpoint of remote image service
RemoteImageEndpoint string `json:"remoteImageEndpoint"`
// 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"`
// experimentalMounterPath is the path to mounter binary. If not set, kubelet will attempt to use mount
// binary that is available via $PATH,
ExperimentalMounterPath string `json:"experimentalMounterPath,omitempty"`
// lockFilePath is the path that kubelet will use to as a lock file. // 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 // It uses this file as a lock to synchronize with other kubelet processes
// that may be running. // that may be running.
...@@ -220,8 +241,14 @@ type KubeletConfiguration struct { ...@@ -220,8 +241,14 @@ type KubeletConfiguration struct {
// cpuCFSQuota is Enable CPU CFS quota enforcement for containers that // cpuCFSQuota is Enable CPU CFS quota enforcement for containers that
// specify CPU limits // specify CPU limits
CPUCFSQuota *bool `json:"cpuCFSQuota"` CPUCFSQuota *bool `json:"cpuCFSQuota"`
// containerized should be set to true if kubelet is running in a container.
Containerized *bool `json:"containerized"`
// 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"`
// registerSchedulable tells the kubelet to register the node as
// schedulable. Won't have any effect if register-node is false.
// DEPRECATED: use registerWithTaints instead
RegisterSchedulable *bool `json:"registerSchedulable"`
// registerWithTaints are an array of taints to add to a node object when // registerWithTaints are an array of taints to add to a node object when
// the kubelet registers itself. This only takes effect when registerNode // the kubelet registers itself. This only takes effect when registerNode
// is true and upon the initial registration of the node. // is true and upon the initial registration of the node.
...@@ -240,6 +267,8 @@ type KubeletConfiguration struct { ...@@ -240,6 +267,8 @@ type KubeletConfiguration struct {
SerializeImagePulls *bool `json:"serializeImagePulls"` SerializeImagePulls *bool `json:"serializeImagePulls"`
// nodeLabels to add when registering the node in the cluster. // nodeLabels to add when registering the node in the cluster.
NodeLabels map[string]string `json:"nodeLabels"` NodeLabels map[string]string `json:"nodeLabels"`
// nonMasqueradeCIDR configures masquerading: traffic to IPs outside this range will use IP masquerade.
NonMasqueradeCIDR string `json:"nonMasqueradeCIDR"`
// enable gathering custom metrics. // enable gathering custom metrics.
EnableCustomMetrics bool `json:"enableCustomMetrics"` EnableCustomMetrics bool `json:"enableCustomMetrics"`
// Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'. // Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'.
...@@ -254,12 +283,18 @@ type KubeletConfiguration struct { ...@@ -254,12 +283,18 @@ type KubeletConfiguration struct {
EvictionMaxPodGracePeriod int32 `json:"evictionMaxPodGracePeriod"` EvictionMaxPodGracePeriod int32 `json:"evictionMaxPodGracePeriod"`
// Comma-delimited list of minimum reclaims (e.g. imagefs.available=2Gi) that describes the minimum amount of resource the kubelet will reclaim when performing a pod eviction if that resource is under pressure. // Comma-delimited list of minimum reclaims (e.g. imagefs.available=2Gi) that describes the minimum amount of resource the kubelet will reclaim when performing a pod eviction if that resource is under pressure.
EvictionMinimumReclaim string `json:"evictionMinimumReclaim"` EvictionMinimumReclaim string `json:"evictionMinimumReclaim"`
// If enabled, the kubelet will integrate with the kernel memcg notification to determine if memory eviction thresholds are crossed rather than polling.
ExperimentalKernelMemcgNotification *bool `json:"experimentalKernelMemcgNotification"`
// Maximum number of pods per core. Cannot exceed MaxPods // Maximum number of pods per core. Cannot exceed MaxPods
PodsPerCore int32 `json:"podsPerCore"` PodsPerCore int32 `json:"podsPerCore"`
// enableControllerAttachDetach enables the Attach/Detach controller to // enableControllerAttachDetach enables the Attach/Detach controller to
// manage attachment/detachment of volumes scheduled to this node, and // manage attachment/detachment of volumes scheduled to this node, and
// disables kubelet from executing any attach/detach operations // disables kubelet from executing any attach/detach operations
EnableControllerAttachDetach *bool `json:"enableControllerAttachDetach"` EnableControllerAttachDetach *bool `json:"enableControllerAttachDetach"`
// 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]"
ExperimentalQOSReserved map[string]string `json:"experimentalQOSReserved"`
// Default behaviour for kernel tuning // Default behaviour for kernel tuning
ProtectKernelDefaults bool `json:"protectKernelDefaults"` ProtectKernelDefaults bool `json:"protectKernelDefaults"`
// If true, Kubelet ensures a set of iptables rules are present on host. // If true, Kubelet ensures a set of iptables rules are present on host.
...@@ -274,11 +309,22 @@ type KubeletConfiguration struct { ...@@ -274,11 +309,22 @@ type KubeletConfiguration struct {
// iptablesDropBit is the bit of the iptables fwmark space to mark for dropping packets. // iptablesDropBit is the bit of the iptables fwmark space to mark for dropping packets.
// Values must be within the range [0, 31]. Must be different from other mark bits. // Values must be within the range [0, 31]. Must be different from other mark bits.
IPTablesDropBit *int32 `json:"iptablesDropBit"` IPTablesDropBit *int32 `json:"iptablesDropBit"`
// Whitelist of unsafe sysctls or sysctl patterns (ending in *). Use these at your own risk.
// Resource isolation might be lacking and pod might influence each other on the same node.
// +optional
AllowedUnsafeSysctls []string `json:"allowedUnsafeSysctls,omitempty"`
// featureGates is a string of comma-separated key=value pairs that describe feature // featureGates is a string of comma-separated key=value pairs that describe feature
// gates for alpha/experimental features. // gates for alpha/experimental features.
FeatureGates string `json:"featureGates,omitempty"` FeatureGates string `json:"featureGates,omitempty"`
// Tells the Kubelet to fail to start if swap is enabled on the node. // Tells the Kubelet to fail to start if swap is enabled on the node.
FailSwapOn bool `json:"failSwapOn,omitempty"` FailSwapOn bool `json:"failSwapOn,omitempty"`
// This flag, if set, enables a check prior to mount operations to verify that the required components
// (binaries, etc.) to mount the volume are available on the underlying node. If the check is enabled
// and fails the mount operation fails.
ExperimentalCheckNodeCapabilitiesBeforeMount bool `json:"experimentalCheckNodeCapabilitiesBeforeMount,omitempty"`
// This flag, if set, instructs the kubelet to keep volumes from terminated pods mounted to the node.
// This can be useful for debugging volume related issues.
KeepTerminatedPodVolumes bool `json:"keepTerminatedPodVolumes,omitempty"`
/* following flags are meant for Node Allocatable */ /* following flags are meant for Node Allocatable */
...@@ -303,6 +349,9 @@ type KubeletConfiguration struct { ...@@ -303,6 +349,9 @@ type KubeletConfiguration struct {
// This flag accepts a list of options. Acceptible options are `pods`, `system-reserved` & `kube-reserved`. // This flag accepts a list of options. Acceptible options are `pods`, `system-reserved` & `kube-reserved`.
// Refer to [Node Allocatable](https://git.k8s.io/community/contributors/design-proposals/node-allocatable.md) doc for more information. // Refer to [Node Allocatable](https://git.k8s.io/community/contributors/design-proposals/node-allocatable.md) doc for more information.
EnforceNodeAllocatable []string `json:"enforceNodeAllocatable"` EnforceNodeAllocatable []string `json:"enforceNodeAllocatable"`
// This flag, if set, will avoid including `EvictionHard` limits while computing Node Allocatable.
// Refer to [Node Allocatable](https://git.k8s.io/community/contributors/design-proposals/node-allocatable.md) doc for more information.
ExperimentalNodeAllocatableIgnoreEvictionThreshold bool `json:"experimentalNodeAllocatableIgnoreEvictionThreshold,omitempty"`
} }
type KubeletAuthorizationMode string type KubeletAuthorizationMode string
......
...@@ -184,6 +184,11 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura ...@@ -184,6 +184,11 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
return err return err
} }
out.EnableContentionProfiling = in.EnableContentionProfiling out.EnableContentionProfiling = in.EnableContentionProfiling
out.MinimumGCAge = in.MinimumGCAge
out.MaxPerPodContainerCount = in.MaxPerPodContainerCount
if err := v1.Convert_Pointer_int32_To_int32(&in.MaxContainerCount, &out.MaxContainerCount, s); err != nil {
return err
}
if err := v1.Convert_Pointer_int32_To_int32(&in.CAdvisorPort, &out.CAdvisorPort, s); err != nil { if err := v1.Convert_Pointer_int32_To_int32(&in.CAdvisorPort, &out.CAdvisorPort, s); err != nil {
return err return err
} }
...@@ -198,6 +203,7 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura ...@@ -198,6 +203,7 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
return err return err
} }
out.ClusterDomain = in.ClusterDomain out.ClusterDomain = in.ClusterDomain
out.MasterServiceNamespace = in.MasterServiceNamespace
out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS)) out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS))
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency
...@@ -219,7 +225,10 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura ...@@ -219,7 +225,10 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
} }
out.CgroupDriver = in.CgroupDriver out.CgroupDriver = in.CgroupDriver
out.ContainerRuntime = in.ContainerRuntime out.ContainerRuntime = in.ContainerRuntime
out.RemoteRuntimeEndpoint = in.RemoteRuntimeEndpoint
out.RemoteImageEndpoint = in.RemoteImageEndpoint
out.RuntimeRequestTimeout = in.RuntimeRequestTimeout out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
out.ExperimentalMounterPath = in.ExperimentalMounterPath
if err := v1.Convert_Pointer_string_To_string(&in.LockFilePath, &out.LockFilePath, s); err != nil { if err := v1.Convert_Pointer_string_To_string(&in.LockFilePath, &out.LockFilePath, s); err != nil {
return err return err
} }
...@@ -231,7 +240,13 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura ...@@ -231,7 +240,13 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
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
} }
if err := v1.Convert_Pointer_bool_To_bool(&in.Containerized, &out.Containerized, s); err != nil {
return err
}
out.MaxOpenFiles = in.MaxOpenFiles out.MaxOpenFiles = in.MaxOpenFiles
if err := v1.Convert_Pointer_bool_To_bool(&in.RegisterSchedulable, &out.RegisterSchedulable, s); err != nil {
return err
}
out.RegisterWithTaints = *(*[]api.Taint)(unsafe.Pointer(&in.RegisterWithTaints)) out.RegisterWithTaints = *(*[]api.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 {
...@@ -242,6 +257,7 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura ...@@ -242,6 +257,7 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
return err return err
} }
out.NodeLabels = *(*map[string]string)(unsafe.Pointer(&in.NodeLabels)) out.NodeLabels = *(*map[string]string)(unsafe.Pointer(&in.NodeLabels))
out.NonMasqueradeCIDR = in.NonMasqueradeCIDR
out.EnableCustomMetrics = in.EnableCustomMetrics out.EnableCustomMetrics = in.EnableCustomMetrics
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
...@@ -251,10 +267,14 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura ...@@ -251,10 +267,14 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod
out.EvictionMaxPodGracePeriod = in.EvictionMaxPodGracePeriod out.EvictionMaxPodGracePeriod = in.EvictionMaxPodGracePeriod
out.EvictionMinimumReclaim = in.EvictionMinimumReclaim out.EvictionMinimumReclaim = in.EvictionMinimumReclaim
if err := v1.Convert_Pointer_bool_To_bool(&in.ExperimentalKernelMemcgNotification, &out.ExperimentalKernelMemcgNotification, s); err != nil {
return err
}
out.PodsPerCore = in.PodsPerCore out.PodsPerCore = in.PodsPerCore
if err := v1.Convert_Pointer_bool_To_bool(&in.EnableControllerAttachDetach, &out.EnableControllerAttachDetach, s); err != nil { if err := v1.Convert_Pointer_bool_To_bool(&in.EnableControllerAttachDetach, &out.EnableControllerAttachDetach, s); err != nil {
return err return err
} }
out.ExperimentalQOSReserved = *(*kubeletconfig.ConfigurationMap)(unsafe.Pointer(&in.ExperimentalQOSReserved))
out.ProtectKernelDefaults = in.ProtectKernelDefaults out.ProtectKernelDefaults = in.ProtectKernelDefaults
if err := v1.Convert_Pointer_bool_To_bool(&in.MakeIPTablesUtilChains, &out.MakeIPTablesUtilChains, s); err != nil { if err := v1.Convert_Pointer_bool_To_bool(&in.MakeIPTablesUtilChains, &out.MakeIPTablesUtilChains, s); err != nil {
return err return err
...@@ -265,13 +285,17 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura ...@@ -265,13 +285,17 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
if err := v1.Convert_Pointer_int32_To_int32(&in.IPTablesDropBit, &out.IPTablesDropBit, s); err != nil { if err := v1.Convert_Pointer_int32_To_int32(&in.IPTablesDropBit, &out.IPTablesDropBit, s); err != nil {
return err return err
} }
out.AllowedUnsafeSysctls = *(*[]string)(unsafe.Pointer(&in.AllowedUnsafeSysctls))
out.FeatureGates = in.FeatureGates out.FeatureGates = in.FeatureGates
out.FailSwapOn = in.FailSwapOn out.FailSwapOn = in.FailSwapOn
out.ExperimentalCheckNodeCapabilitiesBeforeMount = in.ExperimentalCheckNodeCapabilitiesBeforeMount
out.KeepTerminatedPodVolumes = in.KeepTerminatedPodVolumes
out.SystemReserved = *(*kubeletconfig.ConfigurationMap)(unsafe.Pointer(&in.SystemReserved)) out.SystemReserved = *(*kubeletconfig.ConfigurationMap)(unsafe.Pointer(&in.SystemReserved))
out.KubeReserved = *(*kubeletconfig.ConfigurationMap)(unsafe.Pointer(&in.KubeReserved)) out.KubeReserved = *(*kubeletconfig.ConfigurationMap)(unsafe.Pointer(&in.KubeReserved))
out.SystemReservedCgroup = in.SystemReservedCgroup out.SystemReservedCgroup = in.SystemReservedCgroup
out.KubeReservedCgroup = in.KubeReservedCgroup out.KubeReservedCgroup = in.KubeReservedCgroup
out.EnforceNodeAllocatable = *(*[]string)(unsafe.Pointer(&in.EnforceNodeAllocatable)) out.EnforceNodeAllocatable = *(*[]string)(unsafe.Pointer(&in.EnforceNodeAllocatable))
out.ExperimentalNodeAllocatableIgnoreEvictionThreshold = in.ExperimentalNodeAllocatableIgnoreEvictionThreshold
return nil return nil
} }
...@@ -323,6 +347,11 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura ...@@ -323,6 +347,11 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
return err return err
} }
out.EnableContentionProfiling = in.EnableContentionProfiling out.EnableContentionProfiling = in.EnableContentionProfiling
out.MinimumGCAge = in.MinimumGCAge
out.MaxPerPodContainerCount = in.MaxPerPodContainerCount
if err := v1.Convert_int32_To_Pointer_int32(&in.MaxContainerCount, &out.MaxContainerCount, s); err != nil {
return err
}
if err := v1.Convert_int32_To_Pointer_int32(&in.CAdvisorPort, &out.CAdvisorPort, s); err != nil { if err := v1.Convert_int32_To_Pointer_int32(&in.CAdvisorPort, &out.CAdvisorPort, s); err != nil {
return err return err
} }
...@@ -337,6 +366,7 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura ...@@ -337,6 +366,7 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
return err return err
} }
out.ClusterDomain = in.ClusterDomain out.ClusterDomain = in.ClusterDomain
out.MasterServiceNamespace = in.MasterServiceNamespace
out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS)) out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS))
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency
...@@ -358,7 +388,10 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura ...@@ -358,7 +388,10 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
out.SystemCgroups = in.SystemCgroups out.SystemCgroups = in.SystemCgroups
out.CgroupRoot = in.CgroupRoot out.CgroupRoot = in.CgroupRoot
out.ContainerRuntime = in.ContainerRuntime out.ContainerRuntime = in.ContainerRuntime
out.RemoteRuntimeEndpoint = in.RemoteRuntimeEndpoint
out.RemoteImageEndpoint = in.RemoteImageEndpoint
out.RuntimeRequestTimeout = in.RuntimeRequestTimeout out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
out.ExperimentalMounterPath = in.ExperimentalMounterPath
if err := v1.Convert_string_To_Pointer_string(&in.LockFilePath, &out.LockFilePath, s); err != nil { if err := v1.Convert_string_To_Pointer_string(&in.LockFilePath, &out.LockFilePath, s); err != nil {
return err return err
} }
...@@ -370,7 +403,13 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura ...@@ -370,7 +403,13 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
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
} }
if err := v1.Convert_bool_To_Pointer_bool(&in.Containerized, &out.Containerized, s); err != nil {
return err
}
out.MaxOpenFiles = in.MaxOpenFiles out.MaxOpenFiles = in.MaxOpenFiles
if err := v1.Convert_bool_To_Pointer_bool(&in.RegisterSchedulable, &out.RegisterSchedulable, s); err != nil {
return err
}
out.RegisterWithTaints = *(*[]core_v1.Taint)(unsafe.Pointer(&in.RegisterWithTaints)) 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 {
...@@ -381,6 +420,7 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura ...@@ -381,6 +420,7 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
return err return err
} }
out.NodeLabels = *(*map[string]string)(unsafe.Pointer(&in.NodeLabels)) out.NodeLabels = *(*map[string]string)(unsafe.Pointer(&in.NodeLabels))
out.NonMasqueradeCIDR = in.NonMasqueradeCIDR
out.EnableCustomMetrics = in.EnableCustomMetrics out.EnableCustomMetrics = in.EnableCustomMetrics
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
...@@ -390,10 +430,14 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura ...@@ -390,10 +430,14 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod
out.EvictionMaxPodGracePeriod = in.EvictionMaxPodGracePeriod out.EvictionMaxPodGracePeriod = in.EvictionMaxPodGracePeriod
out.EvictionMinimumReclaim = in.EvictionMinimumReclaim out.EvictionMinimumReclaim = in.EvictionMinimumReclaim
if err := v1.Convert_bool_To_Pointer_bool(&in.ExperimentalKernelMemcgNotification, &out.ExperimentalKernelMemcgNotification, s); err != nil {
return err
}
out.PodsPerCore = in.PodsPerCore out.PodsPerCore = in.PodsPerCore
if err := v1.Convert_bool_To_Pointer_bool(&in.EnableControllerAttachDetach, &out.EnableControllerAttachDetach, s); err != nil { if err := v1.Convert_bool_To_Pointer_bool(&in.EnableControllerAttachDetach, &out.EnableControllerAttachDetach, s); err != nil {
return err return err
} }
out.ExperimentalQOSReserved = *(*map[string]string)(unsafe.Pointer(&in.ExperimentalQOSReserved))
out.ProtectKernelDefaults = in.ProtectKernelDefaults out.ProtectKernelDefaults = in.ProtectKernelDefaults
if err := v1.Convert_bool_To_Pointer_bool(&in.MakeIPTablesUtilChains, &out.MakeIPTablesUtilChains, s); err != nil { if err := v1.Convert_bool_To_Pointer_bool(&in.MakeIPTablesUtilChains, &out.MakeIPTablesUtilChains, s); err != nil {
return err return err
...@@ -404,13 +448,17 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura ...@@ -404,13 +448,17 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
if err := v1.Convert_int32_To_Pointer_int32(&in.IPTablesDropBit, &out.IPTablesDropBit, s); err != nil { if err := v1.Convert_int32_To_Pointer_int32(&in.IPTablesDropBit, &out.IPTablesDropBit, s); err != nil {
return err return err
} }
out.AllowedUnsafeSysctls = *(*[]string)(unsafe.Pointer(&in.AllowedUnsafeSysctls))
out.FeatureGates = in.FeatureGates out.FeatureGates = in.FeatureGates
out.FailSwapOn = in.FailSwapOn out.FailSwapOn = in.FailSwapOn
out.ExperimentalCheckNodeCapabilitiesBeforeMount = in.ExperimentalCheckNodeCapabilitiesBeforeMount
out.KeepTerminatedPodVolumes = in.KeepTerminatedPodVolumes
out.SystemReserved = *(*map[string]string)(unsafe.Pointer(&in.SystemReserved)) out.SystemReserved = *(*map[string]string)(unsafe.Pointer(&in.SystemReserved))
out.KubeReserved = *(*map[string]string)(unsafe.Pointer(&in.KubeReserved)) out.KubeReserved = *(*map[string]string)(unsafe.Pointer(&in.KubeReserved))
out.SystemReservedCgroup = in.SystemReservedCgroup out.SystemReservedCgroup = in.SystemReservedCgroup
out.KubeReservedCgroup = in.KubeReservedCgroup out.KubeReservedCgroup = in.KubeReservedCgroup
out.EnforceNodeAllocatable = *(*[]string)(unsafe.Pointer(&in.EnforceNodeAllocatable)) out.EnforceNodeAllocatable = *(*[]string)(unsafe.Pointer(&in.EnforceNodeAllocatable))
out.ExperimentalNodeAllocatableIgnoreEvictionThreshold = in.ExperimentalNodeAllocatableIgnoreEvictionThreshold
return nil return nil
} }
......
...@@ -217,6 +217,16 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) { ...@@ -217,6 +217,16 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
**out = **in **out = **in
} }
} }
out.MinimumGCAge = in.MinimumGCAge
if in.MaxContainerCount != nil {
in, out := &in.MaxContainerCount, &out.MaxContainerCount
if *in == nil {
*out = nil
} else {
*out = new(int32)
**out = **in
}
}
if in.CAdvisorPort != nil { if in.CAdvisorPort != nil {
in, out := &in.CAdvisorPort, &out.CAdvisorPort in, out := &in.CAdvisorPort, &out.CAdvisorPort
if *in == nil { if *in == nil {
...@@ -308,6 +318,24 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) { ...@@ -308,6 +318,24 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
**out = **in **out = **in
} }
} }
if in.Containerized != nil {
in, out := &in.Containerized, &out.Containerized
if *in == nil {
*out = nil
} else {
*out = new(bool)
**out = **in
}
}
if in.RegisterSchedulable != nil {
in, out := &in.RegisterSchedulable, &out.RegisterSchedulable
if *in == nil {
*out = nil
} else {
*out = new(bool)
**out = **in
}
}
if in.RegisterWithTaints != nil { if in.RegisterWithTaints != nil {
in, out := &in.RegisterWithTaints, &out.RegisterWithTaints in, out := &in.RegisterWithTaints, &out.RegisterWithTaints
*out = make([]core_v1.Taint, len(*in)) *out = make([]core_v1.Taint, len(*in))
...@@ -350,6 +378,15 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) { ...@@ -350,6 +378,15 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
} }
} }
out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod
if in.ExperimentalKernelMemcgNotification != nil {
in, out := &in.ExperimentalKernelMemcgNotification, &out.ExperimentalKernelMemcgNotification
if *in == nil {
*out = nil
} else {
*out = new(bool)
**out = **in
}
}
if in.EnableControllerAttachDetach != nil { if in.EnableControllerAttachDetach != nil {
in, out := &in.EnableControllerAttachDetach, &out.EnableControllerAttachDetach in, out := &in.EnableControllerAttachDetach, &out.EnableControllerAttachDetach
if *in == nil { if *in == nil {
...@@ -359,6 +396,13 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) { ...@@ -359,6 +396,13 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
**out = **in **out = **in
} }
} }
if in.ExperimentalQOSReserved != nil {
in, out := &in.ExperimentalQOSReserved, &out.ExperimentalQOSReserved
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.MakeIPTablesUtilChains != nil { if in.MakeIPTablesUtilChains != nil {
in, out := &in.MakeIPTablesUtilChains, &out.MakeIPTablesUtilChains in, out := &in.MakeIPTablesUtilChains, &out.MakeIPTablesUtilChains
if *in == nil { if *in == nil {
...@@ -386,6 +430,11 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) { ...@@ -386,6 +430,11 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
**out = **in **out = **in
} }
} }
if in.AllowedUnsafeSysctls != nil {
in, out := &in.AllowedUnsafeSysctls, &out.AllowedUnsafeSysctls
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.SystemReserved != nil { if in.SystemReserved != nil {
in, out := &in.SystemReserved, &out.SystemReserved in, out := &in.SystemReserved, &out.SystemReserved
*out = make(map[string]string, len(*in)) *out = make(map[string]string, len(*in))
......
...@@ -154,6 +154,7 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) { ...@@ -154,6 +154,7 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
*out = make([]string, len(*in)) *out = make([]string, len(*in))
copy(*out, *in) copy(*out, *in)
} }
out.MinimumGCAge = in.MinimumGCAge
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))
...@@ -179,6 +180,18 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) { ...@@ -179,6 +180,18 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
} }
} }
out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod
if in.ExperimentalQOSReserved != nil {
in, out := &in.ExperimentalQOSReserved, &out.ExperimentalQOSReserved
*out = make(ConfigurationMap, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.AllowedUnsafeSysctls != nil {
in, out := &in.AllowedUnsafeSysctls, &out.AllowedUnsafeSysctls
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.SystemReserved != nil { if in.SystemReserved != nil {
in, out := &in.SystemReserved, &out.SystemReserved in, out := &in.SystemReserved, &out.SystemReserved
*out = make(ConfigurationMap, len(*in)) *out = make(ConfigurationMap, len(*in))
......
...@@ -279,7 +279,7 @@ func (kl *Kubelet) initialNode() (*v1.Node, error) { ...@@ -279,7 +279,7 @@ func (kl *Kubelet) initialNode() (*v1.Node, error) {
glog.Infof("Controller attach/detach is disabled for this node; Kubelet will attach and detach volumes") glog.Infof("Controller attach/detach is disabled for this node; Kubelet will attach and detach volumes")
} }
if kl.keepTerminatedPodVolumes { if kl.kubeletConfiguration.KeepTerminatedPodVolumes {
if node.Annotations == nil { if node.Annotations == nil {
node.Annotations = make(map[string]string) node.Annotations = make(map[string]string)
} }
......
...@@ -788,7 +788,7 @@ func (kl *Kubelet) PodResourcesAreReclaimed(pod *v1.Pod, status v1.PodStatus) bo ...@@ -788,7 +788,7 @@ func (kl *Kubelet) PodResourcesAreReclaimed(pod *v1.Pod, status v1.PodStatus) bo
glog.V(3).Infof("Pod %q is terminated, but some containers are still running", format.Pod(pod)) glog.V(3).Infof("Pod %q is terminated, but some containers are still running", format.Pod(pod))
return false return false
} }
if kl.podVolumesExist(pod.UID) && !kl.keepTerminatedPodVolumes { if kl.podVolumesExist(pod.UID) && !kl.kubeletConfiguration.KeepTerminatedPodVolumes {
// We shouldnt delete pods whose volumes have not been cleaned up if we are not keeping terminated pod volumes // We shouldnt delete pods whose volumes have not been cleaned up if we are not keeping terminated pod volumes
glog.V(3).Infof("Pod %q is terminated, but some volumes have not been cleaned up", format.Pod(pod)) glog.V(3).Infof("Pod %q is terminated, but some volumes have not been cleaned up", format.Pod(pod))
return false return false
...@@ -1621,7 +1621,7 @@ func (kl *Kubelet) cleanupOrphanedPodCgroups(cgroupPods map[types.UID]cm.CgroupN ...@@ -1621,7 +1621,7 @@ func (kl *Kubelet) cleanupOrphanedPodCgroups(cgroupPods map[types.UID]cm.CgroupN
// parent croup. If the volumes still exist, reduce the cpu shares for any // parent croup. If the volumes still exist, reduce the cpu shares for any
// process in the cgroup to the minimum value while we wait. if the kubelet // process in the cgroup to the minimum value while we wait. if the kubelet
// is configured to keep terminated volumes, we will delete the cgroup and not block. // is configured to keep terminated volumes, we will delete the cgroup and not block.
if podVolumesExist := kl.podVolumesExist(uid); podVolumesExist && !kl.keepTerminatedPodVolumes { if podVolumesExist := kl.podVolumesExist(uid); podVolumesExist && !kl.kubeletConfiguration.KeepTerminatedPodVolumes {
glog.V(3).Infof("Orphaned pod %q found, but volumes not yet removed. Reducing cpu to minimum", uid) glog.V(3).Infof("Orphaned pod %q found, but volumes not yet removed. Reducing cpu to minimum", uid)
if err := pcm.ReduceCPULimits(val); err != nil { if err := pcm.ReduceCPULimits(val); err != nil {
glog.Warningf("Failed to reduce cpu time for pod %q pending volume cleanup due to %v", uid, err) glog.Warningf("Failed to reduce cpu time for pod %q pending volume cleanup due to %v", uid, err)
......
...@@ -69,7 +69,7 @@ func (kl *Kubelet) newVolumeMounterFromPlugins(spec *volume.Spec, pod *v1.Pod, o ...@@ -69,7 +69,7 @@ func (kl *Kubelet) newVolumeMounterFromPlugins(spec *volume.Spec, pod *v1.Pod, o
if err != nil { if err != nil {
return nil, fmt.Errorf("can't use volume plugins for %s: %v", spec.Name(), err) return nil, fmt.Errorf("can't use volume plugins for %s: %v", spec.Name(), err)
} }
opts.Containerized = kl.containerized opts.Containerized = kl.kubeletConfiguration.Containerized
physicalMounter, err := plugin.NewMounter(spec, pod, opts) physicalMounter, err := plugin.NewMounter(spec, pod, opts)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to instantiate mounter for volume: %s using plugin: %s with a root cause: %v", spec.Name(), plugin.GetPluginName(), err) return nil, fmt.Errorf("failed to instantiate mounter for volume: %s using plugin: %s with a root cause: %v", spec.Name(), plugin.GetPluginName(), err)
......
...@@ -19,7 +19,6 @@ package kubemark ...@@ -19,7 +19,6 @@ package kubemark
import ( import (
"time" "time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientset "k8s.io/client-go/kubernetes" clientset "k8s.io/client-go/kubernetes"
kubeletapp "k8s.io/kubernetes/cmd/kubelet/app" kubeletapp "k8s.io/kubernetes/cmd/kubelet/app"
"k8s.io/kubernetes/cmd/kubelet/app/options" "k8s.io/kubernetes/cmd/kubelet/app/options"
...@@ -115,10 +114,6 @@ func GetHollowKubeletConfig( ...@@ -115,10 +114,6 @@ func GetHollowKubeletConfig(
CloudProvider: kubeletv1alpha1.AutoDetectCloudProvider, CloudProvider: kubeletv1alpha1.AutoDetectCloudProvider,
// Use the default runtime options. // Use the default runtime options.
ContainerRuntimeOptions: *options.NewContainerRuntimeOptions(), ContainerRuntimeOptions: *options.NewContainerRuntimeOptions(),
MinimumGCAge: metav1.Duration{Duration: 1 * time.Minute},
MaxContainerCount: 100,
MaxPerPodContainerCount: 2,
RegisterSchedulable: true,
} }
// Config struct // Config struct
...@@ -134,6 +129,7 @@ func GetHollowKubeletConfig( ...@@ -134,6 +129,7 @@ func GetHollowKubeletConfig(
c.PodManifestPath = manifestFilePath c.PodManifestPath = manifestFilePath
c.FileCheckFrequency.Duration = 20 * time.Second c.FileCheckFrequency.Duration = 20 * time.Second
c.HTTPCheckFrequency.Duration = 20 * time.Second c.HTTPCheckFrequency.Duration = 20 * time.Second
c.MinimumGCAge.Duration = 1 * time.Minute
c.NodeStatusUpdateFrequency.Duration = 10 * time.Second c.NodeStatusUpdateFrequency.Duration = 10 * time.Second
c.SyncFrequency.Duration = 10 * time.Second c.SyncFrequency.Duration = 10 * time.Second
c.EvictionPressureTransitionPeriod.Duration = 5 * time.Minute c.EvictionPressureTransitionPeriod.Duration = 5 * time.Minute
...@@ -156,8 +152,11 @@ func GetHollowKubeletConfig( ...@@ -156,8 +152,11 @@ func GetHollowKubeletConfig(
// what the "real" kubelet currently does, because there's no way to // what the "real" kubelet currently does, because there's no way to
// set promiscuous mode on docker0. // set promiscuous mode on docker0.
c.HairpinMode = kubeletconfig.HairpinVeth c.HairpinMode = kubeletconfig.HairpinVeth
c.MaxContainerCount = 100
c.MaxOpenFiles = 1024 c.MaxOpenFiles = 1024
c.MaxPerPodContainerCount = 2
c.RegisterNode = true c.RegisterNode = true
c.RegisterSchedulable = true
c.RegistryBurst = 10 c.RegistryBurst = 10
c.RegistryPullQPS = 5.0 c.RegistryPullQPS = 5.0
c.ResolverConfig = kubetypes.ResolvConfDefault c.ResolverConfig = kubetypes.ResolvConfDefault
......
...@@ -59,6 +59,7 @@ var _ = framework.KubeDescribe("MemoryAllocatableEviction [Slow] [Serial] [Disru ...@@ -59,6 +59,7 @@ var _ = framework.KubeDescribe("MemoryAllocatableEviction [Slow] [Serial] [Disru
kubeReserved.Sub(resource.MustParse("300Mi")) kubeReserved.Sub(resource.MustParse("300Mi"))
initialConfig.KubeReserved = kubeletconfig.ConfigurationMap(map[string]string{string(v1.ResourceMemory): kubeReserved.String()}) initialConfig.KubeReserved = kubeletconfig.ConfigurationMap(map[string]string{string(v1.ResourceMemory): kubeReserved.String()})
initialConfig.EnforceNodeAllocatable = []string{cm.NodeAllocatableEnforcementKey} initialConfig.EnforceNodeAllocatable = []string{cm.NodeAllocatableEnforcementKey}
initialConfig.ExperimentalNodeAllocatableIgnoreEvictionThreshold = false
initialConfig.CgroupsPerQOS = true initialConfig.CgroupsPerQOS = true
}) })
// Place the remainder of the test within a context so that the kubelet config is set before and after the test. // Place the remainder of the test within a context so that the kubelet config is set before and after the test.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment