diff --git a/machineconfiguration/v1/tests/kubeletconfigs.machineconfiguration.openshift.io/KubeletConfigSpec.yaml b/machineconfiguration/v1/tests/kubeletconfigs.machineconfiguration.openshift.io/KubeletConfigSpec.yaml new file mode 100644 index 00000000000..c753b86e442 --- /dev/null +++ b/machineconfiguration/v1/tests/kubeletconfigs.machineconfiguration.openshift.io/KubeletConfigSpec.yaml @@ -0,0 +1,276 @@ +apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this +name: "KubeletConfig" +crdName: kubeletconfigs.machineconfiguration.openshift.io +tests: + onCreate: + # AutoSizingReserved tests + - name: Should be able to set autoSizingReserved to true + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: true + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: true + - name: Should be able to set autoSizingReserved to false + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: false + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: false + - name: Should be able to omit autoSizingReserved + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + + # LogLevel tests + - name: Should be able to set logLevel to 2 + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + logLevel: 2 + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + logLevel: 2 + - name: Should be able to set logLevel to 4 + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + logLevel: 4 + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + logLevel: 4 + - name: Should be able to omit logLevel + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + + # MachineConfigPoolSelector tests + - name: Should be able to set machineConfigPoolSelector for worker pool + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + machineConfigPoolSelector: + matchLabels: + pools.operator.machineconfiguration.openshift.io/worker: "" + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + machineConfigPoolSelector: + matchLabels: + pools.operator.machineconfiguration.openshift.io/worker: "" + - name: Should be able to set machineConfigPoolSelector for master pool + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + machineConfigPoolSelector: + matchLabels: + pools.operator.machineconfiguration.openshift.io/master: "" + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + machineConfigPoolSelector: + matchLabels: + pools.operator.machineconfiguration.openshift.io/master: "" + - name: Should be able to omit machineConfigPoolSelector + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + + # KubeletConfig tests + - name: Should be able to set kubeletConfig with maxPods + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + kubeletConfig: + maxPods: 250 + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + kubeletConfig: + maxPods: 250 + - name: Should be able to omit kubeletConfig + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + + # Combined fields tests + - name: Should be able to set multiple fields together + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: true + logLevel: 2 + machineConfigPoolSelector: + matchLabels: + pools.operator.machineconfiguration.openshift.io/worker: "" + kubeletConfig: + maxPods: 250 + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: true + logLevel: 2 + machineConfigPoolSelector: + matchLabels: + pools.operator.machineconfiguration.openshift.io/worker: "" + kubeletConfig: + maxPods: 250 + + onUpdate: + # AutoSizingReserved update tests + - name: Should be able to update autoSizingReserved from true to false + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: true + updated: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: false + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: false + - name: Should be able to update autoSizingReserved from false to true + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: false + updated: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: true + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: true + + # LogLevel update tests + - name: Should be able to update logLevel from 2 to 4 + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + logLevel: 2 + updated: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + logLevel: 4 + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + logLevel: 4 + - name: Should be able to remove logLevel + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + logLevel: 2 + updated: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: {} + + # MachineConfigPoolSelector update tests + - name: Should be able to update machineConfigPoolSelector from worker to master + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + machineConfigPoolSelector: + matchLabels: + pools.operator.machineconfiguration.openshift.io/worker: "" + updated: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + machineConfigPoolSelector: + matchLabels: + pools.operator.machineconfiguration.openshift.io/master: "" + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + machineConfigPoolSelector: + matchLabels: + pools.operator.machineconfiguration.openshift.io/master: "" + + # Combined update tests + - name: Should be able to update multiple fields together + initial: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: false + logLevel: 2 + updated: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: true + logLevel: 4 + kubeletConfig: + maxPods: 250 + expected: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + spec: + autoSizingReserved: true + logLevel: 4 + kubeletConfig: + maxPods: 250 diff --git a/machineconfiguration/v1/types.go b/machineconfiguration/v1/types.go index 6673adeb1b2..60a5874dd6e 100644 --- a/machineconfiguration/v1/types.go +++ b/machineconfiguration/v1/types.go @@ -737,27 +737,33 @@ type KubeletConfig struct { Status KubeletConfigStatus `json:"status"` } -// KubeletConfigSpec defines the desired state of KubeletConfig +// KubeletConfigSpec configures the kubelet running on cluster nodes. type KubeletConfigSpec struct { + // autoSizingReserved controls whether system-reserved CPU and memory are automatically + // calculated based on each node's installed capacity. When enabled, prevents node failure + // from resource starvation of system components (kubelet, CRI-O) without manual configuration. + // When unset or true, automatic sizing is enabled. Set to false to disable and use manual settings. // +optional AutoSizingReserved *bool `json:"autoSizingReserved,omitempty"` + // logLevel sets the kubelet log verbosity. Higher values increase log detail. + // Defaults to 2 if unset. // +optional LogLevel *int32 `json:"logLevel,omitempty"` - // machineConfigPoolSelector selects which pools the KubeletConfig shoud apply to. - // A nil selector will result in no pools being selected. + // machineConfigPoolSelector selects which pools the KubeletConfig should apply to. + // A nil selector results in no pools being selected. // +optional MachineConfigPoolSelector *metav1.LabelSelector `json:"machineConfigPoolSelector,omitempty"` - // kubeletConfig fields are defined in kubernetes upstream. Please refer to the types defined in the version/commit used by - // OpenShift of the upstream kubernetes. It's important to note that, since the fields of the kubelet configuration are directly fetched from - // upstream the validation of those values is handled directly by the kubelet. Please refer to the upstream version of the relevant kubernetes - // for the valid values of these fields. Invalid values of the kubelet configuration fields may render cluster nodes unusable. + // kubeletConfig contains upstream Kubernetes kubelet configuration fields. + // Values are validated by the kubelet itself. Invalid values may render nodes unusable. + // Refer to OpenShift documentation for the Kubernetes version corresponding to your + // OpenShift release to find valid kubelet configuration options. // +optional KubeletConfig *runtime.RawExtension `json:"kubeletConfig,omitempty"` - // If unset, the default is based on the apiservers.config.openshift.io/cluster resource. - // Note that only Old and Intermediate profiles are currently supported, and - // the maximum available minTLSVersion is VersionTLS12. + // tlsSecurityProfile configures TLS settings for the kubelet. + // If unset, defaults to the apiservers.config.openshift.io/cluster resource. + // Only Old and Intermediate profiles are supported; maximum minTLSVersion is VersionTLS12. // +optional TLSSecurityProfile *configv1.TLSSecurityProfile `json:"tlsSecurityProfile,omitempty"` } diff --git a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_kubeletconfigs.crd.yaml b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_kubeletconfigs.crd.yaml index 5d68283c596..4569b929240 100644 --- a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_kubeletconfigs.crd.yaml +++ b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_kubeletconfigs.crd.yaml @@ -47,22 +47,30 @@ spec: description: spec contains the desired kubelet configuration. properties: autoSizingReserved: + description: |- + autoSizingReserved controls whether system-reserved CPU and memory are automatically + calculated based on each node's installed capacity. When enabled, prevents node failure + from resource starvation of system components (kubelet, CRI-O) without manual configuration. + When unset or true, automatic sizing is enabled. Set to false to disable and use manual settings. type: boolean kubeletConfig: description: |- - kubeletConfig fields are defined in kubernetes upstream. Please refer to the types defined in the version/commit used by - OpenShift of the upstream kubernetes. It's important to note that, since the fields of the kubelet configuration are directly fetched from - upstream the validation of those values is handled directly by the kubelet. Please refer to the upstream version of the relevant kubernetes - for the valid values of these fields. Invalid values of the kubelet configuration fields may render cluster nodes unusable. + kubeletConfig contains upstream Kubernetes kubelet configuration fields. + Values are validated by the kubelet itself. Invalid values may render nodes unusable. + Refer to OpenShift documentation for the Kubernetes version corresponding to your + OpenShift release to find valid kubelet configuration options. type: object x-kubernetes-preserve-unknown-fields: true logLevel: + description: |- + logLevel sets the kubelet log verbosity. Higher values increase log detail. + Defaults to 2 if unset. format: int32 type: integer machineConfigPoolSelector: description: |- - machineConfigPoolSelector selects which pools the KubeletConfig shoud apply to. - A nil selector will result in no pools being selected. + machineConfigPoolSelector selects which pools the KubeletConfig should apply to. + A nil selector results in no pools being selected. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. @@ -109,9 +117,9 @@ spec: x-kubernetes-map-type: atomic tlsSecurityProfile: description: |- - If unset, the default is based on the apiservers.config.openshift.io/cluster resource. - Note that only Old and Intermediate profiles are currently supported, and - the maximum available minTLSVersion is VersionTLS12. + tlsSecurityProfile configures TLS settings for the kubelet. + If unset, defaults to the apiservers.config.openshift.io/cluster resource. + Only Old and Intermediate profiles are supported; maximum minTLSVersion is VersionTLS12. properties: custom: description: |- diff --git a/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/kubeletconfigs.machineconfiguration.openshift.io/AAA_ungated.yaml b/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/kubeletconfigs.machineconfiguration.openshift.io/AAA_ungated.yaml index 1c527d3c9f8..43db169d42b 100644 --- a/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/kubeletconfigs.machineconfiguration.openshift.io/AAA_ungated.yaml +++ b/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/kubeletconfigs.machineconfiguration.openshift.io/AAA_ungated.yaml @@ -48,22 +48,30 @@ spec: description: spec contains the desired kubelet configuration. properties: autoSizingReserved: + description: |- + autoSizingReserved controls whether system-reserved CPU and memory are automatically + calculated based on each node's installed capacity. When enabled, prevents node failure + from resource starvation of system components (kubelet, CRI-O) without manual configuration. + When unset or true, automatic sizing is enabled. Set to false to disable and use manual settings. type: boolean kubeletConfig: description: |- - kubeletConfig fields are defined in kubernetes upstream. Please refer to the types defined in the version/commit used by - OpenShift of the upstream kubernetes. It's important to note that, since the fields of the kubelet configuration are directly fetched from - upstream the validation of those values is handled directly by the kubelet. Please refer to the upstream version of the relevant kubernetes - for the valid values of these fields. Invalid values of the kubelet configuration fields may render cluster nodes unusable. + kubeletConfig contains upstream Kubernetes kubelet configuration fields. + Values are validated by the kubelet itself. Invalid values may render nodes unusable. + Refer to OpenShift documentation for the Kubernetes version corresponding to your + OpenShift release to find valid kubelet configuration options. type: object x-kubernetes-preserve-unknown-fields: true logLevel: + description: |- + logLevel sets the kubelet log verbosity. Higher values increase log detail. + Defaults to 2 if unset. format: int32 type: integer machineConfigPoolSelector: description: |- - machineConfigPoolSelector selects which pools the KubeletConfig shoud apply to. - A nil selector will result in no pools being selected. + machineConfigPoolSelector selects which pools the KubeletConfig should apply to. + A nil selector results in no pools being selected. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. @@ -110,9 +118,9 @@ spec: x-kubernetes-map-type: atomic tlsSecurityProfile: description: |- - If unset, the default is based on the apiservers.config.openshift.io/cluster resource. - Note that only Old and Intermediate profiles are currently supported, and - the maximum available minTLSVersion is VersionTLS12. + tlsSecurityProfile configures TLS settings for the kubelet. + If unset, defaults to the apiservers.config.openshift.io/cluster resource. + Only Old and Intermediate profiles are supported; maximum minTLSVersion is VersionTLS12. properties: custom: description: |- diff --git a/machineconfiguration/v1/zz_generated.swagger_doc_generated.go b/machineconfiguration/v1/zz_generated.swagger_doc_generated.go index 650fc1709da..c953245f972 100644 --- a/machineconfiguration/v1/zz_generated.swagger_doc_generated.go +++ b/machineconfiguration/v1/zz_generated.swagger_doc_generated.go @@ -214,10 +214,12 @@ func (KubeletConfigList) SwaggerDoc() map[string]string { } var map_KubeletConfigSpec = map[string]string{ - "": "KubeletConfigSpec defines the desired state of KubeletConfig", - "machineConfigPoolSelector": "machineConfigPoolSelector selects which pools the KubeletConfig shoud apply to. A nil selector will result in no pools being selected.", - "kubeletConfig": "kubeletConfig fields are defined in kubernetes upstream. Please refer to the types defined in the version/commit used by OpenShift of the upstream kubernetes. It's important to note that, since the fields of the kubelet configuration are directly fetched from upstream the validation of those values is handled directly by the kubelet. Please refer to the upstream version of the relevant kubernetes for the valid values of these fields. Invalid values of the kubelet configuration fields may render cluster nodes unusable.", - "tlsSecurityProfile": "If unset, the default is based on the apiservers.config.openshift.io/cluster resource. Note that only Old and Intermediate profiles are currently supported, and the maximum available minTLSVersion is VersionTLS12.", + "": "KubeletConfigSpec configures the kubelet running on cluster nodes.", + "autoSizingReserved": "autoSizingReserved controls whether system-reserved CPU and memory are automatically calculated based on each node's installed capacity. When enabled, prevents node failure from resource starvation of system components (kubelet, CRI-O) without manual configuration. When unset or true, automatic sizing is enabled. Set to false to disable and use manual settings.", + "logLevel": "logLevel sets the kubelet log verbosity. Higher values increase log detail. Defaults to 2 if unset.", + "machineConfigPoolSelector": "machineConfigPoolSelector selects which pools the KubeletConfig should apply to. A nil selector results in no pools being selected.", + "kubeletConfig": "kubeletConfig contains upstream Kubernetes kubelet configuration fields. Values are validated by the kubelet itself. Invalid values may render nodes unusable. Refer to OpenShift documentation for the Kubernetes version corresponding to your OpenShift release to find valid kubelet configuration options.", + "tlsSecurityProfile": "tlsSecurityProfile configures TLS settings for the kubelet. If unset, defaults to the apiservers.config.openshift.io/cluster resource. Only Old and Intermediate profiles are supported; maximum minTLSVersion is VersionTLS12.", } func (KubeletConfigSpec) SwaggerDoc() map[string]string { diff --git a/payload-manifests/crds/0000_80_machine-config_01_kubeletconfigs.crd.yaml b/payload-manifests/crds/0000_80_machine-config_01_kubeletconfigs.crd.yaml index 5d68283c596..4569b929240 100644 --- a/payload-manifests/crds/0000_80_machine-config_01_kubeletconfigs.crd.yaml +++ b/payload-manifests/crds/0000_80_machine-config_01_kubeletconfigs.crd.yaml @@ -47,22 +47,30 @@ spec: description: spec contains the desired kubelet configuration. properties: autoSizingReserved: + description: |- + autoSizingReserved controls whether system-reserved CPU and memory are automatically + calculated based on each node's installed capacity. When enabled, prevents node failure + from resource starvation of system components (kubelet, CRI-O) without manual configuration. + When unset or true, automatic sizing is enabled. Set to false to disable and use manual settings. type: boolean kubeletConfig: description: |- - kubeletConfig fields are defined in kubernetes upstream. Please refer to the types defined in the version/commit used by - OpenShift of the upstream kubernetes. It's important to note that, since the fields of the kubelet configuration are directly fetched from - upstream the validation of those values is handled directly by the kubelet. Please refer to the upstream version of the relevant kubernetes - for the valid values of these fields. Invalid values of the kubelet configuration fields may render cluster nodes unusable. + kubeletConfig contains upstream Kubernetes kubelet configuration fields. + Values are validated by the kubelet itself. Invalid values may render nodes unusable. + Refer to OpenShift documentation for the Kubernetes version corresponding to your + OpenShift release to find valid kubelet configuration options. type: object x-kubernetes-preserve-unknown-fields: true logLevel: + description: |- + logLevel sets the kubelet log verbosity. Higher values increase log detail. + Defaults to 2 if unset. format: int32 type: integer machineConfigPoolSelector: description: |- - machineConfigPoolSelector selects which pools the KubeletConfig shoud apply to. - A nil selector will result in no pools being selected. + machineConfigPoolSelector selects which pools the KubeletConfig should apply to. + A nil selector results in no pools being selected. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. @@ -109,9 +117,9 @@ spec: x-kubernetes-map-type: atomic tlsSecurityProfile: description: |- - If unset, the default is based on the apiservers.config.openshift.io/cluster resource. - Note that only Old and Intermediate profiles are currently supported, and - the maximum available minTLSVersion is VersionTLS12. + tlsSecurityProfile configures TLS settings for the kubelet. + If unset, defaults to the apiservers.config.openshift.io/cluster resource. + Only Old and Intermediate profiles are supported; maximum minTLSVersion is VersionTLS12. properties: custom: description: |-