From 1974bb36b45e2b593843679a4ab7615e86f9d94c Mon Sep 17 00:00:00 2001 From: Adrien Gentil Date: Wed, 5 Apr 2023 14:38:00 +0200 Subject: [PATCH 1/4] OCPCLOUD-2010: Add CloudControllerManagerStatus to the `External` platform status Partially revert PR https://github.com/openshift/api/pull/1409 in order to support external platform type. * Enhancement doc update PR () --- ...perator_01_infrastructure-Default.crd.yaml | 13 +++++++ ...frastructure-TechPreviewNoUpgrade.crd.yaml | 13 +++++++ config/v1/types_infrastructure.go | 38 ++++++++++++++++++- config/v1/zz_generated.deepcopy.go | 17 +++++++++ .../v1/zz_generated.swagger_doc_generated.go | 12 +++++- .../generated_openapi/zz_generated.openapi.go | 33 ++++++++++++++++ openapi/openapi.json | 20 +++++++++- 7 files changed, 143 insertions(+), 3 deletions(-) diff --git a/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml b/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml index bb8817110fe..7fea7e1aa1c 100644 --- a/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml +++ b/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml @@ -592,6 +592,19 @@ spec: type: object external: description: External contains settings specific to the generic External infrastructure provider. + properties: + cloudControllerManager: + description: CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) + properties: + state: + default: "" + description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager \n When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected." + enum: + - "" + - External + - None + type: string + type: object type: object gcp: description: GCP contains settings specific to the Google Cloud Platform infrastructure provider. diff --git a/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml b/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml index 495e4a55818..9cbba036592 100644 --- a/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml +++ b/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml @@ -615,6 +615,19 @@ spec: type: object external: description: External contains settings specific to the generic External infrastructure provider. + properties: + cloudControllerManager: + description: CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) + properties: + state: + default: "" + description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager \n When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected." + enum: + - "" + - External + - None + type: string + type: object type: object gcp: description: GCP contains settings specific to the Google Cloud Platform infrastructure provider. diff --git a/config/v1/types_infrastructure.go b/config/v1/types_infrastructure.go index d47acdb77ec..70b12a356b5 100644 --- a/config/v1/types_infrastructure.go +++ b/config/v1/types_infrastructure.go @@ -315,8 +315,44 @@ type PlatformSpec struct { External *ExternalPlatformSpec `json:"external,omitempty"` } +// CloudControllerManagerState defines whether Cloud Controller Manager presence is expected or not +type CloudControllerManagerState string + +const ( + // Cloud Controller Manager is enabled and expected to be installed. + // This value indicates that new nodes should be tainted as uninitialized when created, + // preventing them from running workloads until they are initialized by the cloud controller manager. + CloudControllerManagerExternal CloudControllerManagerState = "External" + + // Cloud Controller Manager is disabled and not expected to be installed. + // This value indicates that new nodes should not be tainted + // and no extra node initialization is expected from the cloud controller manager. + CloudControllerManagerNone CloudControllerManagerState = "None" +) + +// CloudControllerManagerStatus holds the state of Cloud Controller Manager (a.k.a. CCM or CPI) related settings +type CloudControllerManagerStatus struct { + // state determines whether or not an external Cloud Controller Manager is expected to + // be installed within the cluster. + // https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager + // + // When set to "External", new nodes will be tainted as uninitialized when created, + // preventing them from running workloads until they are initialized by the cloud controller manager. + // When omitted or set to "None", new nodes will be not tainted + // and no extra initialization from the cloud controller manager is expected. + // +kubebuilder:default:="" + // +default="" + // +kubebuilder:validation:Enum="";External;None + // +optional + State CloudControllerManagerState `json:"state"` +} + // ExternalPlatformStatus holds the current status of the generic External infrastructure provider. -type ExternalPlatformStatus struct{} +type ExternalPlatformStatus struct { + // CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) + // +optional + CloudControllerManager CloudControllerManagerStatus `json:"cloudControllerManager"` +} // PlatformStatus holds the current status specific to the underlying infrastructure provider // of the current cluster. Since these are used at status-level for the underlying cluster, it diff --git a/config/v1/zz_generated.deepcopy.go b/config/v1/zz_generated.deepcopy.go index fbc6e156547..57383546056 100644 --- a/config/v1/zz_generated.deepcopy.go +++ b/config/v1/zz_generated.deepcopy.go @@ -875,6 +875,22 @@ func (in *ClientConnectionOverrides) DeepCopy() *ClientConnectionOverrides { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CloudControllerManagerStatus) DeepCopyInto(out *CloudControllerManagerStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudControllerManagerStatus. +func (in *CloudControllerManagerStatus) DeepCopy() *CloudControllerManagerStatus { + if in == nil { + return nil + } + out := new(CloudControllerManagerStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition) { *out = *in @@ -1874,6 +1890,7 @@ func (in *ExternalPlatformSpec) DeepCopy() *ExternalPlatformSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalPlatformStatus) DeepCopyInto(out *ExternalPlatformStatus) { *out = *in + out.CloudControllerManager = in.CloudControllerManager return } diff --git a/config/v1/zz_generated.swagger_doc_generated.go b/config/v1/zz_generated.swagger_doc_generated.go index e7e51453fb0..90430638d08 100644 --- a/config/v1/zz_generated.swagger_doc_generated.go +++ b/config/v1/zz_generated.swagger_doc_generated.go @@ -1183,6 +1183,15 @@ func (BareMetalPlatformStatus) SwaggerDoc() map[string]string { return map_BareMetalPlatformStatus } +var map_CloudControllerManagerStatus = map[string]string{ + "": "CloudControllerManagerStatus holds the state of Cloud Controller Manager (a.k.a. CCM or CPI) related settings", + "state": "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager\n\nWhen set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", +} + +func (CloudControllerManagerStatus) SwaggerDoc() map[string]string { + return map_CloudControllerManagerStatus +} + var map_EquinixMetalPlatformSpec = map[string]string{ "": "EquinixMetalPlatformSpec holds the desired state of the Equinix Metal infrastructure provider. This only includes fields that can be modified in the cluster.", } @@ -1211,7 +1220,8 @@ func (ExternalPlatformSpec) SwaggerDoc() map[string]string { } var map_ExternalPlatformStatus = map[string]string{ - "": "ExternalPlatformStatus holds the current status of the generic External infrastructure provider.", + "": "ExternalPlatformStatus holds the current status of the generic External infrastructure provider.", + "cloudControllerManager": "CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI)", } func (ExternalPlatformStatus) SwaggerDoc() map[string]string { diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index 172f81c3958..7e1e7795dbd 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -181,6 +181,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openshift/api/config/v1.BuildSpec": schema_openshift_api_config_v1_BuildSpec(ref), "github.com/openshift/api/config/v1.CertInfo": schema_openshift_api_config_v1_CertInfo(ref), "github.com/openshift/api/config/v1.ClientConnectionOverrides": schema_openshift_api_config_v1_ClientConnectionOverrides(ref), + "github.com/openshift/api/config/v1.CloudControllerManagerStatus": schema_openshift_api_config_v1_CloudControllerManagerStatus(ref), "github.com/openshift/api/config/v1.ClusterCondition": schema_openshift_api_config_v1_ClusterCondition(ref), "github.com/openshift/api/config/v1.ClusterNetworkEntry": schema_openshift_api_config_v1_ClusterNetworkEntry(ref), "github.com/openshift/api/config/v1.ClusterOperator": schema_openshift_api_config_v1_ClusterOperator(ref), @@ -9581,6 +9582,27 @@ func schema_openshift_api_config_v1_ClientConnectionOverrides(ref common.Referen } } +func schema_openshift_api_config_v1_CloudControllerManagerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CloudControllerManagerStatus holds the state of Cloud Controller Manager (a.k.a. CCM or CPI) related settings", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "state": { + SchemaProps: spec.SchemaProps{ + Description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager\n\nWhen set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_openshift_api_config_v1_ClusterCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -11421,8 +11443,19 @@ func schema_openshift_api_config_v1_ExternalPlatformStatus(ref common.ReferenceC SchemaProps: spec.SchemaProps{ Description: "ExternalPlatformStatus holds the current status of the generic External infrastructure provider.", Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "cloudControllerManager": { + SchemaProps: spec.SchemaProps{ + Description: "CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI)", + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/config/v1.CloudControllerManagerStatus"), + }, + }, + }, }, }, + Dependencies: []string{ + "github.com/openshift/api/config/v1.CloudControllerManagerStatus"}, } } diff --git a/openapi/openapi.json b/openapi/openapi.json index 6f2abba7ec1..17ce56e867f 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4902,6 +4902,17 @@ } } }, + "com.github.openshift.api.config.v1.CloudControllerManagerStatus": { + "description": "CloudControllerManagerStatus holds the state of Cloud Controller Manager (a.k.a. CCM or CPI) related settings", + "type": "object", + "properties": { + "state": { + "description": "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager\n\nWhen set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", + "type": "string", + "default": "" + } + } + }, "com.github.openshift.api.config.v1.ClusterCondition": { "description": "ClusterCondition is a union of typed cluster conditions. The 'type' property determines which of the type-specific properties are relevant. When evaluated on a cluster, the condition may match, not match, or fail to evaluate.", "type": "object", @@ -5982,7 +5993,14 @@ }, "com.github.openshift.api.config.v1.ExternalPlatformStatus": { "description": "ExternalPlatformStatus holds the current status of the generic External infrastructure provider.", - "type": "object" + "type": "object", + "properties": { + "cloudControllerManager": { + "description": "CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI)", + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.config.v1.CloudControllerManagerStatus" + } + } }, "com.github.openshift.api.config.v1.FeatureGate": { "description": "Feature holds cluster-wide information about feature gates. The canonical name is `cluster`\n\nCompatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", From 3361940dd5b8607c3363fbd28f3a239853a4eebc Mon Sep 17 00:00:00 2001 From: Adrien Gentil Date: Wed, 3 May 2023 17:19:38 +0200 Subject: [PATCH 2/4] Add field validations and tests --- ...perator_01_infrastructure-Default.crd.yaml | 10 +- ...frastructure-TechPreviewNoUpgrade.crd.yaml | 10 +- .../v1/stable.infrastructure.testsuite.yaml | 114 ++++++++++++++++++ config/v1/types_infrastructure.go | 5 +- 4 files changed, 135 insertions(+), 4 deletions(-) diff --git a/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml b/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml index 7fea7e1aa1c..36fa8b20a40 100644 --- a/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml +++ b/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml @@ -597,15 +597,23 @@ spec: description: CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) properties: state: - default: "" description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager \n When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected." enum: - "" - External - None type: string + x-kubernetes-validations: + - message: state is immutable once set + rule: self == oldSelf type: object + x-kubernetes-validations: + - message: state cannot be added or removed once set + rule: has(self.state) == has(oldSelf.state) type: object + x-kubernetes-validations: + - message: cloudControllerManager added or removed once set + rule: has(self.cloudControllerManager) == has(oldSelf.cloudControllerManager) gcp: description: GCP contains settings specific to the Google Cloud Platform infrastructure provider. properties: diff --git a/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml b/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml index 9cbba036592..56e2cb47609 100644 --- a/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml +++ b/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml @@ -620,15 +620,23 @@ spec: description: CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) properties: state: - default: "" description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager \n When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected." enum: - "" - External - None type: string + x-kubernetes-validations: + - message: state is immutable once set + rule: self == oldSelf type: object + x-kubernetes-validations: + - message: state cannot be added or removed once set + rule: has(self.state) == has(oldSelf.state) type: object + x-kubernetes-validations: + - message: cloudControllerManager added or removed once set + rule: has(self.cloudControllerManager) == has(oldSelf.cloudControllerManager) gcp: description: GCP contains settings specific to the Google Cloud Platform infrastructure provider. properties: diff --git a/config/v1/stable.infrastructure.testsuite.yaml b/config/v1/stable.infrastructure.testsuite.yaml index 4266122b048..6ba05031119 100644 --- a/config/v1/stable.infrastructure.testsuite.yaml +++ b/config/v1/stable.infrastructure.testsuite.yaml @@ -56,6 +56,120 @@ tests: external: platformName: SomeOtherCoolplatformName expectedError: " spec.platformSpec.external.platformName: Invalid value: \"string\": platform name cannot be changed once set" + - name: Should not be able to update External cloudControllerManager state once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + expectedStatusError: " status.platformStatus.external.cloudControllerManager.state: Invalid value: \"string\": state is immutable once set" + - name: Should not be able to add External cloudControllerManager state once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state cannot be added or removed once set" + - name: Should not be able to remove External cloudControllerManager state once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} + expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state cannot be added or removed once set" + - name: Should not be able to add External cloudControllerManager once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: {} + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + expectedStatusError: " status.platformStatus.external: Invalid value: \"object\": cloudControllerManager added or removed once set" + - name: Should not be able to remove cloudControllerManager once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: {} + expectedStatusError: " status.platformStatus.external: Invalid value: \"object\": cloudControllerManager added or removed once set" - name: Should not be able to modify an existing Azure ResourceTags Tag initial: | apiVersion: config.openshift.io/v1 diff --git a/config/v1/types_infrastructure.go b/config/v1/types_infrastructure.go index 70b12a356b5..63e133ea9d1 100644 --- a/config/v1/types_infrastructure.go +++ b/config/v1/types_infrastructure.go @@ -331,6 +331,7 @@ const ( ) // CloudControllerManagerStatus holds the state of Cloud Controller Manager (a.k.a. CCM or CPI) related settings +// +kubebuilder:validation:XValidation:rule="has(self.state) == has(oldSelf.state)",message="state cannot be added or removed once set" type CloudControllerManagerStatus struct { // state determines whether or not an external Cloud Controller Manager is expected to // be installed within the cluster. @@ -340,14 +341,14 @@ type CloudControllerManagerStatus struct { // preventing them from running workloads until they are initialized by the cloud controller manager. // When omitted or set to "None", new nodes will be not tainted // and no extra initialization from the cloud controller manager is expected. - // +kubebuilder:default:="" - // +default="" // +kubebuilder:validation:Enum="";External;None + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="state is immutable once set" // +optional State CloudControllerManagerState `json:"state"` } // ExternalPlatformStatus holds the current status of the generic External infrastructure provider. +// +kubebuilder:validation:XValidation:rule="has(self.cloudControllerManager) == has(oldSelf.cloudControllerManager)",message="cloudControllerManager added or removed once set" type ExternalPlatformStatus struct { // CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) // +optional From 99f7e5b4f30216460edad540559d94197e5a170a Mon Sep 17 00:00:00 2001 From: Adrien Gentil Date: Fri, 2 Jun 2023 16:38:23 +0200 Subject: [PATCH 3/4] Set CloudControllerManagerStatus behind TechPreviewNoUpgrade feature set --- ...perator_01_infrastructure-Default.crd.yaml | 18 --- config/v1/feature_gates.go | 10 ++ .../v1/stable.infrastructure.testsuite.yaml | 114 ------------------ .../techpreview.infrastructure.testsuite.yaml | 114 ++++++++++++++++++ config/v1/types_feature.go | 1 + config/v1/types_infrastructure.go | 1 + 6 files changed, 126 insertions(+), 132 deletions(-) diff --git a/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml b/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml index 36fa8b20a40..bc81d571a53 100644 --- a/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml +++ b/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml @@ -592,24 +592,6 @@ spec: type: object external: description: External contains settings specific to the generic External infrastructure provider. - properties: - cloudControllerManager: - description: CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) - properties: - state: - description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager \n When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected." - enum: - - "" - - External - - None - type: string - x-kubernetes-validations: - - message: state is immutable once set - rule: self == oldSelf - type: object - x-kubernetes-validations: - - message: state cannot be added or removed once set - rule: has(self.state) == has(oldSelf.state) type: object x-kubernetes-validations: - message: cloudControllerManager added or removed once set diff --git a/config/v1/feature_gates.go b/config/v1/feature_gates.go index 2c06da3cd3f..219c236e796 100644 --- a/config/v1/feature_gates.go +++ b/config/v1/feature_gates.go @@ -83,6 +83,16 @@ var ( OwningProduct: ocpSpecific, } + FeatureGateExternalCloudProviderExternal = FeatureGateName("ExternalCloudProviderExternal") + externalCloudProviderExternal = FeatureGateDescription{ + FeatureGateAttributes: FeatureGateAttributes{ + Name: FeatureGateExternalCloudProviderExternal, + }, + OwningJiraComponent: "cloud-provider", + ResponsiblePerson: "jspeed", + OwningProduct: ocpSpecific, + } + FeatureGateCSIDriverSharedResource = FeatureGateName("CSIDriverSharedResource") csiDriverSharedResource = FeatureGateDescription{ FeatureGateAttributes: FeatureGateAttributes{ diff --git a/config/v1/stable.infrastructure.testsuite.yaml b/config/v1/stable.infrastructure.testsuite.yaml index 6ba05031119..4266122b048 100644 --- a/config/v1/stable.infrastructure.testsuite.yaml +++ b/config/v1/stable.infrastructure.testsuite.yaml @@ -56,120 +56,6 @@ tests: external: platformName: SomeOtherCoolplatformName expectedError: " spec.platformSpec.external.platformName: Invalid value: \"string\": platform name cannot be changed once set" - - name: Should not be able to update External cloudControllerManager state once it was set - initial: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: - cloudControllerManager: - state: "" - updated: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: - cloudControllerManager: - state: External - expectedStatusError: " status.platformStatus.external.cloudControllerManager.state: Invalid value: \"string\": state is immutable once set" - - name: Should not be able to add External cloudControllerManager state once it was set - initial: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: - cloudControllerManager: {} - updated: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: - cloudControllerManager: - state: External - expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state cannot be added or removed once set" - - name: Should not be able to remove External cloudControllerManager state once it was set - initial: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: - cloudControllerManager: - state: External - updated: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: - cloudControllerManager: {} - expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state cannot be added or removed once set" - - name: Should not be able to add External cloudControllerManager once it was set - initial: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: {} - updated: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: - cloudControllerManager: - state: External - expectedStatusError: " status.platformStatus.external: Invalid value: \"object\": cloudControllerManager added or removed once set" - - name: Should not be able to remove cloudControllerManager once it was set - initial: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: - cloudControllerManager: - state: None - updated: | - apiVersion: config.openshift.io/v1 - kind: Infrastructure - spec: {} - status: - platform: External - platformStatus: - type: External - external: {} - expectedStatusError: " status.platformStatus.external: Invalid value: \"object\": cloudControllerManager added or removed once set" - name: Should not be able to modify an existing Azure ResourceTags Tag initial: | apiVersion: config.openshift.io/v1 diff --git a/config/v1/techpreview.infrastructure.testsuite.yaml b/config/v1/techpreview.infrastructure.testsuite.yaml index f9829b9a396..552d783d110 100644 --- a/config/v1/techpreview.infrastructure.testsuite.yaml +++ b/config/v1/techpreview.infrastructure.testsuite.yaml @@ -211,3 +211,117 @@ tests: type: FooBar type: BareMetal expectedStatusError: "status.platformStatus.baremetal.loadBalancer.type: Unsupported value: \"FooBar\": supported values: \"OpenShiftManagedDefault\", \"UserManaged\"" + - name: Should not be able to update External cloudControllerManager state once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + expectedStatusError: " status.platformStatus.external.cloudControllerManager.state: Invalid value: \"string\": state is immutable once set" + - name: Should not be able to add External cloudControllerManager state once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state cannot be added or removed once set" + - name: Should not be able to remove External cloudControllerManager state once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} + expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state cannot be added or removed once set" + - name: Should not be able to add External cloudControllerManager once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: {} + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + expectedStatusError: " status.platformStatus.external: Invalid value: \"object\": cloudControllerManager added or removed once set" + - name: Should not be able to remove cloudControllerManager once it was set + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: {} + expectedStatusError: " status.platformStatus.external: Invalid value: \"object\": cloudControllerManager added or removed once set" diff --git a/config/v1/types_feature.go b/config/v1/types_feature.go index 73d599ad6ee..188115adbdf 100644 --- a/config/v1/types_feature.go +++ b/config/v1/types_feature.go @@ -166,6 +166,7 @@ var FeatureSets = map[FeatureSet]*FeatureGateEnabledDisabled{ with(externalCloudProvider). with(externalCloudProviderAzure). with(externalCloudProviderGCP). + with(externalCloudProviderExternal). with(csiDriverSharedResource). with(buildCSIVolumes). with(nodeSwap). diff --git a/config/v1/types_infrastructure.go b/config/v1/types_infrastructure.go index 63e133ea9d1..38ca0591e6f 100644 --- a/config/v1/types_infrastructure.go +++ b/config/v1/types_infrastructure.go @@ -351,6 +351,7 @@ type CloudControllerManagerStatus struct { // +kubebuilder:validation:XValidation:rule="has(self.cloudControllerManager) == has(oldSelf.cloudControllerManager)",message="cloudControllerManager added or removed once set" type ExternalPlatformStatus struct { // CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) + // +openshift:enable:FeatureSets=TechPreviewNoUpgrade // +optional CloudControllerManager CloudControllerManagerStatus `json:"cloudControllerManager"` } From db0028c77d5e1fdb63be87336a345ae5f2828df3 Mon Sep 17 00:00:00 2001 From: Adrien Gentil Date: Mon, 12 Jun 2023 18:45:00 +0200 Subject: [PATCH 4/4] update CEL to be more accurate --- ...perator_01_infrastructure-Default.crd.yaml | 3 - ...frastructure-TechPreviewNoUpgrade.crd.yaml | 11 +- config/v1/feature_gates.go | 2 +- .../techpreview.infrastructure.testsuite.yaml | 359 +++++++++++++++++- config/v1/types_infrastructure.go | 8 +- .../v1/zz_generated.swagger_doc_generated.go | 4 +- .../generated_openapi/zz_generated.openapi.go | 4 +- openapi/openapi.json | 4 +- 8 files changed, 364 insertions(+), 31 deletions(-) diff --git a/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml b/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml index bc81d571a53..bb8817110fe 100644 --- a/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml +++ b/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml @@ -593,9 +593,6 @@ spec: external: description: External contains settings specific to the generic External infrastructure provider. type: object - x-kubernetes-validations: - - message: cloudControllerManager added or removed once set - rule: has(self.cloudControllerManager) == has(oldSelf.cloudControllerManager) gcp: description: GCP contains settings specific to the Google Cloud Platform infrastructure provider. properties: diff --git a/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml b/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml index 56e2cb47609..e8fce28aa87 100644 --- a/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml +++ b/config/v1/0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml @@ -617,10 +617,10 @@ spec: description: External contains settings specific to the generic External infrastructure provider. properties: cloudControllerManager: - description: CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) + description: cloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI). When omitted, new nodes will be not tainted and no extra initialization from the cloud controller manager is expected. properties: state: - description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager \n When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected." + description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager \n Valid values are \"External\", \"None\" and omitted. When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected." enum: - "" - External @@ -631,12 +631,9 @@ spec: rule: self == oldSelf type: object x-kubernetes-validations: - - message: state cannot be added or removed once set - rule: has(self.state) == has(oldSelf.state) + - message: state may not be added or removed once set + rule: (has(self.state) == has(oldSelf.state)) || (!has(oldSelf.state) && self.state != "External") type: object - x-kubernetes-validations: - - message: cloudControllerManager added or removed once set - rule: has(self.cloudControllerManager) == has(oldSelf.cloudControllerManager) gcp: description: GCP contains settings specific to the Google Cloud Platform infrastructure provider. properties: diff --git a/config/v1/feature_gates.go b/config/v1/feature_gates.go index 219c236e796..28a708efb14 100644 --- a/config/v1/feature_gates.go +++ b/config/v1/feature_gates.go @@ -89,7 +89,7 @@ var ( Name: FeatureGateExternalCloudProviderExternal, }, OwningJiraComponent: "cloud-provider", - ResponsiblePerson: "jspeed", + ResponsiblePerson: "elmiko", OwningProduct: ocpSpecific, } diff --git a/config/v1/techpreview.infrastructure.testsuite.yaml b/config/v1/techpreview.infrastructure.testsuite.yaml index 552d783d110..546f392f765 100644 --- a/config/v1/techpreview.infrastructure.testsuite.yaml +++ b/config/v1/techpreview.infrastructure.testsuite.yaml @@ -211,7 +211,7 @@ tests: type: FooBar type: BareMetal expectedStatusError: "status.platformStatus.baremetal.loadBalancer.type: Unsupported value: \"FooBar\": supported values: \"OpenShiftManagedDefault\", \"UserManaged\"" - - name: Should not be able to update External cloudControllerManager state once it was set + - name: Should not be able to update cloudControllerManager state to empty string when state is already set to None initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure @@ -220,9 +220,31 @@ tests: platform: External platformStatus: type: External + external: + cloudControllerManager: + state: None + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platformStatus: external: cloudControllerManager: state: "" + expectedStatusError: " status.platformStatus.external.cloudControllerManager.state: Invalid value: \"string\": state is immutable once set" + - name: Should not be able to update cloudControllerManager state to External when state is already set to None + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure @@ -235,8 +257,56 @@ tests: cloudControllerManager: state: External expectedStatusError: " status.platformStatus.external.cloudControllerManager.state: Invalid value: \"string\": state is immutable once set" - - name: Should not be able to add External cloudControllerManager state once it was set + - name: Should be able to update cloudControllerManager state to None when state is already set to None + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None + expected: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + controlPlaneTopology: HighlyAvailable + cpuPartitioning: None + infrastructureTopology: HighlyAvailable + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None + - name: Should not be able to unset cloudControllerManager state when state is already set to None initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None + updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: {} @@ -246,6 +316,67 @@ tests: type: External external: cloudControllerManager: {} + expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state may not be added or removed once set" + - name: Should not be able to update cloudControllerManager state to empty string when state is already set to External + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" + expectedStatusError: " status.platformStatus.external.cloudControllerManager.state: Invalid value: \"string\": state is immutable once set" + - name: Should not be able to update cloudControllerManager state to None when state is already set to External + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None + expectedStatusError: " status.platformStatus.external.cloudControllerManager.state: Invalid value: \"string\": state is immutable once set" + - name: Should be able to update cloudControllerManager state to External when state is already set to External + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure @@ -257,8 +388,21 @@ tests: external: cloudControllerManager: state: External - expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state cannot be added or removed once set" - - name: Should not be able to remove External cloudControllerManager state once it was set + expected: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + controlPlaneTopology: HighlyAvailable + cpuPartitioning: None + infrastructureTopology: HighlyAvailable + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: External + - name: Should not be able to unset cloudControllerManager state when state is already set to External initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure @@ -280,8 +424,8 @@ tests: type: External external: cloudControllerManager: {} - expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state cannot be added or removed once set" - - name: Should not be able to add External cloudControllerManager once it was set + expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state may not be added or removed once set" + - name: Should not be able to update cloudControllerManager state to None when state is already set to empty string initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure @@ -290,7 +434,33 @@ tests: platform: External platformStatus: type: External - external: {} + external: + cloudControllerManager: + state: "" + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None + expectedStatusError: " status.platformStatus.external.cloudControllerManager.state: Invalid value: \"string\": state is immutable once set" + - name: Should not be able to update cloudControllerManager state to External when state is already set to empty string + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure @@ -302,19 +472,150 @@ tests: external: cloudControllerManager: state: External - expectedStatusError: " status.platformStatus.external: Invalid value: \"object\": cloudControllerManager added or removed once set" - - name: Should not be able to remove cloudControllerManager once it was set + expectedStatusError: " status.platformStatus.external.cloudControllerManager.state: Invalid value: \"string\": state is immutable once set" + - name: Should be able to update cloudControllerManager state to empty string when state is already set to empty string + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" + expected: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + controlPlaneTopology: HighlyAvailable + cpuPartitioning: None + infrastructureTopology: HighlyAvailable + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" + - name: Should not be able to unset cloudControllerManager state when state is already set to empty string + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} + expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state may not be added or removed once set" + - name: Should be able to update cloudControllerManager state to None when cloudControllerManager state is unset initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: {} status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: None + expected: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + controlPlaneTopology: HighlyAvailable + cpuPartitioning: None + infrastructureTopology: HighlyAvailable platform: External platformStatus: type: External external: cloudControllerManager: state: None + - name: Should be able to update cloudControllerManager state to empty string when cloudControllerManager state is unset + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" + expected: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + controlPlaneTopology: HighlyAvailable + cpuPartitioning: None + infrastructureTopology: HighlyAvailable + platform: External + platformStatus: + type: External + external: + cloudControllerManager: + state: "" + - name: Should not be able to update cloudControllerManager state to External when cloudControllerManager state is unset + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure @@ -323,5 +624,41 @@ tests: platform: External platformStatus: type: External - external: {} - expectedStatusError: " status.platformStatus.external: Invalid value: \"object\": cloudControllerManager added or removed once set" + external: + cloudControllerManager: + state: External + expectedStatusError: " status.platformStatus.external.cloudControllerManager: Invalid value: \"object\": state may not be added or removed once set" + - name: Should be able to unset cloudControllerManager state when cloudControllerManager state is unset + initial: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} + updated: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} + expected: | + apiVersion: config.openshift.io/v1 + kind: Infrastructure + spec: {} + status: + controlPlaneTopology: HighlyAvailable + cpuPartitioning: None + infrastructureTopology: HighlyAvailable + platform: External + platformStatus: + type: External + external: + cloudControllerManager: {} diff --git a/config/v1/types_infrastructure.go b/config/v1/types_infrastructure.go index 38ca0591e6f..c274d9cdeed 100644 --- a/config/v1/types_infrastructure.go +++ b/config/v1/types_infrastructure.go @@ -331,12 +331,13 @@ const ( ) // CloudControllerManagerStatus holds the state of Cloud Controller Manager (a.k.a. CCM or CPI) related settings -// +kubebuilder:validation:XValidation:rule="has(self.state) == has(oldSelf.state)",message="state cannot be added or removed once set" +// +kubebuilder:validation:XValidation:rule="(has(self.state) == has(oldSelf.state)) || (!has(oldSelf.state) && self.state != \"External\")",message="state may not be added or removed once set" type CloudControllerManagerStatus struct { // state determines whether or not an external Cloud Controller Manager is expected to // be installed within the cluster. // https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager // + // Valid values are "External", "None" and omitted. // When set to "External", new nodes will be tainted as uninitialized when created, // preventing them from running workloads until they are initialized by the cloud controller manager. // When omitted or set to "None", new nodes will be not tainted @@ -348,9 +349,10 @@ type CloudControllerManagerStatus struct { } // ExternalPlatformStatus holds the current status of the generic External infrastructure provider. -// +kubebuilder:validation:XValidation:rule="has(self.cloudControllerManager) == has(oldSelf.cloudControllerManager)",message="cloudControllerManager added or removed once set" type ExternalPlatformStatus struct { - // CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI) + // cloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI). + // When omitted, new nodes will be not tainted + // and no extra initialization from the cloud controller manager is expected. // +openshift:enable:FeatureSets=TechPreviewNoUpgrade // +optional CloudControllerManager CloudControllerManagerStatus `json:"cloudControllerManager"` diff --git a/config/v1/zz_generated.swagger_doc_generated.go b/config/v1/zz_generated.swagger_doc_generated.go index 90430638d08..f84e44573bb 100644 --- a/config/v1/zz_generated.swagger_doc_generated.go +++ b/config/v1/zz_generated.swagger_doc_generated.go @@ -1185,7 +1185,7 @@ func (BareMetalPlatformStatus) SwaggerDoc() map[string]string { var map_CloudControllerManagerStatus = map[string]string{ "": "CloudControllerManagerStatus holds the state of Cloud Controller Manager (a.k.a. CCM or CPI) related settings", - "state": "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager\n\nWhen set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", + "state": "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager\n\nValid values are \"External\", \"None\" and omitted. When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", } func (CloudControllerManagerStatus) SwaggerDoc() map[string]string { @@ -1221,7 +1221,7 @@ func (ExternalPlatformSpec) SwaggerDoc() map[string]string { var map_ExternalPlatformStatus = map[string]string{ "": "ExternalPlatformStatus holds the current status of the generic External infrastructure provider.", - "cloudControllerManager": "CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI)", + "cloudControllerManager": "cloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI). When omitted, new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", } func (ExternalPlatformStatus) SwaggerDoc() map[string]string { diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index 7e1e7795dbd..bba7af782ed 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -9591,7 +9591,7 @@ func schema_openshift_api_config_v1_CloudControllerManagerStatus(ref common.Refe Properties: map[string]spec.Schema{ "state": { SchemaProps: spec.SchemaProps{ - Description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager\n\nWhen set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", + Description: "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager\n\nValid values are \"External\", \"None\" and omitted. When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", Default: "", Type: []string{"string"}, Format: "", @@ -11446,7 +11446,7 @@ func schema_openshift_api_config_v1_ExternalPlatformStatus(ref common.ReferenceC Properties: map[string]spec.Schema{ "cloudControllerManager": { SchemaProps: spec.SchemaProps{ - Description: "CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI)", + Description: "cloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI). When omitted, new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", Default: map[string]interface{}{}, Ref: ref("github.com/openshift/api/config/v1.CloudControllerManagerStatus"), }, diff --git a/openapi/openapi.json b/openapi/openapi.json index 17ce56e867f..25ee6e169cb 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4907,7 +4907,7 @@ "type": "object", "properties": { "state": { - "description": "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager\n\nWhen set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", + "description": "state determines whether or not an external Cloud Controller Manager is expected to be installed within the cluster. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager\n\nValid values are \"External\", \"None\" and omitted. When set to \"External\", new nodes will be tainted as uninitialized when created, preventing them from running workloads until they are initialized by the cloud controller manager. When omitted or set to \"None\", new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", "type": "string", "default": "" } @@ -5996,7 +5996,7 @@ "type": "object", "properties": { "cloudControllerManager": { - "description": "CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI)", + "description": "cloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI). When omitted, new nodes will be not tainted and no extra initialization from the cloud controller manager is expected.", "default": {}, "$ref": "#/definitions/com.github.openshift.api.config.v1.CloudControllerManagerStatus" }