Skip to content

Commit 5fbe128

Browse files
committed
Add RosaRoleConfig API and CRD.
1 parent b925771 commit 5fbe128

20 files changed

+1471
-64
lines changed

PROJECT

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,60 @@ version: "2"
22
domain: cluster.x-k8s.io
33
repo: sigs.k8s.io/cluster-api-provider-aws
44
resources:
5-
# v1beta1 types
65
- group: infrastructure
7-
version: v1beta1
86
kind: AWSMachine
9-
- group: infrastructure
107
version: v1beta1
11-
kind: AWSCluster
128
- group: infrastructure
9+
kind: AWSCluster
1310
version: v1beta1
14-
kind: AWSMachineTemplate
1511
- group: infrastructure
12+
kind: AWSMachineTemplate
1613
version: v1beta1
17-
kind: AWSClusterStaticIdentity
1814
- group: infrastructure
15+
kind: AWSClusterStaticIdentity
1916
version: v1beta1
20-
kind: AWSClusterRoleIdentity
2117
- group: infrastructure
18+
kind: AWSClusterRoleIdentity
2219
version: v1beta1
23-
kind: AWSClusterControllerIdentity
2420
- group: infrastructure
21+
kind: AWSClusterControllerIdentity
2522
version: v1beta1
26-
kind: AWSClusterTemplate
2723
- group: infrastructure
24+
kind: AWSClusterTemplate
2825
version: v1beta1
29-
kind: AWSManagedControlPlanes
3026
- group: infrastructure
27+
kind: AWSManagedControlPlanes
3128
version: v1beta1
29+
- group: infrastructure
3230
kind: AWSManagedCluster
33-
# v1beta2 types
31+
version: v1beta1
3432
- group: infrastructure
35-
version: v1beta2
3633
kind: AWSMachine
37-
- group: infrastructure
3834
version: v1beta2
39-
kind: AWSCluster
4035
- group: infrastructure
36+
kind: AWSCluster
4137
version: v1beta2
42-
kind: AWSMachineTemplate
4338
- group: infrastructure
39+
kind: AWSMachineTemplate
4440
version: v1beta2
45-
kind: AWSClusterStaticIdentity
4641
- group: infrastructure
42+
kind: AWSClusterStaticIdentity
4743
version: v1beta2
48-
kind: AWSClusterRoleIdentity
4944
- group: infrastructure
45+
kind: AWSClusterRoleIdentity
5046
version: v1beta2
51-
kind: AWSClusterControllerIdentity
5247
- group: infrastructure
48+
kind: AWSClusterControllerIdentity
5349
version: v1beta2
54-
kind: AWSClusterTemplate
5550
- group: infrastructure
51+
kind: AWSClusterTemplate
5652
version: v1beta2
57-
kind: AWSManagedControlPlanes
5853
- group: infrastructure
54+
kind: AWSManagedControlPlanes
5955
version: v1beta2
56+
- group: infrastructure
6057
kind: AWSManagedCluster
58+
version: v1beta2
59+
- group: infrastructure
60+
kind: ROSARoleConfig
61+
version: v1beta2

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

Lines changed: 676 additions & 0 deletions
Large diffs are not rendered by default.

config/crd/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ resources:
2424
- bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml
2525
- bases/infrastructure.cluster.x-k8s.io_rosaclusters.yaml
2626
- bases/infrastructure.cluster.x-k8s.io_rosamachinepools.yaml
27+
- bases/infrastructure.cluster.x-k8s.io_rosaroleconfigs.yaml
2728
# +kubebuilder:scaffold:crdkustomizeresource
2829

2930
patchesStrategicMerge:
@@ -38,6 +39,7 @@ patchesStrategicMerge:
3839
- patches/webhook_in_awsmanagedcontrolplanes.yaml
3940
- patches/webhook_in_eksconfigs.yaml
4041
- patches/webhook_in_eksconfigtemplates.yaml
42+
#- patches/webhook_in_rosaroleconfigs.yaml
4143
# +kubebuilder:scaffold:crdkustomizewebhookpatch
4244

4345
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
@@ -52,6 +54,7 @@ patchesStrategicMerge:
5254
- patches/cainjection_in_awsmanagedclusters.yaml
5355
- patches/cainjection_in_eksconfigs.yaml
5456
- patches/cainjection_in_eksconfigtemplates.yaml
57+
#- patches/cainjection_in_rosaroleconfigs.yaml
5558
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
5659

