From 66121bb318ea4505549207f71353d15f6d91cfc4 Mon Sep 17 00:00:00 2001 From: Linoy Hadad Date: Mon, 24 Nov 2025 13:22:58 +0200 Subject: [PATCH] feat: NVIDIA-314: Support Node CIDR Allocation for networkType=Other Using AllocateNodesCIDRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit introduces a new field, AllocateNodesCIDRs, which allows the kube-controller-manager to allocate node CIDRs when networkType=Other. It’s recommended to enable this field when using the Flannel CNI. --- api/hypershift/v1beta1/hostedcluster_types.go | 24 ++++ .../v1beta1/zz_generated.deepcopy.go | 5 + .../AAA_ungated.yaml | 20 ++++ .../AutoNodeKarpenter.yaml | 20 ++++ .../ClusterVersionOperatorConfiguration.yaml | 20 ++++ .../DynamicResourceAllocation.yaml | 20 ++++ .../ExternalOIDC.yaml | 20 ++++ ...ernalOIDCWithUIDAndExtraClaimMappings.yaml | 20 ++++ .../GCPPlatform.yaml | 20 ++++ .../ImageStreamImportMode.yaml | 20 ++++ .../IngressControllerLBSubnetsAWS.yaml | 20 ++++ .../KMSEncryptionProvider.yaml | 20 ++++ .../NetworkDiagnosticsConfig.yaml | 20 ++++ .../OpenStack.yaml | 20 ++++ .../SetEIPForNLBIngressController.yaml | 20 ++++ .../AAA_ungated.yaml | 20 ++++ .../AutoNodeKarpenter.yaml | 20 ++++ .../ClusterVersionOperatorConfiguration.yaml | 20 ++++ .../DynamicResourceAllocation.yaml | 20 ++++ .../ExternalOIDC.yaml | 20 ++++ ...ernalOIDCWithUIDAndExtraClaimMappings.yaml | 20 ++++ .../GCPPlatform.yaml | 20 ++++ .../ImageStreamImportMode.yaml | 20 ++++ .../IngressControllerLBSubnetsAWS.yaml | 20 ++++ .../KMSEncryptionProvider.yaml | 20 ++++ .../NetworkDiagnosticsConfig.yaml | 20 ++++ .../OpenStack.yaml | 20 ++++ .../SetEIPForNLBIngressController.yaml | 20 ++++ .../hypershift/v1beta1/clusternetworking.go | 19 ++- cmd/cluster/core/create.go | 11 ++ cmd/cluster/core/create_test.go | 113 ++++++++++++++++++ .../hostedclusters-CustomNoUpgrade.crd.yaml | 20 ++++ .../hostedclusters-Default.crd.yaml | 20 ++++ ...stedclusters-TechPreviewNoUpgrade.crd.yaml | 20 ++++ ...stedcontrolplanes-CustomNoUpgrade.crd.yaml | 20 ++++ .../hostedcontrolplanes-Default.crd.yaml | 20 ++++ ...ontrolplanes-TechPreviewNoUpgrade.crd.yaml | 20 ++++ ...ts_kube_controller_manager_deployment.yaml | 2 +- ...ts_kube_controller_manager_deployment.yaml | 2 +- ...ts_kube_controller_manager_deployment.yaml | 2 +- ...ts_kube_controller_manager_deployment.yaml | 2 +- .../kube-controller-manager/deployment.yaml | 1 - .../hostedcontrolplane/v2/kcm/deployment.go | 7 ++ docs/content/reference/api.md | 42 +++++++ .../hostedcluster/hostedcluster_webhook.go | 6 + test/e2e/create_cluster_test.go | 32 +++++ .../hypershift/v1beta1/hostedcluster_types.go | 24 ++++ .../v1beta1/zz_generated.deepcopy.go | 5 + 48 files changed, 927 insertions(+), 10 deletions(-) diff --git a/api/hypershift/v1beta1/hostedcluster_types.go b/api/hypershift/v1beta1/hostedcluster_types.go index 71f3d3969350..44b224c46d8f 100644 --- a/api/hypershift/v1beta1/hostedcluster_types.go +++ b/api/hypershift/v1beta1/hostedcluster_types.go @@ -1041,6 +1041,7 @@ type DNSSpec struct { // TODO this is available in vanilla kube from 1.31 API servers and in Openshift from 4.16. // TODO(alberto): Use CEL cidr library for all these validation when all management clusters are >= 1.31. // +kubebuilder:validation:XValidation:rule="(!has(self.machineNetwork) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr)) || (has(self.machineNetwork) && (self.machineNetwork.all(m, self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr)))))",message="CIDR ranges in machineNetwork, clusterNetwork, and serviceNetwork must be unique and non-overlapping" +// +kubebuilder:validation:XValidation:rule="has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == 'Enabled' ? self.networkType == 'Other' : true",message="allocateNodeCIDRs can only be set to Enabled when networkType is 'Other'" type ClusterNetworking struct { // machineNetwork is the list of IP address pools for machines. // This might be used among other things to generate appropriate networking security groups in some clouds providers. @@ -1091,6 +1092,17 @@ type ClusterNetworking struct { // // +optional APIServer *APIServerNetworking `json:"apiServer,omitempty"` + + // allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + // When using networkType=Other, it is recommended to set this field to "Enabled" + // if Flannel is used as the CNI, as it relies on this behavior. + // Default is "Disabled". + // This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + // with any other NetworkType will result in a validation error during cluster creation. + // + // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="allocateNodeCIDRs is immutable and cannot be modified once set." + AllocateNodeCIDRs *AllocateNodeCIDRsMode `json:"allocateNodeCIDRs,omitempty"` } // MachineNetworkEntry is a single IP address block for node IP blocks. @@ -1179,6 +1191,18 @@ const ( Other NetworkType = "Other" ) +// AllocateNodeCIDRsMode specifies whether the KCM manages node CIDR allocation. +// +kubebuilder:validation:Enum=Enabled;Disabled +type AllocateNodeCIDRsMode string + +const ( + // AllocateNodeCIDRsEnabled enables node CIDR allocation by the KCM + AllocateNodeCIDRsEnabled AllocateNodeCIDRsMode = "Enabled" + + // AllocateNodeCIDRsDisabled disables node CIDR allocation by the KCM + AllocateNodeCIDRsDisabled AllocateNodeCIDRsMode = "Disabled" +) + // PlatformType is a specific supported infrastructure provider. // +kubebuilder:validation:MaxLength=100 type PlatformType string diff --git a/api/hypershift/v1beta1/zz_generated.deepcopy.go b/api/hypershift/v1beta1/zz_generated.deepcopy.go index 033c005b7996..772b255b499b 100644 --- a/api/hypershift/v1beta1/zz_generated.deepcopy.go +++ b/api/hypershift/v1beta1/zz_generated.deepcopy.go @@ -1093,6 +1093,11 @@ func (in *ClusterNetworking) DeepCopyInto(out *ClusterNetworking) { *out = new(APIServerNetworking) (*in).DeepCopyInto(*out) } + if in.AllocateNodeCIDRs != nil { + in, out := &in.AllocateNodeCIDRs, &out.AllocateNodeCIDRs + *out = new(AllocateNodeCIDRsMode) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNetworking. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml index 7868b41c698d..eac3a7d820f6 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml @@ -2624,6 +2624,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2798,6 +2814,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AutoNodeKarpenter.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AutoNodeKarpenter.yaml index f91aada2dde3..67a2f01ebd4d 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AutoNodeKarpenter.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AutoNodeKarpenter.yaml @@ -2662,6 +2662,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2836,6 +2852,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml index d06e9a10a7cc..bd9efaf45957 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml @@ -2615,6 +2615,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2789,6 +2805,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/DynamicResourceAllocation.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/DynamicResourceAllocation.yaml index ec04adbccc72..eb34620746a2 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/DynamicResourceAllocation.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/DynamicResourceAllocation.yaml @@ -2636,6 +2636,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2810,6 +2826,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml index 71433b4d62e8..791f7b613df4 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml @@ -2951,6 +2951,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3125,6 +3141,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml index 009ae702d4d5..01cd3ac318ce 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml @@ -3105,6 +3105,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3279,6 +3295,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml index 482c859e50cf..db809ac4489d 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml @@ -2615,6 +2615,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2789,6 +2805,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ImageStreamImportMode.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ImageStreamImportMode.yaml index 26a1beef7a90..a285b062c341 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ImageStreamImportMode.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ImageStreamImportMode.yaml @@ -2633,6 +2633,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2807,6 +2823,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/IngressControllerLBSubnetsAWS.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/IngressControllerLBSubnetsAWS.yaml index 21d51c60029f..6fefd9b57fba 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/IngressControllerLBSubnetsAWS.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/IngressControllerLBSubnetsAWS.yaml @@ -2615,6 +2615,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2789,6 +2805,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/KMSEncryptionProvider.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/KMSEncryptionProvider.yaml index e241a31511bc..335ccc04b473 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/KMSEncryptionProvider.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/KMSEncryptionProvider.yaml @@ -2691,6 +2691,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2865,6 +2881,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/NetworkDiagnosticsConfig.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/NetworkDiagnosticsConfig.yaml index 17f84221fb4e..06aef638db94 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/NetworkDiagnosticsConfig.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/NetworkDiagnosticsConfig.yaml @@ -2767,6 +2767,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2941,6 +2957,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/OpenStack.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/OpenStack.yaml index bf9bcfccf696..e9b9a69bfb76 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/OpenStack.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/OpenStack.yaml @@ -2615,6 +2615,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2789,6 +2805,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/SetEIPForNLBIngressController.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/SetEIPForNLBIngressController.yaml index 56be524e3659..cc385f56fbb0 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/SetEIPForNLBIngressController.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/SetEIPForNLBIngressController.yaml @@ -2615,6 +2615,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2789,6 +2805,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AAA_ungated.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AAA_ungated.yaml index a2809e6386a7..a03561e6d21a 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AAA_ungated.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AAA_ungated.yaml @@ -2532,6 +2532,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2706,6 +2722,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AutoNodeKarpenter.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AutoNodeKarpenter.yaml index 3c8df33d340c..f22f37b7cd6d 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AutoNodeKarpenter.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AutoNodeKarpenter.yaml @@ -2570,6 +2570,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2744,6 +2760,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml index 8a0380fd3d44..e05aec741800 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml @@ -2523,6 +2523,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2697,6 +2713,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/DynamicResourceAllocation.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/DynamicResourceAllocation.yaml index 591a609e772e..2aeca84164ea 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/DynamicResourceAllocation.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/DynamicResourceAllocation.yaml @@ -2544,6 +2544,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2718,6 +2734,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDC.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDC.yaml index 6dec3f2f413b..0d4efc265d6e 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDC.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDC.yaml @@ -2859,6 +2859,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3033,6 +3049,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml index ce55486428d8..39caaa59f90b 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml @@ -3013,6 +3013,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3187,6 +3203,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/GCPPlatform.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/GCPPlatform.yaml index 56d1cc6136ba..c989c6f22dbb 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/GCPPlatform.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/GCPPlatform.yaml @@ -2523,6 +2523,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2697,6 +2713,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ImageStreamImportMode.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ImageStreamImportMode.yaml index 9cc58e1f08ae..09d657577420 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ImageStreamImportMode.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ImageStreamImportMode.yaml @@ -2541,6 +2541,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2715,6 +2731,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/IngressControllerLBSubnetsAWS.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/IngressControllerLBSubnetsAWS.yaml index c8d72278c584..d098cfaf024d 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/IngressControllerLBSubnetsAWS.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/IngressControllerLBSubnetsAWS.yaml @@ -2523,6 +2523,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2697,6 +2713,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/KMSEncryptionProvider.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/KMSEncryptionProvider.yaml index 2eaea103ad77..04779e77e6f0 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/KMSEncryptionProvider.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/KMSEncryptionProvider.yaml @@ -2599,6 +2599,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2773,6 +2789,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/NetworkDiagnosticsConfig.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/NetworkDiagnosticsConfig.yaml index 1633ac3b54be..30e66b4db163 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/NetworkDiagnosticsConfig.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/NetworkDiagnosticsConfig.yaml @@ -2675,6 +2675,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2849,6 +2865,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/OpenStack.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/OpenStack.yaml index e059f1c9e90c..8144d2b7bc3f 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/OpenStack.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/OpenStack.yaml @@ -2523,6 +2523,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2697,6 +2713,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/SetEIPForNLBIngressController.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/SetEIPForNLBIngressController.yaml index 0c95896ee200..f788de39c077 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/SetEIPForNLBIngressController.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/SetEIPForNLBIngressController.yaml @@ -2523,6 +2523,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -2697,6 +2713,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/client/applyconfiguration/hypershift/v1beta1/clusternetworking.go b/client/applyconfiguration/hypershift/v1beta1/clusternetworking.go index db14c3fd2747..0b6e86015376 100644 --- a/client/applyconfiguration/hypershift/v1beta1/clusternetworking.go +++ b/client/applyconfiguration/hypershift/v1beta1/clusternetworking.go @@ -24,11 +24,12 @@ import ( // ClusterNetworkingApplyConfiguration represents a declarative configuration of the ClusterNetworking type for use // with apply. type ClusterNetworkingApplyConfiguration struct { - MachineNetwork []MachineNetworkEntryApplyConfiguration `json:"machineNetwork,omitempty"` - ClusterNetwork []ClusterNetworkEntryApplyConfiguration `json:"clusterNetwork,omitempty"` - ServiceNetwork []ServiceNetworkEntryApplyConfiguration `json:"serviceNetwork,omitempty"` - NetworkType *hypershiftv1beta1.NetworkType `json:"networkType,omitempty"` - APIServer *APIServerNetworkingApplyConfiguration `json:"apiServer,omitempty"` + MachineNetwork []MachineNetworkEntryApplyConfiguration `json:"machineNetwork,omitempty"` + ClusterNetwork []ClusterNetworkEntryApplyConfiguration `json:"clusterNetwork,omitempty"` + ServiceNetwork []ServiceNetworkEntryApplyConfiguration `json:"serviceNetwork,omitempty"` + NetworkType *hypershiftv1beta1.NetworkType `json:"networkType,omitempty"` + APIServer *APIServerNetworkingApplyConfiguration `json:"apiServer,omitempty"` + AllocateNodeCIDRs *hypershiftv1beta1.AllocateNodeCIDRsMode `json:"allocateNodeCIDRs,omitempty"` } // ClusterNetworkingApplyConfiguration constructs a declarative configuration of the ClusterNetworking type for use with @@ -91,3 +92,11 @@ func (b *ClusterNetworkingApplyConfiguration) WithAPIServer(value *APIServerNetw b.APIServer = value return b } + +// WithAllocateNodeCIDRs sets the AllocateNodeCIDRs field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllocateNodeCIDRs field is set to the value of the last call. +func (b *ClusterNetworkingApplyConfiguration) WithAllocateNodeCIDRs(value hypershiftv1beta1.AllocateNodeCIDRsMode) *ClusterNetworkingApplyConfiguration { + b.AllocateNodeCIDRs = &value + return b +} diff --git a/cmd/cluster/core/create.go b/cmd/cluster/core/create.go index 7d41c8a99487..120a333c5fc5 100644 --- a/cmd/cluster/core/create.go +++ b/cmd/cluster/core/create.go @@ -113,6 +113,7 @@ func bindCoreOptions(opts *RawCreateOptions, flags *pflag.FlagSet) { flags.StringVar(&opts.KubeAPIServerDNSName, "kas-dns-name", opts.KubeAPIServerDNSName, "The custom DNS name for the kube-apiserver service. Make sure the DNS name is valid and addressable.") flags.BoolVar(&opts.DisableMultiNetwork, "disable-multi-network", opts.DisableMultiNetwork, "Disables the Multus CNI plugin and related components in the hosted cluster") flags.BoolVar(&opts.VersionCheck, "version-check", opts.VersionCheck, "Checks version of CLI and Hypershift operator and blocks create if mismatched") + flags.BoolVar(&opts.AllocateNodeCIDRs, "allocate-node-cidrs", opts.AllocateNodeCIDRs, "When networkType=Other, it's recommended to set this field to 'true' when using Flannel as the CNI.") } // BindDeveloperOptions binds options that should only be exposed to developers in the `hypershift` CLI @@ -178,6 +179,7 @@ type RawCreateOptions struct { DisableMultiNetwork bool VersionCheck bool RedactBaseDomain bool + AllocateNodeCIDRs bool // BeforeApply is called immediately before resources are applied to the // server, giving the user an opportunity to inspect or mutate the resources. @@ -472,6 +474,11 @@ func prototypeResources(ctx context.Context, opts *CreateOptions) (*resources, e prototype.Cluster.Spec.OperatorConfiguration.ClusterNetworkOperator.DisableMultiNetwork = &opts.DisableMultiNetwork } + if opts.AllocateNodeCIDRs { + enabled := hyperv1.AllocateNodeCIDRsEnabled + prototype.Cluster.Spec.Networking.AllocateNodeCIDRs = &enabled + } + if opts.NodeSelector != nil { prototype.Cluster.Spec.NodeSelector = opts.NodeSelector } @@ -772,6 +779,10 @@ func (opts *RawCreateOptions) Validate(ctx context.Context) (*ValidatedCreateOpt return nil, fmt.Errorf("disableMultiNetwork is only allowed when networkType is 'Other' (got '%s')", opts.NetworkType) } + if opts.AllocateNodeCIDRs && opts.NetworkType != "Other" { + return nil, fmt.Errorf("allocateNodeCIDRs is only allowed when networkType is 'Other' (got '%s')", opts.NetworkType) + } + return &ValidatedCreateOptions{ validatedCreateOptions: &validatedCreateOptions{ RawCreateOptions: opts, diff --git a/cmd/cluster/core/create_test.go b/cmd/cluster/core/create_test.go index 94b25e95dbcc..7bf449368e47 100644 --- a/cmd/cluster/core/create_test.go +++ b/cmd/cluster/core/create_test.go @@ -418,6 +418,66 @@ func TestValidate(t *testing.T) { }, expectedErr: "disableMultiNetwork is only allowed when networkType is 'Other' (got 'Calico')", }, + { + name: "passes when allocate-node-cidrs is used with network-type=Other", + rawOpts: &RawCreateOptions{ + Name: "test-hc", + Namespace: "test-hc", + PullSecretFile: pullSecretFile, + Arch: "amd64", + AllocateNodeCIDRs: true, + NetworkType: "Other", + }, + expectedErr: "", + }, + { + name: "passes when allocate-node-cidrs is false with any network-type", + rawOpts: &RawCreateOptions{ + Name: "test-hc", + Namespace: "test-hc", + PullSecretFile: pullSecretFile, + Arch: "amd64", + AllocateNodeCIDRs: false, + NetworkType: "OVNKubernetes", + }, + expectedErr: "", + }, + { + name: "fails when allocate-node-cidrs is true with network-type=OVNKubernetes", + rawOpts: &RawCreateOptions{ + Name: "test-hc", + Namespace: "test-hc", + PullSecretFile: pullSecretFile, + Arch: "amd64", + AllocateNodeCIDRs: true, + NetworkType: "OVNKubernetes", + }, + expectedErr: "allocateNodeCIDRs is only allowed when networkType is 'Other' (got 'OVNKubernetes')", + }, + { + name: "fails when allocate-node-cidrs is true with network-type=OpenShiftSDN", + rawOpts: &RawCreateOptions{ + Name: "test-hc", + Namespace: "test-hc", + PullSecretFile: pullSecretFile, + Arch: "amd64", + AllocateNodeCIDRs: true, + NetworkType: "OpenShiftSDN", + }, + expectedErr: "allocateNodeCIDRs is only allowed when networkType is 'Other' (got 'OpenShiftSDN')", + }, + { + name: "fails when allocate-node-cidrs is true with network-type=Calico", + rawOpts: &RawCreateOptions{ + Name: "test-hc", + Namespace: "test-hc", + PullSecretFile: pullSecretFile, + Arch: "amd64", + AllocateNodeCIDRs: true, + NetworkType: "Calico", + }, + expectedErr: "allocateNodeCIDRs is only allowed when networkType is 'Other' (got 'Calico')", + }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { @@ -498,6 +558,59 @@ func TestDisableMultiNetworkFlag(t *testing.T) { } } +func TestAllocateNodeCIDRsFlag(t *testing.T) { + tests := []struct { + name string + allocateNodeCIDRs bool + expectedAllocateNodeCIDRs *hyperv1.AllocateNodeCIDRsMode + description string + }{ + { + name: "allocate-node-cidrs flag set to true", + allocateNodeCIDRs: true, + expectedAllocateNodeCIDRs: ptr.To(hyperv1.AllocateNodeCIDRsEnabled), + description: "When --allocate-node-cidrs=true is set, AllocateNodeCIDRs should be Enabled", + }, + { + name: "allocate-node-cidrs flag set to false", + allocateNodeCIDRs: false, + expectedAllocateNodeCIDRs: nil, + description: "When --allocate-node-cidrs=false is set or not provided, AllocateNodeCIDRs should be nil (defaults to Disabled in webhook).", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + g := NewWithT(t) + + // Create options with the test value, following the pattern from TestPrototypeResources + opts := &CreateOptions{ + completedCreateOptions: &completedCreateOptions{ + ValidatedCreateOptions: &ValidatedCreateOptions{ + validatedCreateOptions: &validatedCreateOptions{ + RawCreateOptions: &RawCreateOptions{ + AllocateNodeCIDRs: tt.allocateNodeCIDRs, + }, + }, + }, + }, + } + + // Create prototype resources using the actual function + resources, err := prototypeResources(context.Background(), opts) + g.Expect(err).To(BeNil()) + g.Expect(resources.Cluster.Spec.Networking).ToNot(BeNil()) + if tt.expectedAllocateNodeCIDRs == nil { + g.Expect(resources.Cluster.Spec.Networking.AllocateNodeCIDRs).To(BeNil(), tt.description) + } else { + g.Expect(resources.Cluster.Spec.Networking.AllocateNodeCIDRs).ToNot(BeNil(), tt.description) + g.Expect(*resources.Cluster.Spec.Networking.AllocateNodeCIDRs).To(Equal(*tt.expectedAllocateNodeCIDRs), tt.description) + } + + }) + } +} + func TestValidateVersion(t *testing.T) { tests := []struct { name string diff --git a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-CustomNoUpgrade.crd.yaml b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-CustomNoUpgrade.crd.yaml index f414d52ae73d..8a6a64d0dccb 100644 --- a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-CustomNoUpgrade.crd.yaml +++ b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-CustomNoUpgrade.crd.yaml @@ -3422,6 +3422,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3596,6 +3612,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Default.crd.yaml b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Default.crd.yaml index a2d6138dafb2..6f621424bbd3 100644 --- a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Default.crd.yaml +++ b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Default.crd.yaml @@ -3286,6 +3286,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3460,6 +3476,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-TechPreviewNoUpgrade.crd.yaml b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-TechPreviewNoUpgrade.crd.yaml index 944fb7c11371..3c5335f8c247 100644 --- a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-TechPreviewNoUpgrade.crd.yaml +++ b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-TechPreviewNoUpgrade.crd.yaml @@ -3333,6 +3333,22 @@ spec: networking specifies network configuration for the hosted cluster. Defaults to OVNKubernetes with a cluster network of cidr: "10.132.0.0/14" and a service network of cidr: "172.31.0.0/16". properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3507,6 +3523,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-CustomNoUpgrade.crd.yaml b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-CustomNoUpgrade.crd.yaml index 4d0cdb61b11b..25b662dd59eb 100644 --- a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-CustomNoUpgrade.crd.yaml +++ b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-CustomNoUpgrade.crd.yaml @@ -3330,6 +3330,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3504,6 +3520,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Default.crd.yaml b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Default.crd.yaml index 57f1a7257711..15e3227fde0d 100644 --- a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Default.crd.yaml +++ b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Default.crd.yaml @@ -3194,6 +3194,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3368,6 +3384,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-TechPreviewNoUpgrade.crd.yaml b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-TechPreviewNoUpgrade.crd.yaml index a336a959cd49..53177345f5ed 100644 --- a/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-TechPreviewNoUpgrade.crd.yaml +++ b/cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-TechPreviewNoUpgrade.crd.yaml @@ -3241,6 +3241,22 @@ spec: networking specifies network configuration for the cluster. Temporarily optional for backward compatibility, required in future releases. properties: + allocateNodeCIDRs: + description: |- + allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + When using networkType=Other, it is recommended to set this field to "Enabled" + if Flannel is used as the CNI, as it relies on this behavior. + Default is "Disabled". + This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + with any other NetworkType will result in a validation error during cluster creation. + enum: + - Enabled + - Disabled + type: string + x-kubernetes-validations: + - message: allocateNodeCIDRs is immutable and cannot be modified + once set. + rule: self == oldSelf apiServer: description: |- apiServer contains advanced network settings for the API server that affect @@ -3415,6 +3431,10 @@ spec: self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr))))) + - message: allocateNodeCIDRs can only be set to Enabled when networkType + is 'Other' + rule: 'has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == + ''Enabled'' ? self.networkType == ''Other'' : true' nodeSelector: additionalProperties: type: string diff --git a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/GCP/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/GCP/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml index fa70a776d0f5..13d4a9884351 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/GCP/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml +++ b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/GCP/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml @@ -83,7 +83,6 @@ spec: - --kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authentication-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authorization-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - - --allocate-node-cidrs=false - --cert-dir=/var/run/kubernetes - --cluster-signing-cert-file=/etc/kubernetes/certs/cluster-signer/ca.crt - --cluster-signing-key-file=/etc/kubernetes/certs/cluster-signer/ca.key @@ -113,6 +112,7 @@ spec: - --concurrent-gc-syncs=5 - --cluster-cidr=10.132.0.0/14 - --service-cluster-ip-range= + - --allocate-node-cidrs=false - --node-monitor-grace-period=50s - --tls-min-version=VersionTLS12 - --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 diff --git a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/IBMCloud/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/IBMCloud/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml index 4b70699120ac..ab9190d0e274 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/IBMCloud/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml +++ b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/IBMCloud/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml @@ -83,7 +83,6 @@ spec: - --kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authentication-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authorization-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - - --allocate-node-cidrs=false - --cert-dir=/var/run/kubernetes - --cluster-signing-cert-file=/etc/kubernetes/certs/cluster-signer/ca.crt - --cluster-signing-key-file=/etc/kubernetes/certs/cluster-signer/ca.key @@ -113,6 +112,7 @@ spec: - --concurrent-gc-syncs=5 - --cluster-cidr=10.132.0.0/14 - --service-cluster-ip-range= + - --allocate-node-cidrs=false - --node-monitor-grace-period=55s - --tls-min-version=VersionTLS12 - --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 diff --git a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml index 7512b7d7939c..e59ed130bedf 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml +++ b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml @@ -83,7 +83,6 @@ spec: - --kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authentication-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authorization-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - - --allocate-node-cidrs=false - --cert-dir=/var/run/kubernetes - --cluster-signing-cert-file=/etc/kubernetes/certs/cluster-signer/ca.crt - --cluster-signing-key-file=/etc/kubernetes/certs/cluster-signer/ca.key @@ -113,6 +112,7 @@ spec: - --concurrent-gc-syncs=5 - --cluster-cidr=10.132.0.0/14 - --service-cluster-ip-range= + - --allocate-node-cidrs=false - --node-monitor-grace-period=50s - --tls-min-version=VersionTLS12 - --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 diff --git a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml index 3325be00e9ec..b92663988d98 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml +++ b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-controller-manager/zz_fixture_TestControlPlaneComponents_kube_controller_manager_deployment.yaml @@ -83,7 +83,6 @@ spec: - --kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authentication-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authorization-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - - --allocate-node-cidrs=false - --cert-dir=/var/run/kubernetes - --cluster-signing-cert-file=/etc/kubernetes/certs/cluster-signer/ca.crt - --cluster-signing-key-file=/etc/kubernetes/certs/cluster-signer/ca.key @@ -113,6 +112,7 @@ spec: - --concurrent-gc-syncs=5 - --cluster-cidr=10.132.0.0/14 - --service-cluster-ip-range= + - --allocate-node-cidrs=false - --node-monitor-grace-period=50s - --tls-min-version=VersionTLS12 - --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 diff --git a/control-plane-operator/controllers/hostedcontrolplane/v2/assets/kube-controller-manager/deployment.yaml b/control-plane-operator/controllers/hostedcontrolplane/v2/assets/kube-controller-manager/deployment.yaml index d3d679d60a51..4b6ef461d99c 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/v2/assets/kube-controller-manager/deployment.yaml +++ b/control-plane-operator/controllers/hostedcontrolplane/v2/assets/kube-controller-manager/deployment.yaml @@ -23,7 +23,6 @@ spec: - --kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authentication-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - --authorization-kubeconfig=/etc/kubernetes/secrets/svc-kubeconfig/kubeconfig - - --allocate-node-cidrs=false - --cert-dir=/var/run/kubernetes - --cluster-signing-cert-file=/etc/kubernetes/certs/cluster-signer/ca.crt - --cluster-signing-key-file=/etc/kubernetes/certs/cluster-signer/ca.key diff --git a/control-plane-operator/controllers/hostedcontrolplane/v2/kcm/deployment.go b/control-plane-operator/controllers/hostedcontrolplane/v2/kcm/deployment.go index de6112d85ab1..0abdaf74e864 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/v2/kcm/deployment.go +++ b/control-plane-operator/controllers/hostedcontrolplane/v2/kcm/deployment.go @@ -40,6 +40,13 @@ func adaptDeployment(cpContext component.WorkloadContext, deployment *appsv1.Dep c.Args = append(c.Args, fmt.Sprintf("--cloud-provider=%s", "external")) } + // Enable node CIDR allocation if `.Spec.Networking.AllocateNodeCIDRs` is "Enabled" + if hcp.Spec.Networking.AllocateNodeCIDRs != nil && *hcp.Spec.Networking.AllocateNodeCIDRs == hyperv1.AllocateNodeCIDRsEnabled { + c.Args = append(c.Args, "--allocate-node-cidrs=true") + } else { + c.Args = append(c.Args, "--allocate-node-cidrs=false") + } + if hcp.Spec.Platform.Type == hyperv1.IBMCloudPlatform { c.Args = append(c.Args, "--node-monitor-grace-period=55s") } else { diff --git a/docs/content/reference/api.md b/docs/content/reference/api.md index b939fba44dcb..a631e7d32140 100644 --- a/docs/content/reference/api.md +++ b/docs/content/reference/api.md @@ -2775,6 +2775,29 @@ string +###AllocateNodeCIDRsMode { #hypershift.openshift.io/v1beta1.AllocateNodeCIDRsMode } +

+(Appears on: +ClusterNetworking) +

+

+

AllocateNodeCIDRsMode specifies whether the KCM manages node CIDR allocation.

+

+ + + + + + + + + + + + +
ValueDescription

"Disabled"

AllocateNodeCIDRsDisabled disables node CIDR allocation by the KCM

+

"Enabled"

AllocateNodeCIDRsEnabled enables node CIDR allocation by the KCM

+
###AllocationPool { #hypershift.openshift.io/v1beta1.AllocationPool }

(Appears on: @@ -4652,6 +4675,25 @@ APIServerNetworking how the APIServer is exposed inside a hosted cluster node.

+ + +allocateNodeCIDRs
+ + +AllocateNodeCIDRsMode + + + + +(Optional) +

allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. +When using networkType=Other, it is recommended to set this field to “Enabled” +if Flannel is used as the CNI, as it relies on this behavior. +Default is “Disabled”. +This field can only be set to “Enabled” when NetworkType is “Other”. Setting it to “Enabled” +with any other NetworkType will result in a validation error during cluster creation.

+ + ###ClusterVersionOperatorSpec { #hypershift.openshift.io/v1beta1.ClusterVersionOperatorSpec } diff --git a/hypershift-operator/controllers/hostedcluster/hostedcluster_webhook.go b/hypershift-operator/controllers/hostedcluster/hostedcluster_webhook.go index d9eb239f77a5..f5463f667e16 100644 --- a/hypershift-operator/controllers/hostedcluster/hostedcluster_webhook.go +++ b/hypershift-operator/controllers/hostedcluster/hostedcluster_webhook.go @@ -43,6 +43,12 @@ func (defaulter *hostedClusterDefaulter) Default(ctx context.Context, obj runtim hcluster.Spec.Release.Image = pullSpec } + // Default allocateNodeCIDRs to Disabled if not set + if hcluster.Spec.Networking.AllocateNodeCIDRs == nil { + disabled := hyperv1.AllocateNodeCIDRsDisabled + hcluster.Spec.Networking.AllocateNodeCIDRs = &disabled + } + // Default platform specific values switch hcluster.Spec.Platform.Type { case hyperv1.KubevirtPlatform: diff --git a/test/e2e/create_cluster_test.go b/test/e2e/create_cluster_test.go index f1b47b1f2521..d4d985af8815 100644 --- a/test/e2e/create_cluster_test.go +++ b/test/e2e/create_cluster_test.go @@ -780,6 +780,38 @@ func TestOnCreateAPIUX(t *testing.T) { }, expectedErrorSubstring: "CIDR ranges in machineNetwork, clusterNetwork, and serviceNetwork must be unique and non-overlapping", }, + { + name: "when allocateNodeCIDRs is Disabled it should pass", + mutateInput: func(hc *hyperv1.HostedCluster) { + disabled := hyperv1.AllocateNodeCIDRsDisabled + hc.Spec.Networking = hyperv1.ClusterNetworking{ + AllocateNodeCIDRs: &disabled, + } + }, + expectedErrorSubstring: "", + }, + { + name: "when allocateNodeCIDRs is Enabled and networkType is Other it should pass", + mutateInput: func(hc *hyperv1.HostedCluster) { + enabled := hyperv1.AllocateNodeCIDRsEnabled + hc.Spec.Networking = hyperv1.ClusterNetworking{ + AllocateNodeCIDRs: &enabled, + NetworkType: hyperv1.Other, + } + }, + expectedErrorSubstring: "", + }, + { + name: "when allocateNodeCIDRs is Enabled and networkType is not Other it should fail", + mutateInput: func(hc *hyperv1.HostedCluster) { + enabled := hyperv1.AllocateNodeCIDRsEnabled + hc.Spec.Networking = hyperv1.ClusterNetworking{ + AllocateNodeCIDRs: &enabled, + NetworkType: hyperv1.OVNKubernetes, + } + }, + expectedErrorSubstring: "allocateNodeCIDRs can only be set to Enabled when networkType is 'Other'", + }, }, }, { diff --git a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go index 71f3d3969350..44b224c46d8f 100644 --- a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go +++ b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go @@ -1041,6 +1041,7 @@ type DNSSpec struct { // TODO this is available in vanilla kube from 1.31 API servers and in Openshift from 4.16. // TODO(alberto): Use CEL cidr library for all these validation when all management clusters are >= 1.31. // +kubebuilder:validation:XValidation:rule="(!has(self.machineNetwork) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr)) || (has(self.machineNetwork) && (self.machineNetwork.all(m, self.clusterNetwork.all(c, m.cidr != c.cidr)) && self.machineNetwork.all(m, self.serviceNetwork.all(s, m.cidr != s.cidr)) && self.clusterNetwork.all(c, self.serviceNetwork.all(s, c.cidr != s.cidr)))))",message="CIDR ranges in machineNetwork, clusterNetwork, and serviceNetwork must be unique and non-overlapping" +// +kubebuilder:validation:XValidation:rule="has(self.allocateNodeCIDRs) && self.allocateNodeCIDRs == 'Enabled' ? self.networkType == 'Other' : true",message="allocateNodeCIDRs can only be set to Enabled when networkType is 'Other'" type ClusterNetworking struct { // machineNetwork is the list of IP address pools for machines. // This might be used among other things to generate appropriate networking security groups in some clouds providers. @@ -1091,6 +1092,17 @@ type ClusterNetworking struct { // // +optional APIServer *APIServerNetworking `json:"apiServer,omitempty"` + + // allocateNodeCIDRs controls whether the kube-controller-manager manages node CIDR allocation. + // When using networkType=Other, it is recommended to set this field to "Enabled" + // if Flannel is used as the CNI, as it relies on this behavior. + // Default is "Disabled". + // This field can only be set to "Enabled" when NetworkType is "Other". Setting it to "Enabled" + // with any other NetworkType will result in a validation error during cluster creation. + // + // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="allocateNodeCIDRs is immutable and cannot be modified once set." + AllocateNodeCIDRs *AllocateNodeCIDRsMode `json:"allocateNodeCIDRs,omitempty"` } // MachineNetworkEntry is a single IP address block for node IP blocks. @@ -1179,6 +1191,18 @@ const ( Other NetworkType = "Other" ) +// AllocateNodeCIDRsMode specifies whether the KCM manages node CIDR allocation. +// +kubebuilder:validation:Enum=Enabled;Disabled +type AllocateNodeCIDRsMode string + +const ( + // AllocateNodeCIDRsEnabled enables node CIDR allocation by the KCM + AllocateNodeCIDRsEnabled AllocateNodeCIDRsMode = "Enabled" + + // AllocateNodeCIDRsDisabled disables node CIDR allocation by the KCM + AllocateNodeCIDRsDisabled AllocateNodeCIDRsMode = "Disabled" +) + // PlatformType is a specific supported infrastructure provider. // +kubebuilder:validation:MaxLength=100 type PlatformType string diff --git a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go index 033c005b7996..772b255b499b 100644 --- a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go @@ -1093,6 +1093,11 @@ func (in *ClusterNetworking) DeepCopyInto(out *ClusterNetworking) { *out = new(APIServerNetworking) (*in).DeepCopyInto(*out) } + if in.AllocateNodeCIDRs != nil { + in, out := &in.AllocateNodeCIDRs, &out.AllocateNodeCIDRs + *out = new(AllocateNodeCIDRsMode) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNetworking.