Skip to content

Commit 45ce17c

Browse files
committed
Update DNSType in Infra CR's Platform Status
Currently, the DNSType is immutable once set. ARO needs to enable this capability of starting in-cluster DNS on Day-2. That would require changing the value of DNSType on Day-2 to `ClusterHosted`. Similarly, they would also like the option to disable this feature on Day-2 as well.
1 parent 64dddb8 commit 45ce17c

35 files changed

Lines changed: 491 additions & 316 deletions

File tree

config/v1/tests/infrastructures.config.openshift.io/AWSClusterHostedDNS.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ tests:
140140
cloudLoadBalancerConfig:
141141
dnsType: PlatformDefault
142142
type: AWS
143-
expectedStatusError: "status.platformStatus.aws.cloudLoadBalancerConfig.dnsType: Invalid value: \"string\": dnsType is immutable"
143+
expectedStatusError: "status.platformStatus.aws: Invalid value: \"object\": cloudLoadBalancerConfig.dnsType is immutable once set"
144144
- name: Should not accept non-IP address values for Load Balancer IPs
145145
initial: |
146146
apiVersion: config.openshift.io/v1

config/v1/tests/infrastructures.config.openshift.io/AWSClusterHostedDNSInstall.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ tests:
140140
cloudLoadBalancerConfig:
141141
dnsType: PlatformDefault
142142
type: AWS
143-
expectedStatusError: "status.platformStatus.aws.cloudLoadBalancerConfig.dnsType: Invalid value: \"string\": dnsType is immutable"
143+
expectedStatusError: "status.platformStatus.aws: Invalid value: \"object\": cloudLoadBalancerConfig.dnsType is immutable once set"
144144
- name: Should not accept non-IP address values for Load Balancer IPs
145145
initial: |
146146
apiVersion: config.openshift.io/v1

config/v1/tests/infrastructures.config.openshift.io/AzureClusterHostedDNSInstall.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ tests:
104104
dnsType: ClusterHosted
105105
ipFamily: IPv4
106106
type: Azure
107-
- name: Should not allow changing the immutable dnsType field
107+
- name: Should allow changing dnsType field for Azure platform
108108
initial: |
109109
apiVersion: config.openshift.io/v1
110110
kind: Infrastructure
@@ -140,7 +140,24 @@ tests:
140140
cloudLoadBalancerConfig:
141141
dnsType: PlatformDefault
142142
type: Azure
143-
expectedStatusError: "status.platformStatus.azure.cloudLoadBalancerConfig.dnsType: Invalid value: \"string\": dnsType is immutable"
143+
expected: |
144+
apiVersion: config.openshift.io/v1
145+
kind: Infrastructure
146+
spec:
147+
platformSpec:
148+
type: Azure
149+
azure: {}
150+
status:
151+
controlPlaneTopology: HighlyAvailable
152+
cpuPartitioning: None
153+
infrastructureTopology: HighlyAvailable
154+
platform: Azure
155+
platformStatus:
156+
azure:
157+
cloudLoadBalancerConfig:
158+
dnsType: PlatformDefault
159+
ipFamily: IPv4
160+
type: Azure
144161
- name: Should not accept non-IP address values for Load Balancer IPs
145162
initial: |
146163
apiVersion: config.openshift.io/v1

config/v1/tests/infrastructures.config.openshift.io/GCPClusterHostedDNS.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ tests:
138138
cloudLoadBalancerConfig:
139139
dnsType: PlatformDefault
140140
type: GCP
141-
expectedStatusError: "status.platformStatus.gcp.cloudLoadBalancerConfig.dnsType: Invalid value: \"string\": dnsType is immutable"
141+
expectedStatusError: "status.platformStatus.gcp: Invalid value: \"object\": cloudLoadBalancerConfig.dnsType is immutable once set"
142142
- name: Should not accept non-IP address values for Load Balancer IPs
143143
initial: |
144144
apiVersion: config.openshift.io/v1

config/v1/tests/infrastructures.config.openshift.io/GCPClusterHostedDNSInstall.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ tests:
138138
cloudLoadBalancerConfig:
139139
dnsType: PlatformDefault
140140
type: GCP
141-
expectedStatusError: "status.platformStatus.gcp.cloudLoadBalancerConfig.dnsType: Invalid value: \"string\": dnsType is immutable"
141+
expectedStatusError: "status.platformStatus.gcp: Invalid value: \"object\": cloudLoadBalancerConfig.dnsType is immutable once set"
142142
- name: Should not accept non-IP address values for Load Balancer IPs
143143
initial: |
144144
apiVersion: config.openshift.io/v1

