Skip to content

Commit

Permalink
Merge pull request #4765 from stevekuznetsov/skuznets/use-rosa-library
Browse files Browse the repository at this point in the history
✨  rosa: use the openshift/rosa libraries where we can
  • Loading branch information
k8s-ci-robot authored Feb 27, 2024
2 parents 9b8a4a7 + bf714d8 commit 0b59c11
Show file tree
Hide file tree
Showing 22 changed files with 663 additions and 1,010 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ spec:
items:
type: string
type: array
billingAccount:
description: BillingAccount is an optional AWS account to use for
billing the subscription fees for ROSA clusters. The cost of running
each ROSA cluster will be billed to the infrastructure account in
which the cluster is running.
type: string
x-kubernetes-validations:
- message: billingAccount is immutable
rule: self == oldSelf
- message: billingAccount must be a valid AWS account ID
rule: self.matches('^[0-9]{12}$')
controlPlaneEndpoint:
description: ControlPlaneEndpoint represents the endpoint used to
communicate with the control plane.
Expand Down Expand Up @@ -286,8 +297,11 @@ spec:
supportRoleARN:
type: string
version:
description: Openshift version, for example "4.14.5".
description: OpenShift semantic version, for example "4.14.5".
type: string
x-kubernetes-validations:
- message: version must be a valid semantic version
rule: self.matches('^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$')
workerRoleARN:
type: string
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ spec:
description: Version specifies the penshift version of the nodes associated
with this machinepool. ROSAControlPlane version is used if not set.
type: string
x-kubernetes-validations:
- message: version must be a valid semantic version
rule: self.matches('^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$')
required:
- nodePoolName
type: object
Expand Down
88 changes: 0 additions & 88 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,28 +201,6 @@ webhooks:
resources:
- awsmanagedmachinepools
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-rosamachinepool
failurePolicy: Fail
matchPolicy: Equivalent
name: default.rosamachinepool.infrastructure.cluster.x-k8s.io
rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
apiVersions:
- v1beta2
operations:
- CREATE
- UPDATE
resources:
- rosamachinepools
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
Expand Down Expand Up @@ -289,28 +267,6 @@ webhooks:
resources:
- awsmanagedcontrolplanes
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-controlplane-cluster-x-k8s-io-v1beta2-rosacontrolplane
failurePolicy: Fail
matchPolicy: Equivalent
name: default.rosacontrolplanes.controlplane.cluster.x-k8s.io
rules:
- apiGroups:
- controlplane.cluster.x-k8s.io
apiVersions:
- v1beta2
operations:
- CREATE
- UPDATE
resources:
- rosacontrolplanes
sideEffects: None
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down Expand Up @@ -537,28 +493,6 @@ webhooks:
resources:
- awsmanagedmachinepools
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-rosamachinepool
failurePolicy: Fail
matchPolicy: Equivalent
name: validation.rosamachinepool.infrastructure.cluster.x-k8s.io
rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
apiVersions:
- v1beta2
operations:
- CREATE
- UPDATE
resources:
- rosamachinepools
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
Expand Down Expand Up @@ -625,25 +559,3 @@ webhooks:
resources:
- awsmanagedcontrolplanes
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-controlplane-cluster-x-k8s-io-v1beta2-rosacontrolplane
failurePolicy: Fail
matchPolicy: Equivalent
name: validation.rosacontrolplanes.controlplane.cluster.x-k8s.io
rules:
- apiGroups:
- controlplane.cluster.x-k8s.io
apiVersions:
- v1beta2
operations:
- CREATE
- UPDATE
resources:
- rosacontrolplanes
sideEffects: None
13 changes: 12 additions & 1 deletion controlplane/rosa/api/v1beta2/rosacontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ type RosaControlPlaneSpec struct { //nolint: maligned
// The AWS Region the cluster lives in.
Region *string `json:"region"`

// Openshift version, for example "4.14.5".
// OpenShift semantic version, for example "4.14.5".
// +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"
Version string `json:"version"`

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

// +immutable
// +kubebuilder:validation:Optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="billingAccount is immutable"
// +kubebuilder:validation:XValidation:rule="self.matches('^[0-9]{12}$')", message="billingAccount must be a valid AWS account ID"

// BillingAccount is an optional AWS account to use for billing the subscription fees for ROSA clusters.
// The cost of running each ROSA cluster will be billed to the infrastructure account in which the cluster
// is running.
BillingAccount string `json:"billingAccount,omitempty"`

// CredentialsSecretRef references a secret with necessary credentials to connect to the OCM API.
// The secret should contain the following data keys:
// - ocmToken: eyJhbGciOiJIUzI1NiIsI....
Expand Down
81 changes: 0 additions & 81 deletions controlplane/rosa/api/v1beta2/rosacontrolplane_webhook.go

This file was deleted.

2 changes: 1 addition & 1 deletion controlplane/rosa/api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b59c11

Please sign in to comment.