Skip to content

Commit 72dacf7

Browse files
committed
CORS-4417: Add UniverseDomain field to GCPPlatformStatus
1 parent ef67063 commit 72dacf7

33 files changed

Lines changed: 718 additions & 6822 deletions

File tree

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "Infrastructure"
3+
crdName: infrastructures.config.openshift.io
4+
featureGates:
5+
- GCPSovereignCloudInstall
6+
tests:
7+
onCreate:
8+
- name: Should be able to create a minimal Infrastructure
9+
initial: |
10+
apiVersion: config.openshift.io/v1
11+
kind: Infrastructure
12+
spec: {} # No spec is required for a Infrastructure
13+
expected: |
14+
apiVersion: config.openshift.io/v1
15+
kind: Infrastructure
16+
spec: {}
17+
onUpdate:
18+
- name: Should be able to set a valid GCP universeDomain
19+
initial: |
20+
apiVersion: config.openshift.io/v1
21+
kind: Infrastructure
22+
spec: {}
23+
status:
24+
controlPlaneTopology: "HighlyAvailable"
25+
infrastructureTopology: "HighlyAvailable"
26+
platform: GCP
27+
platformStatus:
28+
type: GCP
29+
gcp:
30+
cloudLoadBalancerConfig:
31+
dnsType: PlatformDefault
32+
updated: |
33+
apiVersion: config.openshift.io/v1
34+
kind: Infrastructure
35+
spec: {}
36+
status:
37+
controlPlaneTopology: "HighlyAvailable"
38+
cpuPartitioning: "None"
39+
infrastructureTopology: "HighlyAvailable"
40+
platform: GCP
41+
platformStatus:
42+
type: GCP
43+
gcp:
44+
cloudLoadBalancerConfig:
45+
dnsType: PlatformDefault
46+
universeDomain: googleapis.com
47+
expected: |
48+
apiVersion: config.openshift.io/v1
49+
kind: Infrastructure
50+
spec: {}
51+
status:
52+
controlPlaneTopology: "HighlyAvailable"
53+
cpuPartitioning: "None"
54+
infrastructureTopology: "HighlyAvailable"
55+
platform: GCP
56+
platformStatus:
57+
type: GCP
58+
gcp:
59+
cloudLoadBalancerConfig:
60+
dnsType: PlatformDefault
61+
universeDomain: googleapis.com
62+
- name: Should be able to set a sovereign cloud GCP universeDomain
63+
initial: |
64+
apiVersion: config.openshift.io/v1
65+
kind: Infrastructure
66+
spec: {}
67+
status:
68+
controlPlaneTopology: "HighlyAvailable"
69+
infrastructureTopology: "HighlyAvailable"
70+
platform: GCP
71+
platformStatus:
72+
type: GCP
73+
gcp:
74+
cloudLoadBalancerConfig:
75+
dnsType: PlatformDefault
76+
updated: |
77+
apiVersion: config.openshift.io/v1
78+
kind: Infrastructure
79+
spec: {}
80+
status:
81+
controlPlaneTopology: "HighlyAvailable"
82+
infrastructureTopology: "HighlyAvailable"
83+
platform: GCP
84+
platformStatus:
85+
type: GCP
86+
gcp:
87+
cloudLoadBalancerConfig:
88+
dnsType: PlatformDefault
89+
universeDomain: s3nsapis.fr
90+
expected: |
91+
apiVersion: config.openshift.io/v1
92+
kind: Infrastructure
93+
spec: {}
94+
status:
95+
controlPlaneTopology: "HighlyAvailable"
96+
cpuPartitioning: "None"
97+
infrastructureTopology: "HighlyAvailable"
98+
platform: GCP
99+
platformStatus:
100+
type: GCP
101+
gcp:
102+
cloudLoadBalancerConfig:
103+
dnsType: PlatformDefault
104+
universeDomain: s3nsapis.fr
105+
- name: Should not allow an invalid GCP universeDomain with uppercase characters
106+
initial: |
107+
apiVersion: config.openshift.io/v1
108+
kind: Infrastructure
109+
spec: {}
110+
status:
111+
controlPlaneTopology: "HighlyAvailable"
112+
infrastructureTopology: "HighlyAvailable"
113+
platform: GCP
114+
platformStatus:
115+
type: GCP
116+
gcp:
117+
cloudLoadBalancerConfig:
118+
dnsType: PlatformDefault
119+
updated: |
120+
apiVersion: config.openshift.io/v1
121+
kind: Infrastructure
122+
spec: {}
123+
status:
124+
controlPlaneTopology: "HighlyAvailable"
125+
infrastructureTopology: "HighlyAvailable"
126+
platform: GCP
127+
platformStatus:
128+
type: GCP
129+
gcp:
130+
cloudLoadBalancerConfig:
131+
dnsType: PlatformDefault
132+
universeDomain: GoogleApis.Com
133+
expectedStatusError: "universeDomain must be a valid DNS subdomain"
134+
- name: Should not allow an invalid GCP universeDomain with spaces
135+
initial: |
136+
apiVersion: config.openshift.io/v1
137+
kind: Infrastructure
138+
spec: {}
139+
status:
140+
controlPlaneTopology: "HighlyAvailable"
141+
infrastructureTopology: "HighlyAvailable"
142+
platform: GCP
143+
platformStatus:
144+
type: GCP
145+
gcp:
146+
cloudLoadBalancerConfig:
147+
dnsType: PlatformDefault
148+
updated: |
149+
apiVersion: config.openshift.io/v1
150+
kind: Infrastructure
151+
spec: {}
152+
status:
153+
controlPlaneTopology: "HighlyAvailable"
154+
infrastructureTopology: "HighlyAvailable"
155+
platform: GCP
156+
platformStatus:
157+
type: GCP
158+
gcp:
159+
cloudLoadBalancerConfig:
160+
dnsType: PlatformDefault
161+
universeDomain: "not a domain"
162+
expectedStatusError: "universeDomain must be a valid DNS subdomain"
163+
- name: Should not allow a GCP universeDomain starting with a hyphen
164+
initial: |
165+
apiVersion: config.openshift.io/v1
166+
kind: Infrastructure
167+
spec: {}
168+
status:
169+
controlPlaneTopology: "HighlyAvailable"
170+
infrastructureTopology: "HighlyAvailable"
171+
platform: GCP
172+
platformStatus:
173+
type: GCP
174+
gcp:
175+
cloudLoadBalancerConfig:
176+
dnsType: PlatformDefault
177+
updated: |
178+
apiVersion: config.openshift.io/v1
179+
kind: Infrastructure
180+
spec: {}
181+
status:
182+
controlPlaneTopology: "HighlyAvailable"
183+
infrastructureTopology: "HighlyAvailable"
184+
platform: GCP
185+
platformStatus:
186+
type: GCP
187+
gcp:
188+
cloudLoadBalancerConfig:
189+
dnsType: PlatformDefault
190+
universeDomain: "-invalid.com"
191+
expectedStatusError: "universeDomain must be a valid DNS subdomain"

