k8s.io/kubernetes@v1.29.3/pkg/kubelet/apis/config/types.go (about)

     1  /*
     2  Copyright 2015 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package config
    18  
    19  import (
    20  	v1 "k8s.io/api/core/v1"
    21  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    22  	logsapi "k8s.io/component-base/logs/api/v1"
    23  	tracingapi "k8s.io/component-base/tracing/api/v1"
    24  )
    25  
    26  // HairpinMode denotes how the kubelet should configure networking to handle
    27  // hairpin packets.
    28  type HairpinMode string
    29  
    30  // Enum settings for different ways to handle hairpin packets.
    31  const (
    32  	// Set the hairpin flag on the veth of containers in the respective
    33  	// container runtime.
    34  	HairpinVeth = "hairpin-veth"
    35  	// Make the container bridge promiscuous. This will force it to accept
    36  	// hairpin packets, even if the flag isn't set on ports of the bridge.
    37  	PromiscuousBridge = "promiscuous-bridge"
    38  	// Neither of the above. If the kubelet is started in this hairpin mode
    39  	// and kube-proxy is running in iptables mode, hairpin packets will be
    40  	// dropped by the container bridge.
    41  	HairpinNone = "none"
    42  )
    43  
    44  // ResourceChangeDetectionStrategy denotes a mode in which internal
    45  // managers (secret, configmap) are discovering object changes.
    46  type ResourceChangeDetectionStrategy string
    47  
    48  // Enum settings for different strategies of kubelet managers.
    49  const (
    50  	// GetChangeDetectionStrategy is a mode in which kubelet fetches
    51  	// necessary objects directly from apiserver.
    52  	GetChangeDetectionStrategy ResourceChangeDetectionStrategy = "Get"
    53  	// TTLCacheChangeDetectionStrategy is a mode in which kubelet uses
    54  	// ttl cache for object directly fetched from apiserver.
    55  	TTLCacheChangeDetectionStrategy ResourceChangeDetectionStrategy = "Cache"
    56  	// WatchChangeDetectionStrategy is a mode in which kubelet uses
    57  	// watches to observe changes to objects that are in its interest.
    58  	WatchChangeDetectionStrategy ResourceChangeDetectionStrategy = "Watch"
    59  	// RestrictedTopologyManagerPolicy is a mode in which kubelet only allows
    60  	// pods with optimal NUMA node alignment for requested resources
    61  	RestrictedTopologyManagerPolicy = "restricted"
    62  	// BestEffortTopologyManagerPolicy is a mode in which kubelet will favour
    63  	// pods with NUMA alignment of CPU and device resources.
    64  	BestEffortTopologyManagerPolicy = "best-effort"
    65  	// NoneTopologyManagerPolicy is a mode in which kubelet has no knowledge
    66  	// of NUMA alignment of a pod's CPU and device resources.
    67  	NoneTopologyManagerPolicy = "none"
    68  	// SingleNumaNodeTopologyManagerPolicy is a mode in which kubelet only allows
    69  	// pods with a single NUMA alignment of CPU and device resources.
    70  	SingleNumaNodeTopologyManagerPolicy = "single-numa-node"
    71  	// ContainerTopologyManagerScope represents that
    72  	// topology policy is applied on a per-container basis.
    73  	ContainerTopologyManagerScope = "container"
    74  	// PodTopologyManagerScope represents that
    75  	// topology policy is applied on a per-pod basis.
    76  	PodTopologyManagerScope = "pod"
    77  )
    78  
    79  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    80  
    81  // KubeletConfiguration contains the configuration for the Kubelet
    82  type KubeletConfiguration struct {
    83  	metav1.TypeMeta
    84  
    85  	// enableServer enables Kubelet's secured server.
    86  	// Note: Kubelet's insecure port is controlled by the readOnlyPort option.
    87  	EnableServer bool
    88  	// staticPodPath is the path to the directory containing local (static) pods to
    89  	// run, or the path to a single static pod file.
    90  	StaticPodPath string
    91  	// syncFrequency is the max period between synchronizing running
    92  	// containers and config
    93  	SyncFrequency metav1.Duration
    94  	// fileCheckFrequency is the duration between checking config files for
    95  	// new data
    96  	FileCheckFrequency metav1.Duration
    97  	// httpCheckFrequency is the duration between checking http for new data
    98  	HTTPCheckFrequency metav1.Duration
    99  	// staticPodURL is the URL for accessing static pods to run
   100  	StaticPodURL string
   101  	// staticPodURLHeader is a map of slices with HTTP headers to use when accessing the podURL
   102  	StaticPodURLHeader map[string][]string `datapolicy:"token"`
   103  	// address is the IP address for the Kubelet to serve on (set to 0.0.0.0
   104  	// for all interfaces)
   105  	Address string
   106  	// port is the port for the Kubelet to serve on.
   107  	Port int32
   108  	// readOnlyPort is the read-only port for the Kubelet to serve on with
   109  	// no authentication/authorization (set to 0 to disable)
   110  	ReadOnlyPort int32
   111  	// volumePluginDir is the full path of the directory in which to search
   112  	// for additional third party volume plugins.
   113  	VolumePluginDir string
   114  	// providerID, if set, sets the unique id of the instance that an external provider (i.e. cloudprovider)
   115  	// can use to identify a specific node
   116  	ProviderID string
   117  	// tlsCertFile is the file containing x509 Certificate for HTTPS.  (CA cert,
   118  	// if any, concatenated after server cert). If tlsCertFile and
   119  	// tlsPrivateKeyFile are not provided, a self-signed certificate
   120  	// and key are generated for the public address and saved to the directory
   121  	// passed to the Kubelet's --cert-dir flag.
   122  	TLSCertFile string
   123  	// tlsPrivateKeyFile is the file containing x509 private key matching tlsCertFile
   124  	TLSPrivateKeyFile string
   125  	// TLSCipherSuites is the list of allowed cipher suites for the server.
   126  	// Note that TLS 1.3 ciphersuites are not configurable.
   127  	// Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants).
   128  	TLSCipherSuites []string
   129  	// TLSMinVersion is the minimum TLS version supported.
   130  	// Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants).
   131  	TLSMinVersion string
   132  	// rotateCertificates enables client certificate rotation. The Kubelet will request a
   133  	// new certificate from the certificates.k8s.io API. This requires an approver to approve the
   134  	// certificate signing requests.
   135  	RotateCertificates bool
   136  	// serverTLSBootstrap enables server certificate bootstrap. Instead of self
   137  	// signing a serving certificate, the Kubelet will request a certificate from
   138  	// the certificates.k8s.io API. This requires an approver to approve the
   139  	// certificate signing requests. The RotateKubeletServerCertificate feature
   140  	// must be enabled.
   141  	ServerTLSBootstrap bool
   142  	// authentication specifies how requests to the Kubelet's server are authenticated
   143  	Authentication KubeletAuthentication
   144  	// authorization specifies how requests to the Kubelet's server are authorized
   145  	Authorization KubeletAuthorization
   146  	// registryPullQPS is the limit of registry pulls per second.
   147  	// Set to 0 for no limit.
   148  	RegistryPullQPS int32
   149  	// registryBurst is the maximum size of bursty pulls, temporarily allows
   150  	// pulls to burst to this number, while still not exceeding registryPullQPS.
   151  	// Only used if registryPullQPS > 0.
   152  	RegistryBurst int32
   153  	// eventRecordQPS is the maximum event creations per second. If 0, there
   154  	// is no limit enforced.
   155  	EventRecordQPS int32
   156  	// eventBurst is the maximum size of a burst of event creations, temporarily
   157  	// allows event creations to burst to this number, while still not exceeding
   158  	// eventRecordQPS. Only used if eventRecordQPS > 0.
   159  	EventBurst int32
   160  	// enableDebuggingHandlers enables server endpoints for log collection
   161  	// and local running of containers and commands
   162  	EnableDebuggingHandlers bool
   163  	// enableContentionProfiling enables block profiling, if enableDebuggingHandlers is true.
   164  	EnableContentionProfiling bool
   165  	// healthzPort is the port of the localhost healthz endpoint (set to 0 to disable)
   166  	HealthzPort int32
   167  	// healthzBindAddress is the IP address for the healthz server to serve on
   168  	HealthzBindAddress string
   169  	// oomScoreAdj is The oom-score-adj value for kubelet process. Values
   170  	// must be within the range [-1000, 1000].
   171  	OOMScoreAdj int32
   172  	// clusterDomain is the DNS domain for this cluster. If set, kubelet will
   173  	// configure all containers to search this domain in addition to the
   174  	// host's search domains.
   175  	ClusterDomain string
   176  	// clusterDNS is a list of IP addresses for a cluster DNS server. If set,
   177  	// kubelet will configure all containers to use this for DNS resolution
   178  	// instead of the host's DNS servers.
   179  	ClusterDNS []string
   180  	// streamingConnectionIdleTimeout is the maximum time a streaming connection
   181  	// can be idle before the connection is automatically closed.
   182  	StreamingConnectionIdleTimeout metav1.Duration
   183  	// nodeStatusUpdateFrequency is the frequency that kubelet computes node
   184  	// status. If node lease feature is not enabled, it is also the frequency that
   185  	// kubelet posts node status to master. In that case, be cautious when
   186  	// changing the constant, it must work with nodeMonitorGracePeriod in nodecontroller.
   187  	NodeStatusUpdateFrequency metav1.Duration
   188  	// nodeStatusReportFrequency is the frequency that kubelet posts node
   189  	// status to master if node status does not change. Kubelet will ignore this
   190  	// frequency and post node status immediately if any change is detected. It is
   191  	// only used when node lease feature is enabled.
   192  	NodeStatusReportFrequency metav1.Duration
   193  	// nodeLeaseDurationSeconds is the duration the Kubelet will set on its corresponding Lease.
   194  	NodeLeaseDurationSeconds int32
   195  	// ImageMinimumGCAge is the minimum age for an unused image before it is
   196  	// garbage collected.
   197  	ImageMinimumGCAge metav1.Duration
   198  	// ImageMaximumGCAge is the maximum age an image can be unused before it is garbage collected.
   199  	// The default of this field is "0s", which disables this field--meaning images won't be garbage
   200  	// collected based on being unused for too long.
   201  	ImageMaximumGCAge metav1.Duration
   202  	// imageGCHighThresholdPercent is the percent of disk usage after which
   203  	// image garbage collection is always run. The percent is calculated as
   204  	// this field value out of 100.
   205  	ImageGCHighThresholdPercent int32
   206  	// imageGCLowThresholdPercent is the percent of disk usage before which
   207  	// image garbage collection is never run. Lowest disk usage to garbage
   208  	// collect to. The percent is calculated as this field value out of 100.
   209  	ImageGCLowThresholdPercent int32
   210  	// How frequently to calculate and cache volume disk usage for all pods
   211  	VolumeStatsAggPeriod metav1.Duration
   212  	// KubeletCgroups is the absolute name of cgroups to isolate the kubelet in
   213  	KubeletCgroups string
   214  	// SystemCgroups is absolute name of cgroups in which to place
   215  	// all non-kernel processes that are not already in a container. Empty
   216  	// for no container. Rolling back the flag requires a reboot.
   217  	SystemCgroups string
   218  	// CgroupRoot is the root cgroup to use for pods.
   219  	// If CgroupsPerQOS is enabled, this is the root of the QoS cgroup hierarchy.
   220  	CgroupRoot string
   221  	// Enable QoS based Cgroup hierarchy: top level cgroups for QoS Classes
   222  	// And all Burstable and BestEffort pods are brought up under their
   223  	// specific top level QoS cgroup.
   224  	CgroupsPerQOS bool
   225  	// driver that the kubelet uses to manipulate cgroups on the host (cgroupfs or systemd)
   226  	CgroupDriver string
   227  	// CPUManagerPolicy is the name of the policy to use.
   228  	// Requires the CPUManager feature gate to be enabled.
   229  	CPUManagerPolicy string
   230  	// CPUManagerPolicyOptions is a set of key=value which 	allows to set extra options
   231  	// to fine tune the behaviour of the cpu manager policies.
   232  	// Requires  both the "CPUManager" and "CPUManagerPolicyOptions" feature gates to be enabled.
   233  	CPUManagerPolicyOptions map[string]string
   234  	// CPU Manager reconciliation period.
   235  	// Requires the CPUManager feature gate to be enabled.
   236  	CPUManagerReconcilePeriod metav1.Duration
   237  	// MemoryManagerPolicy is the name of the policy to use.
   238  	// Requires the MemoryManager feature gate to be enabled.
   239  	MemoryManagerPolicy string
   240  	// TopologyManagerPolicy is the name of the policy to use.
   241  	TopologyManagerPolicy string
   242  	// TopologyManagerScope represents the scope of topology hint generation
   243  	// that topology manager requests and hint providers generate.
   244  	// Default: "container"
   245  	// +optional
   246  	TopologyManagerScope string
   247  	// TopologyManagerPolicyOptions is a set of key=value which allows to set extra options
   248  	// to fine tune the behaviour of the topology manager policies.
   249  	// Requires  both the "TopologyManager" and "TopologyManagerPolicyOptions" feature gates to be enabled.
   250  	TopologyManagerPolicyOptions map[string]string
   251  	// Map of QoS resource reservation percentages (memory only for now).
   252  	// Requires the QOSReserved feature gate to be enabled.
   253  	QOSReserved map[string]string
   254  	// runtimeRequestTimeout is the timeout for all runtime requests except long running
   255  	// requests - pull, logs, exec and attach.
   256  	RuntimeRequestTimeout metav1.Duration
   257  	// hairpinMode specifies how the Kubelet should configure the container
   258  	// bridge for hairpin packets.
   259  	// Setting this flag allows endpoints in a Service to loadbalance back to
   260  	// themselves if they should try to access their own Service. Values:
   261  	//   "promiscuous-bridge": make the container bridge promiscuous.
   262  	//   "hairpin-veth":       set the hairpin flag on container veth interfaces.
   263  	//   "none":               do nothing.
   264  	// Generally, one must set --hairpin-mode=hairpin-veth to achieve hairpin NAT,
   265  	// because promiscuous-bridge assumes the existence of a container bridge named cbr0.
   266  	HairpinMode string
   267  	// maxPods is the number of pods that can run on this Kubelet.
   268  	MaxPods int32
   269  	// The CIDR to use for pod IP addresses, only used in standalone mode.
   270  	// In cluster mode, this is obtained from the master.
   271  	PodCIDR string
   272  	// The maximum number of processes per pod.  If -1, the kubelet defaults to the node allocatable pid capacity.
   273  	PodPidsLimit int64
   274  	// ResolverConfig is the resolver configuration file used as the basis
   275  	// for the container DNS resolution configuration.
   276  	ResolverConfig string
   277  	// RunOnce causes the Kubelet to check the API server once for pods,
   278  	// run those in addition to the pods specified by static pod files, and exit.
   279  	RunOnce bool
   280  	// cpuCFSQuota enables CPU CFS quota enforcement for containers that
   281  	// specify CPU limits
   282  	CPUCFSQuota bool
   283  	// CPUCFSQuotaPeriod sets the CPU CFS quota period value, cpu.cfs_period_us, defaults to 100ms
   284  	CPUCFSQuotaPeriod metav1.Duration
   285  	// maxOpenFiles is Number of files that can be opened by Kubelet process.
   286  	MaxOpenFiles int64
   287  	// nodeStatusMaxImages caps the number of images reported in Node.Status.Images.
   288  	NodeStatusMaxImages int32
   289  	// contentType is contentType of requests sent to apiserver.
   290  	ContentType string
   291  	// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver
   292  	KubeAPIQPS int32
   293  	// kubeAPIBurst is the burst to allow while talking with kubernetes
   294  	// apiserver
   295  	KubeAPIBurst int32
   296  	// serializeImagePulls when enabled, tells the Kubelet to pull images one at a time.
   297  	SerializeImagePulls bool
   298  	// MaxParallelImagePulls sets the maximum number of image pulls in parallel.
   299  	MaxParallelImagePulls *int32
   300  	// Map of signal names to quantities that defines hard eviction thresholds. For example: {"memory.available": "300Mi"}.
   301  	// Some default signals are Linux only: nodefs.inodesFree
   302  	EvictionHard map[string]string
   303  	// Map of signal names to quantities that defines soft eviction thresholds.  For example: {"memory.available": "300Mi"}.
   304  	EvictionSoft map[string]string
   305  	// Map of signal names to quantities that defines grace periods for each soft eviction signal. For example: {"memory.available": "30s"}.
   306  	EvictionSoftGracePeriod map[string]string
   307  	// Duration for which the kubelet has to wait before transitioning out of an eviction pressure condition.
   308  	EvictionPressureTransitionPeriod metav1.Duration
   309  	// Maximum allowed grace period (in seconds) to use when terminating pods in response to a soft eviction threshold being met.
   310  	EvictionMaxPodGracePeriod int32
   311  	// Map of signal names to quantities that defines minimum reclaims, which describe the minimum
   312  	// amount of a given resource the kubelet will reclaim when performing a pod eviction while
   313  	// that resource is under pressure. For example: {"imagefs.available": "2Gi"}
   314  	EvictionMinimumReclaim map[string]string
   315  	// podsPerCore is the maximum number of pods per core. Cannot exceed MaxPods.
   316  	// If 0, this field is ignored.
   317  	PodsPerCore int32
   318  	// enableControllerAttachDetach enables the Attach/Detach controller to
   319  	// manage attachment/detachment of volumes scheduled to this node, and
   320  	// disables kubelet from executing any attach/detach operations
   321  	EnableControllerAttachDetach bool
   322  	// protectKernelDefaults, if true, causes the Kubelet to error if kernel
   323  	// flags are not as it expects. Otherwise the Kubelet will attempt to modify
   324  	// kernel flags to match its expectation.
   325  	ProtectKernelDefaults bool
   326  	// If true, Kubelet creates the KUBE-IPTABLES-HINT chain in iptables as a hint to
   327  	// other components about the configuration of iptables on the system.
   328  	MakeIPTablesUtilChains bool
   329  	// iptablesMasqueradeBit formerly controlled the creation of the KUBE-MARK-MASQ
   330  	// chain.
   331  	// Deprecated: no longer has any effect.
   332  	IPTablesMasqueradeBit int32
   333  	// iptablesDropBit formerly controlled the creation of the KUBE-MARK-DROP chain.
   334  	// Deprecated: no longer has any effect.
   335  	IPTablesDropBit int32
   336  	// featureGates is a map of feature names to bools that enable or disable alpha/experimental
   337  	// features. This field modifies piecemeal the built-in default values from
   338  	// "k8s.io/kubernetes/pkg/features/kube_features.go".
   339  	FeatureGates map[string]bool
   340  	// Tells the Kubelet to fail to start if swap is enabled on the node.
   341  	FailSwapOn bool
   342  	// memorySwap configures swap memory available to container workloads.
   343  	// +featureGate=NodeSwap
   344  	// +optional
   345  	MemorySwap MemorySwapConfiguration
   346  	// A quantity defines the maximum size of the container log file before it is rotated. For example: "5Mi" or "256Ki".
   347  	ContainerLogMaxSize string
   348  	// Maximum number of container log files that can be present for a container.
   349  	ContainerLogMaxFiles int32
   350  	// ConfigMapAndSecretChangeDetectionStrategy is a mode in which config map and secret managers are running.
   351  	ConfigMapAndSecretChangeDetectionStrategy ResourceChangeDetectionStrategy
   352  	// A comma separated allowlist of unsafe sysctls or sysctl patterns (ending in `*`).
   353  	// Unsafe sysctl groups are `kernel.shm*`, `kernel.msg*`, `kernel.sem`, `fs.mqueue.*`, and `net.*`.
   354  	// These sysctls are namespaced but not allowed by default.
   355  	// For example: "`kernel.msg*,net.ipv4.route.min_pmtu`"
   356  	// +optional
   357  	AllowedUnsafeSysctls []string
   358  	// kernelMemcgNotification if enabled, the kubelet will integrate with the kernel memcg
   359  	// notification to determine if memory eviction thresholds are crossed rather than polling.
   360  	KernelMemcgNotification bool
   361  
   362  	/* the following fields are meant for Node Allocatable */
   363  
   364  	// A set of ResourceName=ResourceQuantity (e.g. cpu=200m,memory=150G,ephemeral-storage=1G,pid=100) pairs
   365  	// that describe resources reserved for non-kubernetes components.
   366  	// Currently only cpu, memory and local ephemeral storage for root file system are supported.
   367  	// See http://kubernetes.io/docs/user-guide/compute-resources for more detail.
   368  	SystemReserved map[string]string
   369  	// A set of ResourceName=ResourceQuantity (e.g. cpu=200m,memory=150G,ephemeral-storage=1G,pid=100) pairs
   370  	// that describe resources reserved for kubernetes system components.
   371  	// Currently only cpu, memory and local ephemeral storage for root file system are supported.
   372  	// See http://kubernetes.io/docs/user-guide/compute-resources for more detail.
   373  	KubeReserved map[string]string
   374  	// This flag helps kubelet identify absolute name of top level cgroup used to enforce `SystemReserved` compute resource reservation for OS system daemons.
   375  	// Refer to [Node Allocatable](https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable) doc for more information.
   376  	SystemReservedCgroup string
   377  	// This flag helps kubelet identify absolute name of top level cgroup used to enforce `KubeReserved` compute resource reservation for Kubernetes node system daemons.
   378  	// Refer to [Node Allocatable](https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable) doc for more information.
   379  	KubeReservedCgroup string
   380  	// This flag specifies the various Node Allocatable enforcements that Kubelet needs to perform.
   381  	// This flag accepts a list of options. Acceptable options are `pods`, `system-reserved` & `kube-reserved`.
   382  	// Refer to [Node Allocatable](https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable) doc for more information.
   383  	EnforceNodeAllocatable []string
   384  	// This option specifies the cpu list reserved for the host level system threads and kubernetes related threads.
   385  	// This provide a "static" CPU list rather than the "dynamic" list by system-reserved and kube-reserved.
   386  	// This option overwrites CPUs provided by system-reserved and kube-reserved.
   387  	ReservedSystemCPUs string
   388  	// The previous version for which you want to show hidden metrics.
   389  	// Only the previous minor version is meaningful, other values will not be allowed.
   390  	// The format is <major>.<minor>, e.g.: '1.16'.
   391  	// The purpose of this format is make sure you have the opportunity to notice if the next release hides additional metrics,
   392  	// rather than being surprised when they are permanently removed in the release after that.
   393  	ShowHiddenMetricsForVersion string
   394  	// Logging specifies the options of logging.
   395  	// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
   396  	Logging logsapi.LoggingConfiguration
   397  	// EnableSystemLogHandler enables /logs handler.
   398  	EnableSystemLogHandler bool
   399  	// EnableSystemLogQuery enables the node log query feature on the /logs endpoint.
   400  	// EnableSystemLogHandler has to be enabled in addition for this feature to work.
   401  	// +featureGate=NodeLogQuery
   402  	// +optional
   403  	EnableSystemLogQuery bool
   404  	// ShutdownGracePeriod specifies the total duration that the node should delay the shutdown and total grace period for pod termination during a node shutdown.
   405  	// Defaults to 0 seconds.
   406  	// +featureGate=GracefulNodeShutdown
   407  	// +optional
   408  	ShutdownGracePeriod metav1.Duration
   409  	// ShutdownGracePeriodCriticalPods specifies the duration used to terminate critical pods during a node shutdown. This should be less than ShutdownGracePeriod.
   410  	// Defaults to 0 seconds.
   411  	// For example, if ShutdownGracePeriod=30s, and ShutdownGracePeriodCriticalPods=10s, during a node shutdown the first 20 seconds would be reserved for gracefully terminating normal pods, and the last 10 seconds would be reserved for terminating critical pods.
   412  	// +featureGate=GracefulNodeShutdown
   413  	// +optional
   414  	ShutdownGracePeriodCriticalPods metav1.Duration
   415  	// ShutdownGracePeriodByPodPriority specifies the shutdown grace period for Pods based
   416  	// on their associated priority class value.
   417  	// When a shutdown request is received, the Kubelet will initiate shutdown on all pods
   418  	// running on the node with a grace period that depends on the priority of the pod,
   419  	// and then wait for all pods to exit.
   420  	// Each entry in the array represents the graceful shutdown time a pod with a priority
   421  	// class value that lies in the range of that value and the next higher entry in the
   422  	// list when the node is shutting down.
   423  	ShutdownGracePeriodByPodPriority []ShutdownGracePeriodByPodPriority
   424  	// ReservedMemory specifies a comma-separated list of memory reservations for NUMA nodes.
   425  	// The parameter makes sense only in the context of the memory manager feature. The memory manager will not allocate reserved memory for container workloads.
   426  	// For example, if you have a NUMA0 with 10Gi of memory and the ReservedMemory was specified to reserve 1Gi of memory at NUMA0,
   427  	// the memory manager will assume that only 9Gi is available for allocation.
   428  	// You can specify a different amount of NUMA node and memory types.
   429  	// You can omit this parameter at all, but you should be aware that the amount of reserved memory from all NUMA nodes
   430  	// should be equal to the amount of memory specified by the node allocatable features(https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable).
   431  	// If at least one node allocatable parameter has a non-zero value, you will need to specify at least one NUMA node.
   432  	// Also, avoid specifying:
   433  	// 1. Duplicates, the same NUMA node, and memory type, but with a different value.
   434  	// 2. zero limits for any memory type.
   435  	// 3. NUMAs nodes IDs that do not exist under the machine.
   436  	// 4. memory types except for memory and hugepages-<size>
   437  	ReservedMemory []MemoryReservation
   438  	// EnableProfiling enables /debug/pprof handler.
   439  	EnableProfilingHandler bool
   440  	// EnableDebugFlagsHandler enables/debug/flags/v handler.
   441  	EnableDebugFlagsHandler bool
   442  	// SeccompDefault enables the use of `RuntimeDefault` as the default seccomp profile for all workloads.
   443  	SeccompDefault bool
   444  	// MemoryThrottlingFactor specifies the factor multiplied by the memory limit or node allocatable memory
   445  	// when setting the cgroupv2 memory.high value to enforce MemoryQoS.
   446  	// Decreasing this factor will set lower high limit for container cgroups and put heavier reclaim pressure
   447  	// while increasing will put less reclaim pressure.
   448  	// See https://kep.k8s.io/2570 for more details.
   449  	// Default: 0.9
   450  	// +featureGate=MemoryQoS
   451  	// +optional
   452  	MemoryThrottlingFactor *float64
   453  	// registerWithTaints are an array of taints to add to a node object when
   454  	// the kubelet registers itself. This only takes effect when registerNode
   455  	// is true and upon the initial registration of the node.
   456  	// +optional
   457  	RegisterWithTaints []v1.Taint
   458  	// registerNode enables automatic registration with the apiserver.
   459  	// +optional
   460  	RegisterNode bool
   461  
   462  	// Tracing specifies the versioned configuration for OpenTelemetry tracing clients.
   463  	// See https://kep.k8s.io/2832 for more details.
   464  	// +featureGate=KubeletTracing
   465  	// +optional
   466  	Tracing *tracingapi.TracingConfiguration
   467  
   468  	// LocalStorageCapacityIsolation enables local ephemeral storage isolation feature. The default setting is true.
   469  	// This feature allows users to set request/limit for container's ephemeral storage and manage it in a similar way
   470  	// as cpu and memory. It also allows setting sizeLimit for emptyDir volume, which will trigger pod eviction if disk
   471  	// usage from the volume exceeds the limit.
   472  	// This feature depends on the capability of detecting correct root file system disk usage. For certain systems,
   473  	// such as kind rootless, if this capability cannot be supported, the feature LocalStorageCapacityIsolation should be
   474  	// disabled. Once disabled, user should not set request/limit for container's ephemeral storage, or sizeLimit for emptyDir.
   475  	// +optional
   476  	LocalStorageCapacityIsolation bool
   477  
   478  	// ContainerRuntimeEndpoint is the endpoint of container runtime.
   479  	// unix domain sockets supported on Linux while npipes and tcp endpoints are supported for windows.
   480  	// Examples:'unix:///path/to/runtime.sock', 'npipe:////./pipe/runtime'
   481  	ContainerRuntimeEndpoint string
   482  
   483  	// ImageServiceEndpoint is the endpoint of container image service.
   484  	// If not specified the default value is ContainerRuntimeEndpoint
   485  	// +optional
   486  	ImageServiceEndpoint string
   487  }
   488  
   489  // KubeletAuthorizationMode denotes the authorization mode for the kubelet
   490  type KubeletAuthorizationMode string
   491  
   492  const (
   493  	// KubeletAuthorizationModeAlwaysAllow authorizes all authenticated requests
   494  	KubeletAuthorizationModeAlwaysAllow KubeletAuthorizationMode = "AlwaysAllow"
   495  	// KubeletAuthorizationModeWebhook uses the SubjectAccessReview API to determine authorization
   496  	KubeletAuthorizationModeWebhook KubeletAuthorizationMode = "Webhook"
   497  )
   498  
   499  // KubeletAuthorization holds the state related to the authorization in the kublet.
   500  type KubeletAuthorization struct {
   501  	// mode is the authorization mode to apply to requests to the kubelet server.
   502  	// Valid values are AlwaysAllow and Webhook.
   503  	// Webhook mode uses the SubjectAccessReview API to determine authorization.
   504  	Mode KubeletAuthorizationMode
   505  
   506  	// webhook contains settings related to Webhook authorization.
   507  	Webhook KubeletWebhookAuthorization
   508  }
   509  
   510  // KubeletWebhookAuthorization holds the state related to the Webhook
   511  // Authorization in the Kubelet.
   512  type KubeletWebhookAuthorization struct {
   513  	// cacheAuthorizedTTL is the duration to cache 'authorized' responses from the webhook authorizer.
   514  	CacheAuthorizedTTL metav1.Duration
   515  	// cacheUnauthorizedTTL is the duration to cache 'unauthorized' responses from the webhook authorizer.
   516  	CacheUnauthorizedTTL metav1.Duration
   517  }
   518  
   519  // KubeletAuthentication holds the Kubetlet Authentication setttings.
   520  type KubeletAuthentication struct {
   521  	// x509 contains settings related to x509 client certificate authentication
   522  	X509 KubeletX509Authentication
   523  	// webhook contains settings related to webhook bearer token authentication
   524  	Webhook KubeletWebhookAuthentication
   525  	// anonymous contains settings related to anonymous authentication
   526  	Anonymous KubeletAnonymousAuthentication
   527  }
   528  
   529  // KubeletX509Authentication contains settings related to x509 client certificate authentication
   530  type KubeletX509Authentication struct {
   531  	// clientCAFile is the path to a PEM-encoded certificate bundle. If set, any request presenting a client certificate
   532  	// signed by one of the authorities in the bundle is authenticated with a username corresponding to the CommonName,
   533  	// and groups corresponding to the Organization in the client certificate.
   534  	ClientCAFile string
   535  }
   536  
   537  // KubeletWebhookAuthentication contains settings related to webhook authentication
   538  type KubeletWebhookAuthentication struct {
   539  	// enabled allows bearer token authentication backed by the tokenreviews.authentication.k8s.io API
   540  	Enabled bool
   541  	// cacheTTL enables caching of authentication results
   542  	CacheTTL metav1.Duration
   543  }
   544  
   545  // KubeletAnonymousAuthentication enables anonymous requests to the kubelet server.
   546  type KubeletAnonymousAuthentication struct {
   547  	// enabled allows anonymous requests to the kubelet server.
   548  	// Requests that are not rejected by another authentication method are treated as anonymous requests.
   549  	// Anonymous requests have a username of system:anonymous, and a group name of system:unauthenticated.
   550  	Enabled bool
   551  }
   552  
   553  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   554  
   555  // SerializedNodeConfigSource allows us to serialize NodeConfigSource
   556  // This type is used internally by the Kubelet for tracking checkpointed dynamic configs.
   557  // It exists in the kubeletconfig API group because it is classified as a versioned input to the Kubelet.
   558  type SerializedNodeConfigSource struct {
   559  	metav1.TypeMeta
   560  	// Source is the source that we are serializing
   561  	// +optional
   562  	Source v1.NodeConfigSource
   563  }
   564  
   565  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   566  
   567  // CredentialProviderConfig is the configuration containing information about
   568  // each exec credential provider. Kubelet reads this configuration from disk and enables
   569  // each provider as specified by the CredentialProvider type.
   570  type CredentialProviderConfig struct {
   571  	metav1.TypeMeta
   572  
   573  	// providers is a list of credential provider plugins that will be enabled by the kubelet.
   574  	// Multiple providers may match against a single image, in which case credentials
   575  	// from all providers will be returned to the kubelet. If multiple providers are called
   576  	// for a single image, the results are combined. If providers return overlapping
   577  	// auth keys, the value from the provider earlier in this list is used.
   578  	Providers []CredentialProvider
   579  }
   580  
   581  // CredentialProvider represents an exec plugin to be invoked by the kubelet. The plugin is only
   582  // invoked when an image being pulled matches the images handled by the plugin (see matchImages).
   583  type CredentialProvider struct {
   584  	// name is the required name of the credential provider. It must match the name of the
   585  	// provider executable as seen by the kubelet. The executable must be in the kubelet's
   586  	// bin directory (set by the --credential-provider-bin-dir flag).
   587  	Name string
   588  
   589  	// matchImages is a required list of strings used to match against images in order to
   590  	// determine if this provider should be invoked. If one of the strings matches the
   591  	// requested image from the kubelet, the plugin will be invoked and given a chance
   592  	// to provide credentials. Images are expected to contain the registry domain
   593  	// and URL path.
   594  	//
   595  	// Each entry in matchImages is a pattern which can optionally contain a port and a path.
   596  	// Globs can be used in the domain, but not in the port or the path. Globs are supported
   597  	// as subdomains like `*.k8s.io` or `k8s.*.io`, and top-level-domains such as `k8s.*`.
   598  	// Matching partial subdomains like `app*.k8s.io` is also supported. Each glob can only match
   599  	// a single subdomain segment, so `*.io` does not match *.k8s.io.
   600  	//
   601  	// A match exists between an image and a matchImage when all of the below are true:
   602  	// - Both contain the same number of domain parts and each part matches.
   603  	// - The URL path of an imageMatch must be a prefix of the target image URL path.
   604  	// - If the imageMatch contains a port, then the port must match in the image as well.
   605  	//
   606  	// Example values of matchImages:
   607  	//   - `123456789.dkr.ecr.us-east-1.amazonaws.com`
   608  	//   - `*.azurecr.io`
   609  	//   - `gcr.io`
   610  	//   - `*.*.registry.io`
   611  	//   - `registry.io:8080/path`
   612  	MatchImages []string
   613  
   614  	// defaultCacheDuration is the default duration the plugin will cache credentials in-memory
   615  	// if a cache duration is not provided in the plugin response. This field is required.
   616  	DefaultCacheDuration *metav1.Duration
   617  
   618  	// Required input version of the exec CredentialProviderRequest. The returned CredentialProviderResponse
   619  	// MUST use the same encoding version as the input. Current supported values are:
   620  	// - credentialprovider.kubelet.k8s.io/v1alpha1
   621  	// - credentialprovider.kubelet.k8s.io/v1beta1
   622  	// - credentialprovider.kubelet.k8s.io/v1
   623  	APIVersion string
   624  
   625  	// Arguments to pass to the command when executing it.
   626  	// +optional
   627  	Args []string
   628  
   629  	// Env defines additional environment variables to expose to the process. These
   630  	// are unioned with the host's environment, as well as variables client-go uses
   631  	// to pass argument to the plugin.
   632  	// +optional
   633  	Env []ExecEnvVar
   634  }
   635  
   636  // ExecEnvVar is used for setting environment variables when executing an exec-based
   637  // credential plugin.
   638  type ExecEnvVar struct {
   639  	Name  string
   640  	Value string
   641  }
   642  
   643  // MemoryReservation specifies the memory reservation of different types for each NUMA node
   644  type MemoryReservation struct {
   645  	NumaNode int32
   646  	Limits   v1.ResourceList
   647  }
   648  
   649  // ShutdownGracePeriodByPodPriority specifies the shutdown grace period for Pods based on their associated priority class value
   650  type ShutdownGracePeriodByPodPriority struct {
   651  	// priority is the priority value associated with the shutdown grace period
   652  	Priority int32
   653  	// shutdownGracePeriodSeconds is the shutdown grace period in seconds
   654  	ShutdownGracePeriodSeconds int64
   655  }
   656  
   657  type MemorySwapConfiguration struct {
   658  	// swapBehavior configures swap memory available to container workloads. May be one of
   659  	// "", "LimitedSwap": workload combined memory and swap usage cannot exceed pod memory limit
   660  	// "UnlimitedSwap": workloads can use unlimited swap, up to the allocatable limit.
   661  	// +featureGate=NodeSwap
   662  	// +optional
   663  	SwapBehavior string
   664  }