mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-30 05:43:58 +00:00
Mulligan: Remove deprecated and experimental fields from KubeletConfiguration
Revert "Merge pull request #51857 from kubernetes/revert-51307-kc-type-refactor" This reverts commit9d27d92420, reversing changes made to2e69d4e625. See original: #51307 We punted this from 1.8 so it could go through an API review. The point of this PR is that we are trying to stabilize the kubeletconfig API so that we can move it out of alpha, and unblock features like Dynamic Kubelet Config, Kubelet loading its initial config from a file instead of flags, kubeadm and other install tools having a versioned API to rely on, etc. We shouldn't rev the version without both removing all the deprecated junk from the KubeletConfiguration struct, and without (at least temporarily) removing all of the fields that have "Experimental" in their names. It wouldn't make sense to lock in to deprecated fields. "Experimental" fields can be audited on a 1-by-1 basis after this PR, and if found to be stable (or sufficiently alpha-gated), can be restored to the KubeletConfiguration without the "Experimental" prefix.
This commit is contained in:
@@ -45,13 +45,10 @@ const (
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// A configuration field should go in KubeletFlags instead of KubeletConfiguration if any of these are true:
|
||||
// - 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
|
||||
// A configuration field should go in KubeletFlags instead of KubeletConfiguration if
|
||||
// its value cannot be safely shared between nodes at the same time (e.g. a hostname)
|
||||
// In general, please try to avoid adding flags or configuration fields,
|
||||
// we already have a confusingly large amount of them.
|
||||
// TODO: curate the ordering and structure of this config object
|
||||
type KubeletConfiguration struct {
|
||||
metav1.TypeMeta
|
||||
|
||||
@@ -131,15 +128,6 @@ type KubeletConfiguration struct {
|
||||
EnableDebuggingHandlers bool
|
||||
// enableContentionProfiling enables lock contention profiling, if enableDebuggingHandlers is true.
|
||||
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 int32
|
||||
// healthzPort is the port of the localhost healthz endpoint (set to 0 to disable)
|
||||
@@ -156,9 +144,6 @@ type KubeletConfiguration struct {
|
||||
// configure all containers to search this domain in addition to the
|
||||
// host's search domains.
|
||||
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,
|
||||
// kubelet will configure all containers to use this for DNS resolution
|
||||
// instead of the host's DNS servers
|
||||
@@ -210,10 +195,6 @@ type KubeletConfiguration struct {
|
||||
CgroupRoot string
|
||||
// containerRuntime is the container runtime to use.
|
||||
ContainerRuntime string
|
||||
// remoteRuntimeEndpoint is the endpoint of remote runtime service
|
||||
RemoteRuntimeEndpoint string
|
||||
// remoteImageEndpoint is the endpoint of remote image service
|
||||
RemoteImageEndpoint string
|
||||
// CPUManagerPolicy is the name of the policy to use.
|
||||
CPUManagerPolicy string
|
||||
// CPU Manager reconciliation period.
|
||||
@@ -222,8 +203,6 @@ type KubeletConfiguration struct {
|
||||
// requests - pull, logs, exec and attach.
|
||||
// +optional
|
||||
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.
|
||||
// It uses this file as a lock to synchronize with other kubelet processes
|
||||
// that may be running.
|
||||
@@ -253,14 +232,8 @@ type KubeletConfiguration struct {
|
||||
// cpuCFSQuota is Enable CPU CFS quota enforcement for containers that
|
||||
// specify CPU limits
|
||||
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 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
|
||||
// the kubelet registers itself. This only takes effect when registerNode
|
||||
// is true and upon the initial registration of the node.
|
||||
@@ -279,8 +252,6 @@ type KubeletConfiguration struct {
|
||||
SerializeImagePulls bool
|
||||
// nodeLabels to add when registering the node in the cluster.
|
||||
NodeLabels map[string]string
|
||||
// nonMasqueradeCIDR configures masquerading: traffic to IPs outside this range will use IP masquerade.
|
||||
NonMasqueradeCIDR string
|
||||
// enable gathering custom metrics.
|
||||
EnableCustomMetrics bool
|
||||
// Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'.
|
||||
@@ -301,19 +272,12 @@ 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.
|
||||
// +optional
|
||||
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
|
||||
PodsPerCore int32
|
||||
// enableControllerAttachDetach enables the Attach/Detach controller to
|
||||
// manage attachment/detachment of volumes scheduled to this node, and
|
||||
// disables kubelet from executing any attach/detach operations
|
||||
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
|
||||
ProtectKernelDefaults bool
|
||||
// If true, Kubelet ensures a set of iptables rules are present on host.
|
||||
@@ -328,20 +292,10 @@ 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.
|
||||
// Values must be within the range [0, 31]. Must be different from IPTablesMasqueradeBit
|
||||
IPTablesDropBit int32
|
||||
// Whitelist of unsafe sysctls or sysctl patterns (ending in *).
|
||||
// +optional
|
||||
AllowedUnsafeSysctls []string
|
||||
// featureGates is a map of feature names to bools that enable or disable alpha/experimental features.
|
||||
FeatureGates map[string]bool
|
||||
// Tells the Kubelet to fail to start if swap is enabled on the node.
|
||||
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 */
|
||||
|
||||
@@ -365,9 +319,6 @@ type KubeletConfiguration struct {
|
||||
// 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/node-allocatable.md) doc for more information.
|
||||
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/node-allocatable.md) doc for more information.
|
||||
ExperimentalNodeAllocatableIgnoreEvictionThreshold bool
|
||||
}
|
||||
|
||||
type KubeletAuthorizationMode string
|
||||
|
||||
@@ -18,7 +18,6 @@ package v1alpha1
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -143,28 +142,12 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
|
||||
temp := int32(80)
|
||||
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 {
|
||||
obj.MaxOpenFiles = 1000000
|
||||
}
|
||||
if obj.MaxPods == 0 {
|
||||
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 == "" {
|
||||
obj.VolumePluginDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/"
|
||||
}
|
||||
@@ -190,9 +173,6 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
|
||||
if obj.RegisterNode == nil {
|
||||
obj.RegisterNode = boolVar(true)
|
||||
}
|
||||
if obj.RegisterSchedulable == nil {
|
||||
obj.RegisterSchedulable = boolVar(true)
|
||||
}
|
||||
if obj.RegistryBurst == 0 {
|
||||
obj.RegistryBurst = 10
|
||||
}
|
||||
@@ -235,18 +215,12 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
|
||||
if obj.EvictionPressureTransitionPeriod == zeroDuration {
|
||||
obj.EvictionPressureTransitionPeriod = metav1.Duration{Duration: 5 * time.Minute}
|
||||
}
|
||||
if obj.ExperimentalKernelMemcgNotification == nil {
|
||||
obj.ExperimentalKernelMemcgNotification = boolVar(false)
|
||||
}
|
||||
if obj.SystemReserved == nil {
|
||||
obj.SystemReserved = make(map[string]string)
|
||||
}
|
||||
if obj.KubeReserved == nil {
|
||||
obj.KubeReserved = make(map[string]string)
|
||||
}
|
||||
if obj.ExperimentalQOSReserved == nil {
|
||||
obj.ExperimentalQOSReserved = make(map[string]string)
|
||||
}
|
||||
if obj.MakeIPTablesUtilChains == nil {
|
||||
obj.MakeIPTablesUtilChains = boolVar(true)
|
||||
}
|
||||
@@ -268,13 +242,6 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
|
||||
if obj.EnforceNodeAllocatable == nil {
|
||||
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"
|
||||
}
|
||||
}
|
||||
if obj.FeatureGates == nil {
|
||||
obj.FeatureGates = make(map[string]bool)
|
||||
}
|
||||
|
||||
@@ -41,10 +41,8 @@ const (
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// A configuration field should go in KubeletFlags instead of KubeletConfiguration if any of these are true:
|
||||
// - 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
|
||||
// A configuration field should go in KubeletFlags instead of KubeletConfiguration if
|
||||
// its value cannot be safely shared between nodes at the same time (e.g. a hostname)
|
||||
// In general, please try to avoid adding flags or configuration fields,
|
||||
// we already have a confusingly large amount of them.
|
||||
type KubeletConfiguration struct {
|
||||
@@ -126,15 +124,6 @@ type KubeletConfiguration struct {
|
||||
EnableDebuggingHandlers *bool `json:"enableDebuggingHandlers"`
|
||||
// enableContentionProfiling enables lock contention profiling, if enableDebuggingHandlers is true.
|
||||
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 *int32 `json:"cAdvisorPort"`
|
||||
// healthzPort is the port of the localhost healthz endpoint (set to 0 to disable)
|
||||
@@ -151,9 +140,6 @@ type KubeletConfiguration struct {
|
||||
// configure all containers to search this domain in addition to the
|
||||
// host's search domains.
|
||||
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,
|
||||
// kubelet will configure all containers to use this for DNS resolution
|
||||
// instead of the host's DNS servers
|
||||
@@ -202,10 +188,6 @@ type KubeletConfiguration struct {
|
||||
CgroupDriver string `json:"cgroupDriver,omitempty"`
|
||||
// containerRuntime is the container runtime to use.
|
||||
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"`
|
||||
// CPUManagerPolicy is the name of the policy to use.
|
||||
CPUManagerPolicy string `json:"cpuManagerPolicy"`
|
||||
// CPU Manager reconciliation period.
|
||||
@@ -213,9 +195,6 @@ type KubeletConfiguration struct {
|
||||
// runtimeRequestTimeout is the timeout for all runtime requests except long running
|
||||
// requests - pull, logs, exec and attach.
|
||||
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.
|
||||
// It uses this file as a lock to synchronize with other kubelet processes
|
||||
// that may be running.
|
||||
@@ -245,14 +224,8 @@ type KubeletConfiguration struct {
|
||||
// cpuCFSQuota is Enable CPU CFS quota enforcement for containers that
|
||||
// specify CPU limits
|
||||
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 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
|
||||
// the kubelet registers itself. This only takes effect when registerNode
|
||||
// is true and upon the initial registration of the node.
|
||||
@@ -271,8 +244,6 @@ type KubeletConfiguration struct {
|
||||
SerializeImagePulls *bool `json:"serializeImagePulls"`
|
||||
// nodeLabels to add when registering the node in the cluster.
|
||||
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.
|
||||
EnableCustomMetrics bool `json:"enableCustomMetrics"`
|
||||
// Comma-delimited list of hard eviction expressions. For example, 'memory.available<300Mi'.
|
||||
@@ -287,18 +258,12 @@ type KubeletConfiguration struct {
|
||||
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.
|
||||
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
|
||||
PodsPerCore int32 `json:"podsPerCore"`
|
||||
// enableControllerAttachDetach enables the Attach/Detach controller to
|
||||
// manage attachment/detachment of volumes scheduled to this node, and
|
||||
// disables kubelet from executing any attach/detach operations
|
||||
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
|
||||
ProtectKernelDefaults bool `json:"protectKernelDefaults"`
|
||||
// If true, Kubelet ensures a set of iptables rules are present on host.
|
||||
@@ -313,21 +278,10 @@ type KubeletConfiguration struct {
|
||||
// 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.
|
||||
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 map of feature names to bools that enable or disable alpha/experimental features.
|
||||
FeatureGates map[string]bool `json:"featureGates,omitempty"`
|
||||
// Tells the Kubelet to fail to start if swap is enabled on the node.
|
||||
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 */
|
||||
|
||||
@@ -352,9 +306,6 @@ type KubeletConfiguration struct {
|
||||
// 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/node-allocatable.md) doc for more information.
|
||||
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/node-allocatable.md) doc for more information.
|
||||
ExperimentalNodeAllocatableIgnoreEvictionThreshold bool `json:"experimentalNodeAllocatableIgnoreEvictionThreshold,omitempty"`
|
||||
}
|
||||
|
||||
type KubeletAuthorizationMode string
|
||||
|
||||
@@ -184,11 +184,6 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
|
||||
return err
|
||||
}
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
@@ -203,7 +198,6 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
|
||||
return err
|
||||
}
|
||||
out.ClusterDomain = in.ClusterDomain
|
||||
out.MasterServiceNamespace = in.MasterServiceNamespace
|
||||
out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS))
|
||||
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
|
||||
out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency
|
||||
@@ -225,12 +219,9 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
|
||||
}
|
||||
out.CgroupDriver = in.CgroupDriver
|
||||
out.ContainerRuntime = in.ContainerRuntime
|
||||
out.RemoteRuntimeEndpoint = in.RemoteRuntimeEndpoint
|
||||
out.RemoteImageEndpoint = in.RemoteImageEndpoint
|
||||
out.CPUManagerPolicy = in.CPUManagerPolicy
|
||||
out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod
|
||||
out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
|
||||
out.ExperimentalMounterPath = in.ExperimentalMounterPath
|
||||
if err := v1.Convert_Pointer_string_To_string(&in.LockFilePath, &out.LockFilePath, s); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -242,13 +233,7 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
|
||||
if err := v1.Convert_Pointer_bool_To_bool(&in.CPUCFSQuota, &out.CPUCFSQuota, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v1.Convert_Pointer_bool_To_bool(&in.Containerized, &out.Containerized, s); err != nil {
|
||||
return err
|
||||
}
|
||||
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.ContentType = in.ContentType
|
||||
if err := v1.Convert_Pointer_int32_To_int32(&in.KubeAPIQPS, &out.KubeAPIQPS, s); err != nil {
|
||||
@@ -259,7 +244,6 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
|
||||
return err
|
||||
}
|
||||
out.NodeLabels = *(*map[string]string)(unsafe.Pointer(&in.NodeLabels))
|
||||
out.NonMasqueradeCIDR = in.NonMasqueradeCIDR
|
||||
out.EnableCustomMetrics = in.EnableCustomMetrics
|
||||
if err := v1.Convert_Pointer_string_To_string(&in.EvictionHard, &out.EvictionHard, s); err != nil {
|
||||
return err
|
||||
@@ -269,14 +253,10 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
|
||||
out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod
|
||||
out.EvictionMaxPodGracePeriod = in.EvictionMaxPodGracePeriod
|
||||
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
|
||||
if err := v1.Convert_Pointer_bool_To_bool(&in.EnableControllerAttachDetach, &out.EnableControllerAttachDetach, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ExperimentalQOSReserved = *(*kubeletconfig.ConfigurationMap)(unsafe.Pointer(&in.ExperimentalQOSReserved))
|
||||
out.ProtectKernelDefaults = in.ProtectKernelDefaults
|
||||
if err := v1.Convert_Pointer_bool_To_bool(&in.MakeIPTablesUtilChains, &out.MakeIPTablesUtilChains, s); err != nil {
|
||||
return err
|
||||
@@ -287,17 +267,13 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
|
||||
if err := v1.Convert_Pointer_int32_To_int32(&in.IPTablesDropBit, &out.IPTablesDropBit, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.AllowedUnsafeSysctls = *(*[]string)(unsafe.Pointer(&in.AllowedUnsafeSysctls))
|
||||
out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates))
|
||||
out.FailSwapOn = in.FailSwapOn
|
||||
out.ExperimentalCheckNodeCapabilitiesBeforeMount = in.ExperimentalCheckNodeCapabilitiesBeforeMount
|
||||
out.KeepTerminatedPodVolumes = in.KeepTerminatedPodVolumes
|
||||
out.SystemReserved = *(*kubeletconfig.ConfigurationMap)(unsafe.Pointer(&in.SystemReserved))
|
||||
out.KubeReserved = *(*kubeletconfig.ConfigurationMap)(unsafe.Pointer(&in.KubeReserved))
|
||||
out.SystemReservedCgroup = in.SystemReservedCgroup
|
||||
out.KubeReservedCgroup = in.KubeReservedCgroup
|
||||
out.EnforceNodeAllocatable = *(*[]string)(unsafe.Pointer(&in.EnforceNodeAllocatable))
|
||||
out.ExperimentalNodeAllocatableIgnoreEvictionThreshold = in.ExperimentalNodeAllocatableIgnoreEvictionThreshold
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -349,11 +325,6 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
|
||||
return err
|
||||
}
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
@@ -368,7 +339,6 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
|
||||
return err
|
||||
}
|
||||
out.ClusterDomain = in.ClusterDomain
|
||||
out.MasterServiceNamespace = in.MasterServiceNamespace
|
||||
out.ClusterDNS = *(*[]string)(unsafe.Pointer(&in.ClusterDNS))
|
||||
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
|
||||
out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency
|
||||
@@ -390,12 +360,9 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
|
||||
out.SystemCgroups = in.SystemCgroups
|
||||
out.CgroupRoot = in.CgroupRoot
|
||||
out.ContainerRuntime = in.ContainerRuntime
|
||||
out.RemoteRuntimeEndpoint = in.RemoteRuntimeEndpoint
|
||||
out.RemoteImageEndpoint = in.RemoteImageEndpoint
|
||||
out.CPUManagerPolicy = in.CPUManagerPolicy
|
||||
out.CPUManagerReconcilePeriod = in.CPUManagerReconcilePeriod
|
||||
out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
|
||||
out.ExperimentalMounterPath = in.ExperimentalMounterPath
|
||||
if err := v1.Convert_string_To_Pointer_string(&in.LockFilePath, &out.LockFilePath, s); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -407,13 +374,7 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
|
||||
if err := v1.Convert_bool_To_Pointer_bool(&in.CPUCFSQuota, &out.CPUCFSQuota, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v1.Convert_bool_To_Pointer_bool(&in.Containerized, &out.Containerized, s); err != nil {
|
||||
return err
|
||||
}
|
||||
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.ContentType = in.ContentType
|
||||
if err := v1.Convert_int32_To_Pointer_int32(&in.KubeAPIQPS, &out.KubeAPIQPS, s); err != nil {
|
||||
@@ -424,7 +385,6 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
|
||||
return err
|
||||
}
|
||||
out.NodeLabels = *(*map[string]string)(unsafe.Pointer(&in.NodeLabels))
|
||||
out.NonMasqueradeCIDR = in.NonMasqueradeCIDR
|
||||
out.EnableCustomMetrics = in.EnableCustomMetrics
|
||||
if err := v1.Convert_string_To_Pointer_string(&in.EvictionHard, &out.EvictionHard, s); err != nil {
|
||||
return err
|
||||
@@ -434,14 +394,10 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
|
||||
out.EvictionPressureTransitionPeriod = in.EvictionPressureTransitionPeriod
|
||||
out.EvictionMaxPodGracePeriod = in.EvictionMaxPodGracePeriod
|
||||
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
|
||||
if err := v1.Convert_bool_To_Pointer_bool(&in.EnableControllerAttachDetach, &out.EnableControllerAttachDetach, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ExperimentalQOSReserved = *(*map[string]string)(unsafe.Pointer(&in.ExperimentalQOSReserved))
|
||||
out.ProtectKernelDefaults = in.ProtectKernelDefaults
|
||||
if err := v1.Convert_bool_To_Pointer_bool(&in.MakeIPTablesUtilChains, &out.MakeIPTablesUtilChains, s); err != nil {
|
||||
return err
|
||||
@@ -452,17 +408,13 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
|
||||
if err := v1.Convert_int32_To_Pointer_int32(&in.IPTablesDropBit, &out.IPTablesDropBit, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.AllowedUnsafeSysctls = *(*[]string)(unsafe.Pointer(&in.AllowedUnsafeSysctls))
|
||||
out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates))
|
||||
out.FailSwapOn = in.FailSwapOn
|
||||
out.ExperimentalCheckNodeCapabilitiesBeforeMount = in.ExperimentalCheckNodeCapabilitiesBeforeMount
|
||||
out.KeepTerminatedPodVolumes = in.KeepTerminatedPodVolumes
|
||||
out.SystemReserved = *(*map[string]string)(unsafe.Pointer(&in.SystemReserved))
|
||||
out.KubeReserved = *(*map[string]string)(unsafe.Pointer(&in.KubeReserved))
|
||||
out.SystemReservedCgroup = in.SystemReservedCgroup
|
||||
out.KubeReservedCgroup = in.KubeReservedCgroup
|
||||
out.EnforceNodeAllocatable = *(*[]string)(unsafe.Pointer(&in.EnforceNodeAllocatable))
|
||||
out.ExperimentalNodeAllocatableIgnoreEvictionThreshold = in.ExperimentalNodeAllocatableIgnoreEvictionThreshold
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -217,16 +217,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
||||
**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 {
|
||||
in, out := &in.CAdvisorPort, &out.CAdvisorPort
|
||||
if *in == nil {
|
||||
@@ -319,24 +309,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
||||
**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 {
|
||||
in, out := &in.RegisterWithTaints, &out.RegisterWithTaints
|
||||
*out = make([]core_v1.Taint, len(*in))
|
||||
@@ -379,15 +351,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
in, out := &in.EnableControllerAttachDetach, &out.EnableControllerAttachDetach
|
||||
if *in == nil {
|
||||
@@ -397,13 +360,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
||||
**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 {
|
||||
in, out := &in.MakeIPTablesUtilChains, &out.MakeIPTablesUtilChains
|
||||
if *in == nil {
|
||||
@@ -431,11 +387,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.AllowedUnsafeSysctls != nil {
|
||||
in, out := &in.AllowedUnsafeSysctls, &out.AllowedUnsafeSysctls
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.FeatureGates != nil {
|
||||
in, out := &in.FeatureGates, &out.FeatureGates
|
||||
*out = make(map[string]bool, len(*in))
|
||||
|
||||
@@ -154,7 +154,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.MinimumGCAge = in.MinimumGCAge
|
||||
if in.ClusterDNS != nil {
|
||||
in, out := &in.ClusterDNS, &out.ClusterDNS
|
||||
*out = make([]string, len(*in))
|
||||
@@ -181,18 +180,6 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
||||
}
|
||||
}
|
||||
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.FeatureGates != nil {
|
||||
in, out := &in.FeatureGates, &out.FeatureGates
|
||||
*out = make(map[string]bool, len(*in))
|
||||
|
||||
@@ -198,12 +198,27 @@ type Bootstrap interface {
|
||||
type Builder func(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
kubeDeps *Dependencies,
|
||||
crOptions *options.ContainerRuntimeOptions,
|
||||
hostnameOverride,
|
||||
nodeIP,
|
||||
providerID,
|
||||
cloudProvider,
|
||||
certDirectory,
|
||||
rootDirectory string) (Bootstrap, error)
|
||||
hostnameOverride string,
|
||||
nodeIP string,
|
||||
providerID string,
|
||||
cloudProvider string,
|
||||
certDirectory string,
|
||||
rootDirectory string,
|
||||
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) (Bootstrap, error)
|
||||
|
||||
// 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
|
||||
@@ -287,12 +302,12 @@ func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, ku
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
func getRuntimeAndImageServices(config *kubeletconfiginternal.KubeletConfiguration) (internalapi.RuntimeService, internalapi.ImageManagerService, error) {
|
||||
rs, err := remote.NewRemoteRuntimeService(config.RemoteRuntimeEndpoint, config.RuntimeRequestTimeout.Duration)
|
||||
func getRuntimeAndImageServices(remoteRuntimeEndpoint string, remoteImageEndpoint string, runtimeRequestTimeout metav1.Duration) (internalapi.RuntimeService, internalapi.ImageManagerService, error) {
|
||||
rs, err := remote.NewRemoteRuntimeService(remoteRuntimeEndpoint, runtimeRequestTimeout.Duration)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
is, err := remote.NewRemoteImageService(config.RemoteImageEndpoint, config.RuntimeRequestTimeout.Duration)
|
||||
is, err := remote.NewRemoteImageService(remoteImageEndpoint, runtimeRequestTimeout.Duration)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@@ -304,12 +319,27 @@ func getRuntimeAndImageServices(config *kubeletconfiginternal.KubeletConfigurati
|
||||
func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
kubeDeps *Dependencies,
|
||||
crOptions *options.ContainerRuntimeOptions,
|
||||
hostnameOverride,
|
||||
nodeIP,
|
||||
providerID,
|
||||
cloudProvider,
|
||||
certDirectory,
|
||||
rootDirectory string) (*Kubelet, error) {
|
||||
hostnameOverride string,
|
||||
nodeIP string,
|
||||
providerID string,
|
||||
cloudProvider string,
|
||||
certDirectory string,
|
||||
rootDirectory string,
|
||||
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) (*Kubelet, error) {
|
||||
if rootDirectory == "" {
|
||||
return nil, fmt.Errorf("invalid root directory %q", rootDirectory)
|
||||
}
|
||||
@@ -377,9 +407,9 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
}
|
||||
|
||||
containerGCPolicy := kubecontainer.ContainerGCPolicy{
|
||||
MinAge: kubeCfg.MinimumGCAge.Duration,
|
||||
MaxPerPodContainer: int(kubeCfg.MaxPerPodContainerCount),
|
||||
MaxContainers: int(kubeCfg.MaxContainerCount),
|
||||
MinAge: minimumGCAge.Duration,
|
||||
MaxPerPodContainer: int(maxPerPodContainerCount),
|
||||
MaxContainers: int(maxContainerCount),
|
||||
}
|
||||
|
||||
daemonEndpoints := &v1.NodeDaemonEndpoints{
|
||||
@@ -393,7 +423,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
}
|
||||
|
||||
enforceNodeAllocatable := kubeCfg.EnforceNodeAllocatable
|
||||
if kubeCfg.ExperimentalNodeAllocatableIgnoreEvictionThreshold {
|
||||
if experimentalNodeAllocatableIgnoreEvictionThreshold {
|
||||
// Do not provide kubeCfg.EnforceNodeAllocatable to eviction threshold parsing if we are not enforcing Evictions
|
||||
enforceNodeAllocatable = []string{}
|
||||
}
|
||||
@@ -405,7 +435,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
PressureTransitionPeriod: kubeCfg.EvictionPressureTransitionPeriod.Duration,
|
||||
MaxPodGracePeriodSeconds: int64(kubeCfg.EvictionMaxPodGracePeriod),
|
||||
Thresholds: thresholds,
|
||||
KernelMemcgNotification: kubeCfg.ExperimentalKernelMemcgNotification,
|
||||
KernelMemcgNotification: experimentalKernelMemcgNotification,
|
||||
}
|
||||
|
||||
serviceIndexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
||||
@@ -459,12 +489,12 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
resyncInterval: kubeCfg.SyncFrequency.Duration,
|
||||
sourcesReady: config.NewSourcesReady(kubeDeps.PodConfig.SeenAllSources),
|
||||
registerNode: kubeCfg.RegisterNode,
|
||||
registerSchedulable: kubeCfg.RegisterSchedulable,
|
||||
registerSchedulable: registerSchedulable,
|
||||
clusterDomain: kubeCfg.ClusterDomain,
|
||||
clusterDNS: clusterDNS,
|
||||
serviceLister: serviceLister,
|
||||
nodeInfo: nodeInfo,
|
||||
masterServiceNamespace: kubeCfg.MasterServiceNamespace,
|
||||
masterServiceNamespace: masterServiceNamespace,
|
||||
streamingConnectionIdleTimeout: kubeCfg.StreamingConnectionIdleTimeout.Duration,
|
||||
recorder: kubeDeps.Recorder,
|
||||
cadvisor: kubeDeps.CAdvisorInterface,
|
||||
@@ -495,6 +525,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
iptablesMasqueradeBit: int(kubeCfg.IPTablesMasqueradeBit),
|
||||
iptablesDropBit: int(kubeCfg.IPTablesDropBit),
|
||||
experimentalHostUserNamespaceDefaulting: utilfeature.DefaultFeatureGate.Enabled(features.ExperimentalHostUserNamespaceDefaultingGate),
|
||||
keepTerminatedPodVolumes: keepTerminatedPodVolumes,
|
||||
}
|
||||
|
||||
secretManager := secret.NewCachingSecretManager(
|
||||
@@ -517,7 +548,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
}
|
||||
glog.Infof("Hairpin mode set to %q", hairpinMode)
|
||||
|
||||
plug, err := network.InitNetworkPlugin(kubeDeps.NetworkPlugins, crOptions.NetworkPluginName, &criNetworkHost{&networkHost{klet}, &network.NoopPortMappingGetter{}}, hairpinMode, kubeCfg.NonMasqueradeCIDR, int(crOptions.NetworkPluginMTU))
|
||||
plug, err := network.InitNetworkPlugin(kubeDeps.NetworkPlugins, crOptions.NetworkPluginName, &criNetworkHost{&networkHost{klet}, &network.NoopPortMappingGetter{}}, hairpinMode, nonMasqueradeCIDR, int(crOptions.NetworkPluginMTU))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -536,10 +567,10 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
// podManager is also responsible for keeping secretManager and configMapManager contents up-to-date.
|
||||
klet.podManager = kubepod.NewBasicPodManager(kubepod.NewBasicMirrorClient(klet.kubeClient), secretManager, configMapManager)
|
||||
|
||||
if kubeCfg.RemoteRuntimeEndpoint != "" {
|
||||
// kubeCfg.RemoteImageEndpoint is same as kubeCfg.RemoteRuntimeEndpoint if not explicitly specified
|
||||
if kubeCfg.RemoteImageEndpoint == "" {
|
||||
kubeCfg.RemoteImageEndpoint = kubeCfg.RemoteRuntimeEndpoint
|
||||
if remoteRuntimeEndpoint != "" {
|
||||
// remoteImageEndpoint is same as remoteRuntimeEndpoint if not explicitly specified
|
||||
if remoteImageEndpoint == "" {
|
||||
remoteImageEndpoint = remoteRuntimeEndpoint
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,7 +581,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
}
|
||||
pluginSettings := dockershim.NetworkPluginSettings{
|
||||
HairpinMode: hairpinMode,
|
||||
NonMasqueradeCIDR: kubeCfg.NonMasqueradeCIDR,
|
||||
NonMasqueradeCIDR: nonMasqueradeCIDR,
|
||||
PluginName: crOptions.NetworkPluginName,
|
||||
PluginConfDir: crOptions.CNIConfDir,
|
||||
PluginBinDir: binDir,
|
||||
@@ -592,10 +623,10 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
|
||||
// The unix socket for kubelet <-> dockershim communication.
|
||||
glog.V(5).Infof("RemoteRuntimeEndpoint: %q, RemoteImageEndpoint: %q",
|
||||
kubeCfg.RemoteRuntimeEndpoint,
|
||||
kubeCfg.RemoteImageEndpoint)
|
||||
remoteRuntimeEndpoint,
|
||||
remoteImageEndpoint)
|
||||
glog.V(2).Infof("Starting the GRPC server for the docker CRI shim.")
|
||||
server := dockerremote.NewDockerServer(kubeCfg.RemoteRuntimeEndpoint, ds)
|
||||
server := dockerremote.NewDockerServer(remoteRuntimeEndpoint, ds)
|
||||
if err := server.Start(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -614,7 +645,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported CRI runtime: %q", kubeCfg.ContainerRuntime)
|
||||
}
|
||||
runtimeService, imageService, err := getRuntimeAndImageServices(kubeCfg)
|
||||
runtimeService, imageService, err := getRuntimeAndImageServices(remoteRuntimeEndpoint, remoteImageEndpoint, kubeCfg.RuntimeRequestTimeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -651,7 +682,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
// be removed. Related issue:
|
||||
// https://github.com/kubernetes/kubernetes/issues/51798
|
||||
if (kubeCfg.ContainerRuntime == kubetypes.DockerContainerRuntime &&
|
||||
goruntime.GOOS == "linux") || kubeCfg.RemoteRuntimeEndpoint == "/var/run/crio.sock" {
|
||||
goruntime.GOOS == "linux") || remoteRuntimeEndpoint == "/var/run/crio.sock" {
|
||||
klet.StatsProvider = stats.NewCadvisorStatsProvider(
|
||||
klet.cadvisor,
|
||||
klet.resourceAnalyzer,
|
||||
@@ -772,11 +803,11 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
|
||||
// If the experimentalMounterPathFlag is set, we do not want to
|
||||
// check node capabilities since the mount path is not the default
|
||||
if len(kubeCfg.ExperimentalMounterPath) != 0 {
|
||||
kubeCfg.ExperimentalCheckNodeCapabilitiesBeforeMount = false
|
||||
if len(experimentalMounterPath) != 0 {
|
||||
experimentalCheckNodeCapabilitiesBeforeMount = false
|
||||
// Replace the nameserver in containerized-mounter's rootfs/etc/resolve.conf with kubelet.ClusterDNS
|
||||
// so that service name could be resolved
|
||||
klet.setupDNSinContainerizedMounter(kubeCfg.ExperimentalMounterPath)
|
||||
klet.setupDNSinContainerizedMounter(experimentalMounterPath)
|
||||
}
|
||||
|
||||
// setup volumeManager
|
||||
@@ -791,8 +822,8 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
kubeDeps.Mounter,
|
||||
klet.getPodsDir(),
|
||||
kubeDeps.Recorder,
|
||||
kubeCfg.ExperimentalCheckNodeCapabilitiesBeforeMount,
|
||||
kubeCfg.KeepTerminatedPodVolumes)
|
||||
experimentalCheckNodeCapabilitiesBeforeMount,
|
||||
keepTerminatedPodVolumes)
|
||||
|
||||
runtimeCache, err := kubecontainer.NewRuntimeCache(klet.containerRuntime)
|
||||
if err != nil {
|
||||
@@ -824,7 +855,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
}
|
||||
// Safe, whitelisted sysctls can always be used as unsafe sysctls in the spec
|
||||
// Hence, we concatenate those two lists.
|
||||
safeAndUnsafeSysctls := append(sysctl.SafeSysctlWhitelist(), kubeCfg.AllowedUnsafeSysctls...)
|
||||
safeAndUnsafeSysctls := append(sysctl.SafeSysctlWhitelist(), allowedUnsafeSysctls...)
|
||||
unsafeWhitelist, err := sysctl.NewWhitelist(safeAndUnsafeSysctls, v1.UnsafeSysctlsPodAnnotationKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1149,6 +1180,13 @@ type Kubelet struct {
|
||||
|
||||
// StatsProvider provides the node and the container stats.
|
||||
*stats.StatsProvider
|
||||
|
||||
// containerized should be set to true if the kubelet is running in a container
|
||||
containerized 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 // DEPRECATED
|
||||
}
|
||||
|
||||
func allLocalIPsWithoutLoopback() ([]net.IP, error) {
|
||||
|
||||
@@ -272,7 +272,7 @@ func (kl *Kubelet) initialNode() (*v1.Node, error) {
|
||||
glog.Infof("Controller attach/detach is disabled for this node; Kubelet will attach and detach volumes")
|
||||
}
|
||||
|
||||
if kl.kubeletConfiguration.KeepTerminatedPodVolumes {
|
||||
if kl.keepTerminatedPodVolumes {
|
||||
if node.Annotations == nil {
|
||||
node.Annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
@@ -864,7 +864,7 @@ func (kl *Kubelet) PodResourcesAreReclaimed(pod *v1.Pod, status v1.PodStatus) bo
|
||||
glog.V(3).Infof("Pod %q is terminated, but some containers have not been cleaned up: %+v", format.Pod(pod), runtimeStatus.ContainerStatuses)
|
||||
return false
|
||||
}
|
||||
if kl.podVolumesExist(pod.UID) && !kl.kubeletConfiguration.KeepTerminatedPodVolumes {
|
||||
if kl.podVolumesExist(pod.UID) && !kl.keepTerminatedPodVolumes {
|
||||
// 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))
|
||||
return false
|
||||
@@ -1704,7 +1704,7 @@ func (kl *Kubelet) cleanupOrphanedPodCgroups(cgroupPods map[types.UID]cm.CgroupN
|
||||
// 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
|
||||
// is configured to keep terminated volumes, we will delete the cgroup and not block.
|
||||
if podVolumesExist := kl.podVolumesExist(uid); podVolumesExist && !kl.kubeletConfiguration.KeepTerminatedPodVolumes {
|
||||
if podVolumesExist := kl.podVolumesExist(uid); podVolumesExist && !kl.keepTerminatedPodVolumes {
|
||||
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 {
|
||||
glog.Warningf("Failed to reduce cpu time for pod %q pending volume cleanup due to %v", uid, err)
|
||||
|
||||
@@ -21,7 +21,6 @@ go_library(
|
||||
"//pkg/controller:go_default_library",
|
||||
"//pkg/kubelet:go_default_library",
|
||||
"//pkg/kubelet/apis/kubeletconfig:go_default_library",
|
||||
"//pkg/kubelet/apis/kubeletconfig/v1alpha1:go_default_library",
|
||||
"//pkg/kubelet/cadvisor:go_default_library",
|
||||
"//pkg/kubelet/cm:go_default_library",
|
||||
"//pkg/kubelet/container/testing:go_default_library",
|
||||
|
||||
@@ -19,12 +19,12 @@ package kubemark
|
||||
import (
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
kubeletapp "k8s.io/kubernetes/cmd/kubelet/app"
|
||||
"k8s.io/kubernetes/cmd/kubelet/app/options"
|
||||
"k8s.io/kubernetes/pkg/kubelet"
|
||||
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
|
||||
kubeletv1alpha1 "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/v1alpha1"
|
||||
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
|
||||
"k8s.io/kubernetes/pkg/kubelet/cm"
|
||||
containertest "k8s.io/kubernetes/pkg/kubelet/container/testing"
|
||||
@@ -109,13 +109,13 @@ func GetHollowKubeletConfig(
|
||||
glog.Infof("Using %s as root dir for hollow-kubelet", testRootDir)
|
||||
|
||||
// Flags struct
|
||||
f := &options.KubeletFlags{
|
||||
RootDirectory: testRootDir,
|
||||
HostnameOverride: nodeName,
|
||||
CloudProvider: kubeletv1alpha1.AutoDetectCloudProvider,
|
||||
// Use the default runtime options.
|
||||
ContainerRuntimeOptions: *options.NewContainerRuntimeOptions(),
|
||||
}
|
||||
f := options.NewKubeletFlags()
|
||||
f.RootDirectory = testRootDir
|
||||
f.HostnameOverride = nodeName
|
||||
f.MinimumGCAge = metav1.Duration{Duration: 1 * time.Minute}
|
||||
f.MaxContainerCount = 100
|
||||
f.MaxPerPodContainerCount = 2
|
||||
f.RegisterSchedulable = true
|
||||
|
||||
// Config struct
|
||||
c, err := options.NewKubeletConfiguration()
|
||||
@@ -130,7 +130,6 @@ func GetHollowKubeletConfig(
|
||||
c.PodManifestPath = manifestFilePath
|
||||
c.FileCheckFrequency.Duration = 20 * time.Second
|
||||
c.HTTPCheckFrequency.Duration = 20 * time.Second
|
||||
c.MinimumGCAge.Duration = 1 * time.Minute
|
||||
c.NodeStatusUpdateFrequency.Duration = 10 * time.Second
|
||||
c.SyncFrequency.Duration = 10 * time.Second
|
||||
c.EvictionPressureTransitionPeriod.Duration = 5 * time.Minute
|
||||
@@ -153,11 +152,8 @@ func GetHollowKubeletConfig(
|
||||
// what the "real" kubelet currently does, because there's no way to
|
||||
// set promiscuous mode on docker0.
|
||||
c.HairpinMode = kubeletconfig.HairpinVeth
|
||||
c.MaxContainerCount = 100
|
||||
c.MaxOpenFiles = 1024
|
||||
c.MaxPerPodContainerCount = 2
|
||||
c.RegisterNode = true
|
||||
c.RegisterSchedulable = true
|
||||
c.RegistryBurst = 10
|
||||
c.RegistryPullQPS = 5.0
|
||||
c.ResolverConfig = kubetypes.ResolvConfDefault
|
||||
|
||||
Reference in New Issue
Block a user