config/v1/types_infrastructure.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,24 @@ type GCPPlatformStatus struct {
807807
// +nullable
808808
CloudLoadBalancerConfig *CloudLoadBalancerConfig `json:"cloudLoadBalancerConfig,omitempty"`
809809

810+
// universeDomain is the GCP universe domain for the cluster, detected from
811+
// the installer credentials. Components with their own GCP credentials should
812+
// read the universe domain from those credentials, as they are the authoritative
813+
// source. This field is provided for components that do not have GCP credentials
814+
// and for general observability.
815+
//
816+
// When omitted, standard public GCP (googleapis.com) is assumed.
817+
//
818+
// universeDomain must be a valid DNS subdomain: it must contain no more than 253 characters,
819+
// contain only lowercase alphanumeric characters, '-' or '.', and start and end with an alphanumeric character.
820+
//
821+
// +kubebuilder:validation:MinLength=1
822+
// +kubebuilder:validation:MaxLength=253
823+
// +kubebuilder:validation:XValidation:rule="!format.dns1123Subdomain().validate(self).hasValue()",message="universeDomain must be a valid DNS subdomain: contain no more than 253 characters, contain only lowercase alphanumeric characters, '-' or '.', and start and end with an alphanumeric character"
824+
// +optional
825+
// +openshift:enable:FeatureGate=GCPSovereignCloudInstall
826+
UniverseDomain string `json:"universeDomain,omitempty"`
827+
810828
// This field was introduced and removed under tech preview.
811829
// serviceEndpoints specifies endpoints that override the default endpoints
812830
// used when creating clients to interact with GCP services.

config/v1/types_infrastructure_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
const (
1414
infraCRDDefaultFilePath = "0000_10_config-operator_01_infrastructures-Default.crd.yaml"
15-
infraCRDTestPreviewFilePath = "0000_10_config-operator_01_infrastructures-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml"
15+
infraCRDTestPreviewFilePath = "0000_10_config-operator_01_infrastructures-TechPreviewNoUpgrade.crd.yaml"
1616
)
1717

1818
// TestInfrastructureStatusDefault verifies that the infrastructure CR status does not have default value

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,27 @@ spec:
20622062
- message: resourceTags are immutable and may only be configured
20632063
during installation
20642064
rule: self.all(x, x in oldSelf) && oldSelf.all(x, x in self)
2065+
universeDomain:
2066+
description: |-
2067+
universeDomain is the GCP universe domain for the cluster, detected from
2068+
the installer credentials. Components with their own GCP credentials should
2069+
read the universe domain from those credentials, as they are the authoritative
2070+
source. This field is provided for components that do not have GCP credentials
2071+
and for general observability.
2072+
2073+
When omitted, standard public GCP (googleapis.com) is assumed.
2074+
2075+
universeDomain must be a valid DNS subdomain: it must contain no more than 253 characters,
2076+
contain only lowercase alphanumeric characters, '-' or '.', and start and end with an alphanumeric character.
2077+
maxLength: 253
2078+
minLength: 1
2079+
type: string
2080+
x-kubernetes-validations:
2081+
- message: 'universeDomain must be a valid DNS subdomain:
2082+
contain no more than 253 characters, contain only lowercase
2083+
alphanumeric characters, ''-'' or ''.'', and start and
2084+
end with an alphanumeric character'
2085+
rule: '!format.dns1123Subdomain().validate(self).hasValue()'
20652086
type: object
20662087
x-kubernetes-validations:
20672088
- message: resourceLabels may only be configured during installation

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,27 @@ spec:
20472047
- message: resourceTags are immutable and may only be configured
20482048
during installation
20492049
rule: self.all(x, x in oldSelf) && oldSelf.all(x, x in self)
2050+
universeDomain:
2051+
description: |-
2052+
universeDomain is the GCP universe domain for the cluster, detected from
2053+
the installer credentials. Components with their own GCP credentials should
2054+
read the universe domain from those credentials, as they are the authoritative
2055+
source. This field is provided for components that do not have GCP credentials
2056+
and for general observability.
2057+
2058+
When omitted, standard public GCP (googleapis.com) is assumed.
2059+
2060+
universeDomain must be a valid DNS subdomain: it must contain no more than 253 characters,
2061+
contain only lowercase alphanumeric characters, '-' or '.', and start and end with an alphanumeric character.
2062+
maxLength: 253
2063+
minLength: 1
2064+
type: string
2065+
x-kubernetes-validations:
2066+
- message: 'universeDomain must be a valid DNS subdomain:
2067+
contain no more than 253 characters, contain only lowercase
2068+
alphanumeric characters, ''-'' or ''.'', and start and
2069+
end with an alphanumeric character'
2070+
rule: '!format.dns1123Subdomain().validate(self).hasValue()'
20502071
type: object
20512072
x-kubernetes-validations:
20522073
- message: resourceLabels may only be configured during installation

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,27 @@ spec:
20622062
- message: resourceTags are immutable and may only be configured
20632063
during installation
20642064
rule: self.all(x, x in oldSelf) && oldSelf.all(x, x in self)
2065+
universeDomain:
2066+
description: |-
2067+
universeDomain is the GCP universe domain for the cluster, detected from
2068+
the installer credentials. Components with their own GCP credentials should
2069+
read the universe domain from those credentials, as they are the authoritative
2070+
source. This field is provided for components that do not have GCP credentials
2071+
and for general observability.
2072+
2073+
When omitted, standard public GCP (googleapis.com) is assumed.
2074+
2075+
universeDomain must be a valid DNS subdomain: it must contain no more than 253 characters,
2076+
contain only lowercase alphanumeric characters, '-' or '.', and start and end with an alphanumeric character.
2077+
maxLength: 253
2078+
minLength: 1
2079+
type: string
2080+
x-kubernetes-validations:
2081+
- message: 'universeDomain must be a valid DNS subdomain:
2082+
contain no more than 253 characters, contain only lowercase
2083+
alphanumeric characters, ''-'' or ''.'', and start and
2084+
end with an alphanumeric character'
2085+
rule: '!format.dns1123Subdomain().validate(self).hasValue()'
20652086
type: object
20662087
x-kubernetes-validations:
20672088
- message: resourceLabels may only be configured during installation

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,27 @@ spec:
20622062
- message: resourceTags are immutable and may only be configured
20632063
during installation
20642064
rule: self.all(x, x in oldSelf) && oldSelf.all(x, x in self)
2065+
universeDomain:
2066+
description: |-
2067+
universeDomain is the GCP universe domain for the cluster, detected from
2068+
the installer credentials. Components with their own GCP credentials should
2069+
read the universe domain from those credentials, as they are the authoritative
2070+
source. This field is provided for components that do not have GCP credentials
2071+
and for general observability.
2072+
2073+
When omitted, standard public GCP (googleapis.com) is assumed.
2074+
2075+
universeDomain must be a valid DNS subdomain: it must contain no more than 253 characters,
2076+
contain only lowercase alphanumeric characters, '-' or '.', and start and end with an alphanumeric character.
2077+
maxLength: 253
2078+
minLength: 1
2079+
type: string
2080+
x-kubernetes-validations:
2081+
- message: 'universeDomain must be a valid DNS subdomain:
2082+
contain no more than 253 characters, contain only lowercase
2083+
alphanumeric characters, ''-'' or ''.'', and start and
2084+
end with an alphanumeric character'
2085+
rule: '!format.dns1123Subdomain().validate(self).hasValue()'
20652086
type: object
20662087
x-kubernetes-validations:
20672088
- message: resourceLabels may only be configured during installation

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml renamed to config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-TechPreviewNoUpgrade.crd.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ metadata:
44
annotations:
55
api-approved.openshift.io: https://github.com/openshift/api/pull/470
66
api.openshift.io/merged-by-featuregates: "true"
7+
include.release.openshift.io/ibm-cloud-managed: "true"
78
include.release.openshift.io/self-managed-high-availability: "true"
89
release.openshift.io/bootstrap-required: "true"
910
release.openshift.io/feature-set: TechPreviewNoUpgrade

config/v1/zz_generated.featuregated-crd-manifests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ infrastructures.config.openshift.io:
399399
- AzureDualStackInstall
400400
- DualReplica
401401
- DyanmicServiceEndpointIBMCloud
402+
- GCPSovereignCloudInstall
402403
- MutableTopology
403404
- NutanixMultiSubnets
404405
- OnPremDNSRecords

0 commit comments

Comments
 (0)