config/v1/types_infrastructure.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ type AWSPlatformStatus struct {
559559
//
560560
// +default={"dnsType": "PlatformDefault"}
561561
// +kubebuilder:default={"dnsType": "PlatformDefault"}
562+
// +kubebuilder:validation:XValidation:rule=oldSelf.cloudLoadBalancerConfig.dnsType == '' || self.cloudLoadBalancerConfig.dnsType == oldSelf.cloudLoadBalancerConfig.dnsType,message="cloudLoadBalancerConfig.dnsType is immutable once set"
562563
// +openshift:enable:FeatureGate=AWSClusterHostedDNSInstall
563564
// +optional
564565
// +nullable
@@ -640,6 +641,7 @@ type AzurePlatformStatus struct {
640641
// When using the ClusterHosted DNS type, Load Balancer IP addresses
641642
// must be provided for the API and internal API load balancers as well as the
642643
// ingress load balancer.
644+
// For Azure platform, cloudLoadBalancerConfig.dnsType can be updated after it has been set.
643645
//
644646
// +default={"dnsType": "PlatformDefault"}
645647
// +kubebuilder:default={"dnsType": "PlatformDefault"}
@@ -787,6 +789,7 @@ type GCPPlatformStatus struct {
787789
//
788790
// +default={"dnsType": "PlatformDefault"}
789791
// +kubebuilder:default={"dnsType": "PlatformDefault"}
792+
// +kubebuilder:validation:XValidation:rule="oldSelf.cloudLoadBalancerConfig.dnsType == '' || self.cloudLoadBalancerConfig.dnsType == oldSelf.cloudLoadBalancerConfig.dnsType",message="cloudLoadBalancerConfig.dnsType is immutable once set"
790793
// +openshift:enable:FeatureGate=GCPClusterHostedDNSInstall
791794
// +optional
792795
// +nullable
@@ -877,15 +880,15 @@ type CloudLoadBalancerConfig struct {
877880
// It can be set to `ClusterHosted` to bypass the configuration of the cloud default DNS. In this mode,
878881
// the cluster needs to provide a self-hosted DNS solution for the cluster's installation to succeed.
879882
// The cluster's use of the cloud's Load Balancers is unaffected by this setting.
880-
// The value is immutable after it has been set at install time.
883+
// The value is immutable after it has been set at install time for AWS and GCP platforms.
884+
// For Azure platform, this value can be updated after it has been set.
881885
// Currently, there is no way for the customer to add additional DNS entries into the cluster hosted DNS.
882886
// Enabling this functionality allows the user to start their own DNS solution outside the cluster after
883887
// installation is complete. The customer would be responsible for configuring this custom DNS solution,
884888
// and it can be run in addition to the in-cluster DNS solution.
885889
// +default="PlatformDefault"
886890
// +kubebuilder:default:="PlatformDefault"
887891
// +kubebuilder:validation:Enum="ClusterHosted";"PlatformDefault"
888-
// +kubebuilder:validation:XValidation:rule="oldSelf == '' || self == oldSelf",message="dnsType is immutable"
889892
// +optional
890893
// +unionDiscriminator
891894
DNSType DNSType `json:"dnsType,omitempty"`

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-CustomNoUpgrade.crd.yaml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,8 @@ spec:
13361336
It can be set to `ClusterHosted` to bypass the configuration of the cloud default DNS. In this mode,
13371337
the cluster needs to provide a self-hosted DNS solution for the cluster's installation to succeed.
13381338
The cluster's use of the cloud's Load Balancers is unaffected by this setting.
1339-
The value is immutable after it has been set at install time.
1339+
The value is immutable after it has been set at install time for AWS and GCP platforms.
1340+
For Azure platform, this value can be updated after it has been set.
13401341
Currently, there is no way for the customer to add additional DNS entries into the cluster hosted DNS.
13411342
Enabling this functionality allows the user to start their own DNS solution outside the cluster after
13421343
installation is complete. The customer would be responsible for configuring this custom DNS solution,
@@ -1345,15 +1346,16 @@ spec:
13451346
- ClusterHosted
13461347
- PlatformDefault
13471348
type: string
1348-
x-kubernetes-validations:
1349-
- message: dnsType is immutable
1350-
rule: oldSelf == '' || self == oldSelf
13511349
type: object
13521350
x-kubernetes-validations:
13531351
- message: clusterHosted is permitted only when dnsType is
13541352
ClusterHosted
13551353
rule: 'has(self.dnsType) && self.dnsType != ''ClusterHosted''
13561354
? !has(self.clusterHosted) : true'
1355+
- message: cloudLoadBalancerConfig.dnsType is immutable once
1356+
set
1357+
rule: oldSelf.cloudLoadBalancerConfig.dnsType == '' || self.cloudLoadBalancerConfig.dnsType
1358+
== oldSelf.cloudLoadBalancerConfig.dnsType
13571359
ipFamily:
13581360
default: IPv4
13591361
description: |-
@@ -1466,6 +1468,7 @@ spec:
14661468
When using the ClusterHosted DNS type, Load Balancer IP addresses
14671469
must be provided for the API and internal API load balancers as well as the
14681470
ingress load balancer.
1471+
For Azure platform, cloudLoadBalancerConfig.dnsType can be updated after it has been set.
14691472
properties:
14701473
clusterHosted:
14711474
description: |-
@@ -1541,7 +1544,8 @@ spec:
15411544
It can be set to `ClusterHosted` to bypass the configuration of the cloud default DNS. In this mode,
15421545
the cluster needs to provide a self-hosted DNS solution for the cluster's installation to succeed.
15431546
The cluster's use of the cloud's Load Balancers is unaffected by this setting.
1544-
The value is immutable after it has been set at install time.
1547+
The value is immutable after it has been set at install time for AWS and GCP platforms.
1548+
For Azure platform, this value can be updated after it has been set.
15451549
Currently, there is no way for the customer to add additional DNS entries into the cluster hosted DNS.
15461550
Enabling this functionality allows the user to start their own DNS solution outside the cluster after
15471551
installation is complete. The customer would be responsible for configuring this custom DNS solution,
@@ -1550,9 +1554,6 @@ spec:
15501554
- ClusterHosted
15511555
- PlatformDefault
15521556
type: string
1553-
x-kubernetes-validations:
1554-
- message: dnsType is immutable
1555-
rule: oldSelf == '' || self == oldSelf
15561557
type: object
15571558
x-kubernetes-validations:
15581559
- message: clusterHosted is permitted only when dnsType is
@@ -1918,7 +1919,8 @@ spec:
19181919
It can be set to `ClusterHosted` to bypass the configuration of the cloud default DNS. In this mode,
19191920
the cluster needs to provide a self-hosted DNS solution for the cluster's installation to succeed.
19201921
The cluster's use of the cloud's Load Balancers is unaffected by this setting.
1921-
The value is immutable after it has been set at install time.
1922+
The value is immutable after it has been set at install time for AWS and GCP platforms.
1923+
For Azure platform, this value can be updated after it has been set.
19221924
Currently, there is no way for the customer to add additional DNS entries into the cluster hosted DNS.
19231925
Enabling this functionality allows the user to start their own DNS solution outside the cluster after
19241926
installation is complete. The customer would be responsible for configuring this custom DNS solution,
@@ -1927,15 +1929,16 @@ spec:
19271929
- ClusterHosted
19281930
- PlatformDefault
19291931
type: string
1930-
x-kubernetes-validations:
1931-
- message: dnsType is immutable
1932-
rule: oldSelf == '' || self == oldSelf
19331932
type: object
19341933
x-kubernetes-validations:
19351934
- message: clusterHosted is permitted only when dnsType is
19361935
ClusterHosted
19371936
rule: 'has(self.dnsType) && self.dnsType != ''ClusterHosted''
19381937
? !has(self.clusterHosted) : true'
1938+
- message: cloudLoadBalancerConfig.dnsType is immutable once
1939+
set
1940+
rule: oldSelf.cloudLoadBalancerConfig.dnsType == '' || self.cloudLoadBalancerConfig.dnsType
1941+
== oldSelf.cloudLoadBalancerConfig.dnsType
19391942
projectID:
19401943
description: resourceGroupName is the Project ID for new GCP
19411944
resources created for the cluster.

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-Default.crd.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,8 @@ spec:
15801580
It can be set to `ClusterHosted` to bypass the configuration of the cloud default DNS. In this mode,
15811581
the cluster needs to provide a self-hosted DNS solution for the cluster's installation to succeed.
15821582
The cluster's use of the cloud's Load Balancers is unaffected by this setting.
1583-
The value is immutable after it has been set at install time.
1583+
The value is immutable after it has been set at install time for AWS and GCP platforms.
1584+
For Azure platform, this value can be updated after it has been set.
15841585
Currently, there is no way for the customer to add additional DNS entries into the cluster hosted DNS.
15851586
Enabling this functionality allows the user to start their own DNS solution outside the cluster after
15861587
installation is complete. The customer would be responsible for configuring this custom DNS solution,
@@ -1589,15 +1590,16 @@ spec:
15891590
- ClusterHosted
15901591
- PlatformDefault
15911592
type: string
1592-
x-kubernetes-validations:
1593-
- message: dnsType is immutable
1594-
rule: oldSelf == '' || self == oldSelf
15951593
type: object
15961594
x-kubernetes-validations:
15971595
- message: clusterHosted is permitted only when dnsType is
15981596
ClusterHosted
15991597
rule: 'has(self.dnsType) && self.dnsType != ''ClusterHosted''
16001598
? !has(self.clusterHosted) : true'
1599+
- message: cloudLoadBalancerConfig.dnsType is immutable once
1600+
set
1601+
rule: oldSelf.cloudLoadBalancerConfig.dnsType == '' || self.cloudLoadBalancerConfig.dnsType
1602+
== oldSelf.cloudLoadBalancerConfig.dnsType
16011603
projectID:
16021604
description: resourceGroupName is the Project ID for new GCP
16031605
resources created for the cluster.

0 commit comments

Comments
 (0)