From ffeff338776812840c4015c3a7cf2273442a62a5 Mon Sep 17 00:00:00 2001 From: Sohan Kunkerkar Date: Fri, 10 Jan 2025 16:55:46 -0500 Subject: [PATCH] machineconfiguration: add dropInDir details for KubeletConfigSpec Signed-off-by: Sohan Kunkerkar Signed-off-by: andrei --- features.md | 1 + features/features.go | 8 +++++++ machineconfiguration/v1/types.go | 22 +++++++++++++++++ ..._machine-config_01_kubeletconfigs.crd.yaml | 24 +++++++++++++++++++ .../v1/zz_generated.deepcopy.go | 22 +++++++++++++++++ .../AAA_ungated.yaml | 24 +++++++++++++++++++ .../v1/zz_generated.swagger_doc_generated.go | 12 ++++++++++ ..._machine-config_01_kubeletconfigs.crd.yaml | 24 +++++++++++++++++++ .../featureGate-Hypershift-Default.yaml | 3 +++ ...reGate-Hypershift-DevPreviewNoUpgrade.yaml | 3 +++ ...eGate-Hypershift-TechPreviewNoUpgrade.yaml | 3 +++ .../featureGate-SelfManagedHA-Default.yaml | 3 +++ ...ate-SelfManagedHA-DevPreviewNoUpgrade.yaml | 3 +++ ...te-SelfManagedHA-TechPreviewNoUpgrade.yaml | 3 +++ 14 files changed, 155 insertions(+) diff --git a/features.md b/features.md index fb7278d3b86..944681e2489 100644 --- a/features.md +++ b/features.md @@ -43,6 +43,7 @@ | InsightsOnDemandDataGather| | | Enabled | Enabled | Enabled | Enabled | | InsightsRuntimeExtractor| | | Enabled | Enabled | Enabled | Enabled | | KMSEncryptionProvider| | | Enabled | Enabled | Enabled | Enabled | +| KubeletConfigDropInDir| | | Enabled | Enabled | Enabled | Enabled | | MachineAPIMigration| | | Enabled | Enabled | Enabled | Enabled | | ManagedBootImagesAzure| | | Enabled | Enabled | Enabled | Enabled | | ManagedBootImagesvSphere| | | Enabled | Enabled | Enabled | Enabled | diff --git a/features/features.go b/features/features.go index 835c4b305f9..dac9cf0ec41 100644 --- a/features/features.go +++ b/features/features.go @@ -701,6 +701,14 @@ var ( enhancementPR("https://github.com/openshift/enhancements/pull/1697"). mustRegister() + FeatureGateKubeletConfigDropInDir = newFeatureGate("KubeletConfigDropInDir"). + reportProblemsToJiraComponent("Node"). + contactPerson("sohankunkerkar"). + productScope(ocpSpecific). + enableIn(configv1.DevPreviewNoUpgrade, configv1.TechPreviewNoUpgrade). + enhancementPR("https://github.com/kubernetes/enhancements/issues/3983"). + mustRegister() + FeatureGateNutanixMultiSubnets = newFeatureGate("NutanixMultiSubnets"). reportProblemsToJiraComponent("Cloud Compute / Nutanix Provider"). contactPerson("yanhli"). diff --git a/machineconfiguration/v1/types.go b/machineconfiguration/v1/types.go index 5ba1b9d59a6..cfda4061a74 100644 --- a/machineconfiguration/v1/types.go +++ b/machineconfiguration/v1/types.go @@ -709,6 +709,7 @@ type KubeletConfigSpec struct { // A nil selector will result 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 @@ -721,6 +722,27 @@ type KubeletConfigSpec struct { // the maximum available minTLSVersion is VersionTLS12. // +optional TLSSecurityProfile *configv1.TLSSecurityProfile `json:"tlsSecurityProfile,omitempty"` + + // dropInConfig allows users to define a drop-in configuration for Kubelet. + // +optional + DropInConfig *KubeletDropInDirConfigDetails `json:"dropInConfig,omitempty"` +} + +// KubeletDropInDirConfigDetails defines the details for Kubelet drop-in configuration. +type KubeletDropInDirConfigDetails struct { + // ConfigDirectory allows users to define a directory for Kubelet's drop-in configuration. + // This enables incremental configuration updates without modifying the main KubeletConfig. + // +required + ConfigDirectory string `json:"configDirectory"` + + // ConfigFile defines a specific configuration file within the drop-in directory. + // +required + ConfigFile string `json:"configFile"` + + // KubeletConfig fields are defined in Kubernetes upstream. This must be set if DropInConfigDirectory + // and DropInConfigFile are provided. + // +required + KubeletConfig runtime.RawExtension `json:"kubeletConfig"` } // KubeletConfigStatus defines the observed state of a KubeletConfig 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 b056dc99c17..ca079cee99c 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 @@ -48,6 +48,30 @@ spec: properties: autoSizingReserved: type: boolean + dropInConfig: + description: dropInConfig allows users to define a drop-in configuration + for Kubelet. + properties: + configDirectory: + description: |- + ConfigDirectory allows users to define a directory for Kubelet's drop-in configuration. + This enables incremental configuration updates without modifying the main KubeletConfig. + type: string + configFile: + description: ConfigFile defines a specific configuration file + within the drop-in directory. + type: string + kubeletConfig: + description: |- + KubeletConfig fields are defined in Kubernetes upstream. This must be set if DropInConfigDirectory + and DropInConfigFile are provided. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - configDirectory + - configFile + - kubeletConfig + type: object kubeletConfig: description: |- kubeletConfig fields are defined in kubernetes upstream. Please refer to the types defined in the version/commit used by diff --git a/machineconfiguration/v1/zz_generated.deepcopy.go b/machineconfiguration/v1/zz_generated.deepcopy.go index f153cc02378..8202f26e3dd 100644 --- a/machineconfiguration/v1/zz_generated.deepcopy.go +++ b/machineconfiguration/v1/zz_generated.deepcopy.go @@ -553,6 +553,11 @@ func (in *KubeletConfigSpec) DeepCopyInto(out *KubeletConfigSpec) { *out = new(configv1.TLSSecurityProfile) (*in).DeepCopyInto(*out) } + if in.DropInConfig != nil { + in, out := &in.DropInConfig, &out.DropInConfig + *out = new(KubeletDropInDirConfigDetails) + (*in).DeepCopyInto(*out) + } return } @@ -589,6 +594,23 @@ func (in *KubeletConfigStatus) DeepCopy() *KubeletConfigStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeletDropInDirConfigDetails) DeepCopyInto(out *KubeletDropInDirConfigDetails) { + *out = *in + in.KubeletConfig.DeepCopyInto(&out.KubeletConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeletDropInDirConfigDetails. +func (in *KubeletDropInDirConfigDetails) DeepCopy() *KubeletDropInDirConfigDetails { + if in == nil { + return nil + } + out := new(KubeletDropInDirConfigDetails) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MCOObjectReference) DeepCopyInto(out *MCOObjectReference) { *out = *in 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 579f6f2c280..5bb09fcefc8 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 @@ -49,6 +49,30 @@ spec: properties: autoSizingReserved: type: boolean + dropInConfig: + description: dropInConfig allows users to define a drop-in configuration + for Kubelet. + properties: + configDirectory: + description: |- + ConfigDirectory allows users to define a directory for Kubelet's drop-in configuration. + This enables incremental configuration updates without modifying the main KubeletConfig. + type: string + configFile: + description: ConfigFile defines a specific configuration file + within the drop-in directory. + type: string + kubeletConfig: + description: |- + KubeletConfig fields are defined in Kubernetes upstream. This must be set if DropInConfigDirectory + and DropInConfigFile are provided. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - configDirectory + - configFile + - kubeletConfig + type: object kubeletConfig: description: |- kubeletConfig fields are defined in kubernetes upstream. Please refer to the types defined in the version/commit used by diff --git a/machineconfiguration/v1/zz_generated.swagger_doc_generated.go b/machineconfiguration/v1/zz_generated.swagger_doc_generated.go index 92f536b9a88..eec74022c9f 100644 --- a/machineconfiguration/v1/zz_generated.swagger_doc_generated.go +++ b/machineconfiguration/v1/zz_generated.swagger_doc_generated.go @@ -218,6 +218,7 @@ var map_KubeletConfigSpec = map[string]string{ "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.", + "dropInConfig": "dropInConfig allows users to define a drop-in configuration for Kubelet.", } func (KubeletConfigSpec) SwaggerDoc() map[string]string { @@ -234,6 +235,17 @@ func (KubeletConfigStatus) SwaggerDoc() map[string]string { return map_KubeletConfigStatus } +var map_KubeletDropInDirConfigDetails = map[string]string{ + "": "KubeletDropInDirConfigDetails defines the details for Kubelet drop-in configuration.", + "configDirectory": "ConfigDirectory allows users to define a directory for Kubelet's drop-in configuration. This enables incremental configuration updates without modifying the main KubeletConfig.", + "configFile": "ConfigFile defines a specific configuration file within the drop-in directory.", + "kubeletConfig": "KubeletConfig fields are defined in Kubernetes upstream. This must be set if DropInConfigDirectory and DropInConfigFile are provided.", +} + +func (KubeletDropInDirConfigDetails) SwaggerDoc() map[string]string { + return map_KubeletDropInDirConfigDetails +} + var map_MachineConfig = map[string]string{ "": "MachineConfig defines the configuration for a machine\n\nCompatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", } 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 b056dc99c17..ca079cee99c 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 @@ -48,6 +48,30 @@ spec: properties: autoSizingReserved: type: boolean + dropInConfig: + description: dropInConfig allows users to define a drop-in configuration + for Kubelet. + properties: + configDirectory: + description: |- + ConfigDirectory allows users to define a directory for Kubelet's drop-in configuration. + This enables incremental configuration updates without modifying the main KubeletConfig. + type: string + configFile: + description: ConfigFile defines a specific configuration file + within the drop-in directory. + type: string + kubeletConfig: + description: |- + KubeletConfig fields are defined in Kubernetes upstream. This must be set if DropInConfigDirectory + and DropInConfigFile are provided. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - configDirectory + - configFile + - kubeletConfig + type: object kubeletConfig: description: |- kubeletConfig fields are defined in kubernetes upstream. Please refer to the types defined in the version/commit used by diff --git a/payload-manifests/featuregates/featureGate-Hypershift-Default.yaml b/payload-manifests/featuregates/featureGate-Hypershift-Default.yaml index 26f321da4c9..a3bcc43ec47 100644 --- a/payload-manifests/featuregates/featureGate-Hypershift-Default.yaml +++ b/payload-manifests/featuregates/featureGate-Hypershift-Default.yaml @@ -109,6 +109,9 @@ { "name": "KMSEncryptionProvider" }, + { + "name": "KubeletConfigDropInDir" + }, { "name": "MachineAPIMigration" }, diff --git a/payload-manifests/featuregates/featureGate-Hypershift-DevPreviewNoUpgrade.yaml b/payload-manifests/featuregates/featureGate-Hypershift-DevPreviewNoUpgrade.yaml index 2f43ebae529..38561233d61 100644 --- a/payload-manifests/featuregates/featureGate-Hypershift-DevPreviewNoUpgrade.yaml +++ b/payload-manifests/featuregates/featureGate-Hypershift-DevPreviewNoUpgrade.yaml @@ -188,6 +188,9 @@ { "name": "KMSv1" }, + { + "name": "KubeletConfigDropInDir" + }, { "name": "MachineAPIMigration" }, diff --git a/payload-manifests/featuregates/featureGate-Hypershift-TechPreviewNoUpgrade.yaml b/payload-manifests/featuregates/featureGate-Hypershift-TechPreviewNoUpgrade.yaml index fe74387152e..5e048def8d3 100644 --- a/payload-manifests/featuregates/featureGate-Hypershift-TechPreviewNoUpgrade.yaml +++ b/payload-manifests/featuregates/featureGate-Hypershift-TechPreviewNoUpgrade.yaml @@ -194,6 +194,9 @@ { "name": "KMSv1" }, + { + "name": "KubeletConfigDropInDir" + }, { "name": "MachineAPIMigration" }, diff --git a/payload-manifests/featuregates/featureGate-SelfManagedHA-Default.yaml b/payload-manifests/featuregates/featureGate-SelfManagedHA-Default.yaml index 3982585ebb1..2f3fc0cd77d 100644 --- a/payload-manifests/featuregates/featureGate-SelfManagedHA-Default.yaml +++ b/payload-manifests/featuregates/featureGate-SelfManagedHA-Default.yaml @@ -112,6 +112,9 @@ { "name": "KMSEncryptionProvider" }, + { + "name": "KubeletConfigDropInDir" + }, { "name": "MachineAPIMigration" }, diff --git a/payload-manifests/featuregates/featureGate-SelfManagedHA-DevPreviewNoUpgrade.yaml b/payload-manifests/featuregates/featureGate-SelfManagedHA-DevPreviewNoUpgrade.yaml index d0ca5054c57..d0c63302c1f 100644 --- a/payload-manifests/featuregates/featureGate-SelfManagedHA-DevPreviewNoUpgrade.yaml +++ b/payload-manifests/featuregates/featureGate-SelfManagedHA-DevPreviewNoUpgrade.yaml @@ -173,6 +173,9 @@ { "name": "KMSv1" }, + { + "name": "KubeletConfigDropInDir" + }, { "name": "MachineAPIMigration" }, diff --git a/payload-manifests/featuregates/featureGate-SelfManagedHA-TechPreviewNoUpgrade.yaml b/payload-manifests/featuregates/featureGate-SelfManagedHA-TechPreviewNoUpgrade.yaml index 256c8b22bd0..168cc27a9b5 100644 --- a/payload-manifests/featuregates/featureGate-SelfManagedHA-TechPreviewNoUpgrade.yaml +++ b/payload-manifests/featuregates/featureGate-SelfManagedHA-TechPreviewNoUpgrade.yaml @@ -179,6 +179,9 @@ { "name": "KMSv1" }, + { + "name": "KubeletConfigDropInDir" + }, { "name": "MachineAPIMigration" },