5760
# [LABEL] To enable label, uncomment all the sections with [LABEL] prefix.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# The following patch adds a directive for certmanager to inject CA into the CRD
2+
# CRD conversion requires k8s 1.13 or later.
3+
apiVersion: apiextensions.k8s.io/v1beta1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
annotations:
7+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
8+
name: rosaroleconfigs.infrastructure.cluster.x-k8s.io
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# The following patch enables conversion webhook for CRD
2+
# CRD conversion requires k8s 1.13 or later.
3+
apiVersion: apiextensions.k8s.io/v1beta1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
name: rosaroleconfigs.infrastructure.cluster.x-k8s.io
7+
spec:
8+
conversion:
9+
strategy: Webhook
10+
webhookClientConfig:
11+
service:
12+
namespace: system
13+
name: webhook-service
14+
path: /convert

config/rbac/role.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ rules:
176176
- awsfargateprofiles/status
177177
- rosaclusters/status
178178
- rosamachinepools/status
179+
- rosaroleconfigs/status
179180
verbs:
180181
- get
181182
- patch
@@ -197,6 +198,7 @@ rules:
197198
- infrastructure.cluster.x-k8s.io
198199
resources:
199200
- awsmachines
201+
- rosaroleconfigs
200202
verbs:
201203
- create
202204
- delete

controlplane/rosa/api/v1beta2/rosacontrolplane_types.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222

2323
infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
24-
expinfrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/exp/api/v1beta2"
2524
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2625
)
2726

@@ -327,7 +326,7 @@ type DefaultMachinePoolSpec struct {
327326
// Autoscaling specifies auto scaling behaviour for the default MachinePool. Autoscaling min/max value
328327
// must be equal or multiple of the availability zones count.
329328
// +optional
330-
Autoscaling *expinfrav1.RosaMachinePoolAutoScaling `json:"autoscaling,omitempty"`
329+
Autoscaling *AutoScaling `json:"autoscaling,omitempty"`
331330

332331
// VolumeSize set the disk volume size for the default workers machine pool in Gib. The default is 300 GiB.
333332
// +kubebuilder:validation:Minimum=75
@@ -337,6 +336,14 @@ type DefaultMachinePoolSpec struct {
337336
VolumeSize int `json:"volumeSize,omitempty"`
338337
}
339338

339+
// AutoScaling specifies scaling options.
340+
type AutoScaling struct {
341+
// +kubebuilder:validation:Minimum=1
342+
MinReplicas int `json:"minReplicas,omitempty"`
343+
// +kubebuilder:validation:Minimum=1
344+
MaxReplicas int `json:"maxReplicas,omitempty"`
345+
}
346+
340347
// AWSRolesRef contains references to various AWS IAM roles required for operators to make calls against the AWS API.
341348
type AWSRolesRef struct {
342349
// The referenced role must have a trust relationship that allows it to be assumed via web identity.

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

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exp/api/v1beta2/rosamachinepool_types.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"k8s.io/apimachinery/pkg/util/intstr"
2323

2424
infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
25+
rosacontrolplanev1 "sigs.k8s.io/cluster-api-provider-aws/v2/controlplane/rosa/api/v1beta2"
2526
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2627
)
2728

@@ -79,7 +80,7 @@ type RosaMachinePoolSpec struct {
7980
// Autoscaling specifies auto scaling behaviour for this MachinePool.
8081
// required if Replicas is not configured
8182
// +optional
82-
Autoscaling *RosaMachinePoolAutoScaling `json:"autoscaling,omitempty"`
83+
Autoscaling *rosacontrolplanev1.AutoScaling `json:"autoscaling,omitempty"`
8384

8485
// TuningConfigs specifies the names of the tuning configs to be applied to this MachinePool.
8586
// Tuning configs must already exist.
@@ -139,14 +140,6 @@ type RosaTaint struct {
139140
Effect corev1.TaintEffect `json:"effect"`
140141
}
141142

142-
// RosaMachinePoolAutoScaling specifies scaling options.
143-
type RosaMachinePoolAutoScaling struct {
144-
// +kubebuilder:validation:Minimum=1
145-
MinReplicas int `json:"minReplicas,omitempty"`
146-
// +kubebuilder:validation:Minimum=1
147-
MaxReplicas int `json:"maxReplicas,omitempty"`
148-
}
149-
150143
// RosaUpdateConfig specifies update configuration
151144
type RosaUpdateConfig struct {
152145
// RollingUpdate specifies MaxUnavailable & MaxSurge number of nodes during update.

0 commit comments

Comments
 (0)