Skip to content

Commit 8c97932

Browse files
jaswalkiranavtaralex0chan
andauthoredFeb 26, 2025
✨ Adding a new field to clustermanager API to pass list of aws tags to be added to aws resources (#358)
* Adding aa new field to clustermanager to pass list of aws tags to be added to aws resources Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * move configuration to each driver struct Signed-off-by: Alex <alexchan2988@gmail.com> * standardizing registration driver names Signed-off-by: Alex <alexchan2988@gmail.com> --------- Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> Signed-off-by: Alex <alexchan2988@gmail.com> Co-authored-by: Alex <alexchan2988@gmail.com>
1 parent 4281b76 commit 8c97932

5 files changed

+141
-26
lines changed
 

‎operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml

+34-13
Original file line numberDiff line numberDiff line change
@@ -269,19 +269,40 @@ spec:
269269
- csr
270270
- awsirsa
271271
type: string
272-
autoApprovedIdentities:
273-
description: |-
274-
For csr authentication type, AutoApprovedIdentities represent a list of approved users
275-
For awsirsa authentication type, AutoApprovedIdentities represent a list of approved arn patterns
276-
items:
277-
type: string
278-
type: array
279-
hubClusterArn:
280-
description: |-
281-
This represents the hub cluster ARN
282-
Example - arn:eks:us-west-2:12345678910:cluster/hub-cluster1
283-
pattern: ^arn:aws:eks:([a-zA-Z0-9-]+):(\d{12}):cluster/([a-zA-Z0-9-]+)$
284-
type: string
272+
awsisra:
273+
description: AwsIrsa represents the configuration for awsisra
274+
driver.
275+
properties:
276+
autoApprovedIdentities:
277+
description: AutoApprovedIdentities represent a list
278+
of approved arn patterns
279+
items:
280+
type: string
281+
type: array
282+
hubClusterArn:
283+
description: |-
284+
This represents the hub cluster ARN
285+
Example - arn:eks:us-west-2:12345678910:cluster/hub-cluster1
286+
pattern: ^arn:aws:eks:([a-zA-Z0-9-]+):(\d{12}):cluster/([a-zA-Z0-9-]+)$
287+
type: string
288+
tags:
289+
description: |-
290+
List of tags to be added to AWS resources created by hub while processing awsirsa registration request
291+
Example - "product:v1:tenant:app-name=My-App"
292+
items:
293+
type: string
294+
type: array
295+
type: object
296+
csr:
297+
description: CSR represents the configuration for csr driver.
298+
properties:
299+
autoApprovedIdentities:
300+
description: AutoApprovedIdentities represent a list
301+
of approved users
302+
items:
303+
type: string
304+
type: array
305+
type: object
285306
type: object
286307
type: array
287308
x-kubernetes-list-map-keys:

‎operator/v1/types_clustermanager.go

+22-2
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,36 @@ type RegistrationDriverHub struct {
125125
// +kubebuilder:validation:Enum=csr;awsirsa
126126
AuthType string `json:"authType,omitempty"`
127127

128+
// CSR represents the configuration for csr driver.
129+
// +optional
130+
CSR *CSRConfig `json:"csr,omitempty"`
131+
132+
// AwsIrsa represents the configuration for awsisra driver.
133+
// +optional
134+
AwsIrsa *AwsIrsaConfig `json:"awsisra,omitempty"`
135+
}
136+
137+
type CSRConfig struct {
138+
// AutoApprovedIdentities represent a list of approved users
139+
// +optional
140+
AutoApprovedIdentities []string `json:"autoApprovedIdentities,omitempty"`
141+
}
142+
143+
type AwsIrsaConfig struct {
128144
// This represents the hub cluster ARN
129145
// Example - arn:eks:us-west-2:12345678910:cluster/hub-cluster1
130146
// +optional
131147
// +kubebuilder:validation:Pattern=`^arn:aws:eks:([a-zA-Z0-9-]+):(\d{12}):cluster/([a-zA-Z0-9-]+)$`
132148
HubClusterArn string `json:"hubClusterArn,omitempty"`
133149

134-
// For csr authentication type, AutoApprovedIdentities represent a list of approved users
135-
// For awsirsa authentication type, AutoApprovedIdentities represent a list of approved arn patterns
150+
// AutoApprovedIdentities represent a list of approved arn patterns
136151
// +optional
137152
AutoApprovedIdentities []string `json:"autoApprovedIdentities,omitempty"`
153+
154+
// List of tags to be added to AWS resources created by hub while processing awsirsa registration request
155+
// Example - "product:v1:tenant:app-name=My-App"
156+
// +optional
157+
Tags []string `json:"tags,omitempty"`
138158
}
139159

140160
type WorkConfiguration struct {

‎operator/v1/zz_generated.deepcopy.go

+56-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎operator/v1/zz_generated.swagger_doc_generated.go

+21-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/integration/api/clustermanager_test.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ var _ = Describe("ClusterManager API test with RegistrationConfiguration", func(
271271
RegistrationConfiguration: &operatorv1.RegistrationHubConfiguration{
272272
RegistrationDrivers: []operatorv1.RegistrationDriverHub{
273273
{
274-
AuthType: "awsirsa",
275-
HubClusterArn: "arn:aws:bks:us-west-2:123456789012:cluster/hub-cluster1",
274+
AuthType: "awsirsa",
275+
AwsIrsa: &operatorv1.AwsIrsaConfig{
276+
HubClusterArn: "arn:aws:bks:us-west-2:123456789012:cluster/hub-cluster1",
277+
},
276278
},
277279
},
278280
},
@@ -291,8 +293,10 @@ var _ = Describe("ClusterManager API test with RegistrationConfiguration", func(
291293
RegistrationConfiguration: &operatorv1.RegistrationHubConfiguration{
292294
RegistrationDrivers: []operatorv1.RegistrationDriverHub{
293295
{
294-
AuthType: "awsirsa",
295-
HubClusterArn: "arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1",
296+
AuthType: "awsirsa",
297+
AwsIrsa: &operatorv1.AwsIrsaConfig{
298+
HubClusterArn: "arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1",
299+
},
296300
},
297301
},
298302
},

0 commit comments

Comments
 (0)