Skip to content

Commit 0b59c11

Browse files
authored
Merge pull request #4765 from stevekuznetsov/skuznets/use-rosa-library
✨ rosa: use the openshift/rosa libraries where we can
2 parents 9b8a4a7 + bf714d8 commit 0b59c11

22 files changed

+663
-1010
lines changed

config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ spec:
5151
items:
5252
type: string
5353
type: array
54+
billingAccount:
55+
description: BillingAccount is an optional AWS account to use for
56+
billing the subscription fees for ROSA clusters. The cost of running
57+
each ROSA cluster will be billed to the infrastructure account in
58+
which the cluster is running.
59+
type: string
60+
x-kubernetes-validations:
61+
- message: billingAccount is immutable
62+
rule: self == oldSelf
63+
- message: billingAccount must be a valid AWS account ID
64+
rule: self.matches('^[0-9]{12}$')
5465
controlPlaneEndpoint:
5566
description: ControlPlaneEndpoint represents the endpoint used to
5667
communicate with the control plane.
@@ -286,8 +297,11 @@ spec:
286297
supportRoleARN:
287298
type: string
288299
version:
289-
description: Openshift version, for example "4.14.5".
300+
description: OpenShift semantic version, for example "4.14.5".
290301
type: string
302+
x-kubernetes-validations:
303+
- message: version must be a valid semantic version
304+
rule: self.matches('^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$')
291305
workerRoleARN:
292306
type: string
293307
required:

config/crd/bases/infrastructure.cluster.x-k8s.io_rosamachinepools.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ spec:
9898
description: Version specifies the penshift version of the nodes associated
9999
with this machinepool. ROSAControlPlane version is used if not set.
100100
type: string
101+
x-kubernetes-validations:
102+
- message: version must be a valid semantic version
103+
rule: self.matches('^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$')
101104
required:
102105
- nodePoolName
103106
type: object

config/webhook/manifests.yaml

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -201,28 +201,6 @@ webhooks:
201201
resources:
202202
- awsmanagedmachinepools
203203
sideEffects: None
204-
- admissionReviewVersions:
205-
- v1
206-
- v1beta1
207-
clientConfig:
208-
service:
209-
name: webhook-service
210-
namespace: system
211-
path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-rosamachinepool
212-
failurePolicy: Fail
213-
matchPolicy: Equivalent
214-
name: default.rosamachinepool.infrastructure.cluster.x-k8s.io
215-
rules:
216-
- apiGroups:
217-
- infrastructure.cluster.x-k8s.io
218-
apiVersions:
219-
- v1beta2
220-
operations:
221-
- CREATE
222-
- UPDATE
223-
resources:
224-
- rosamachinepools
225-
sideEffects: None
226204
- admissionReviewVersions:
227205
- v1
228206
- v1beta1
@@ -289,28 +267,6 @@ webhooks:
289267
resources:
290268
- awsmanagedcontrolplanes
291269
sideEffects: None
292-
- admissionReviewVersions:
293-
- v1
294-
- v1beta1
295-
clientConfig:
296-
service:
297-
name: webhook-service
298-
namespace: system
299-
path: /mutate-controlplane-cluster-x-k8s-io-v1beta2-rosacontrolplane
300-
failurePolicy: Fail
301-
matchPolicy: Equivalent
302-
name: default.rosacontrolplanes.controlplane.cluster.x-k8s.io
303-
rules:
304-
- apiGroups:
305-
- controlplane.cluster.x-k8s.io
306-
apiVersions:
307-
- v1beta2
308-
operations:
309-
- CREATE
310-
- UPDATE
311-
resources:
312-
- rosacontrolplanes
313-
sideEffects: None
314270
---
315271
apiVersion: admissionregistration.k8s.io/v1
316272
kind: ValidatingWebhookConfiguration
@@ -537,28 +493,6 @@ webhooks:
537493
resources:
538494
- awsmanagedmachinepools
539495
sideEffects: None
540-
- admissionReviewVersions:
541-
- v1
542-
- v1beta1
543-
clientConfig:
544-
service:
545-
name: webhook-service
546-
namespace: system
547-
path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-rosamachinepool
548-
failurePolicy: Fail
549-
matchPolicy: Equivalent
550-
name: validation.rosamachinepool.infrastructure.cluster.x-k8s.io
551-
rules:
552-
- apiGroups:
553-
- infrastructure.cluster.x-k8s.io
554-
apiVersions:
555-
- v1beta2
556-
operations:
557-
- CREATE
558-
- UPDATE
559-
resources:
560-
- rosamachinepools
561-
sideEffects: None
562496
- admissionReviewVersions:
563497
- v1
564498
- v1beta1
@@ -625,25 +559,3 @@ webhooks:
625559
resources:
626560
- awsmanagedcontrolplanes
627561
sideEffects: None
628-
- admissionReviewVersions:
629-
- v1
630-
- v1beta1
631-
clientConfig:
632-
service:
633-
name: webhook-service
634-
namespace: system
635-
path: /validate-controlplane-cluster-x-k8s-io-v1beta2-rosacontrolplane
636-
failurePolicy: Fail
637-
matchPolicy: Equivalent
638-
name: validation.rosacontrolplanes.controlplane.cluster.x-k8s.io
639-
rules:
640-
- apiGroups:
641-
- controlplane.cluster.x-k8s.io
642-
apiVersions:
643-
- v1beta2
644-
operations:
645-
- CREATE
646-
- UPDATE
647-
resources:
648-
- rosacontrolplanes
649-
sideEffects: None

controlplane/rosa/api/v1beta2/rosacontrolplane_types.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ type RosaControlPlaneSpec struct { //nolint: maligned
4949
// The AWS Region the cluster lives in.
5050
Region *string `json:"region"`
5151

52-
// Openshift version, for example "4.14.5".
52+
// OpenShift semantic version, for example "4.14.5".
53+
// +kubebuilder:validation:XValidation:rule=`self.matches('^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$')`, message="version must be a valid semantic version"
5354
Version string `json:"version"`
5455

5556
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
@@ -67,6 +68,16 @@ type RosaControlPlaneSpec struct { //nolint: maligned
6768
SupportRoleARN *string `json:"supportRoleARN"`
6869
WorkerRoleARN *string `json:"workerRoleARN"`
6970

71+
// +immutable
72+
// +kubebuilder:validation:Optional
73+
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="billingAccount is immutable"
74+
// +kubebuilder:validation:XValidation:rule="self.matches('^[0-9]{12}$')", message="billingAccount must be a valid AWS account ID"
75+
76+
// BillingAccount is an optional AWS account to use for billing the subscription fees for ROSA clusters.
77+
// The cost of running each ROSA cluster will be billed to the infrastructure account in which the cluster
78+
// is running.
79+
BillingAccount string `json:"billingAccount,omitempty"`
80+
7081
// CredentialsSecretRef references a secret with necessary credentials to connect to the OCM API.
7182
// The secret should contain the following data keys:
7283
// - ocmToken: eyJhbGciOiJIUzI1NiIsI....

controlplane/rosa/api/v1beta2/rosacontrolplane_webhook.go

Lines changed: 0 additions & 81 deletions
This file was deleted.

controlplane/rosa/api/v1beta2/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)