Skip to content

Commit 4f386f8

Browse files
committed
Support custom IAM management in AWS registration
Signed-off-by: Ben Perry <[email protected]>
1 parent 567caa2 commit 4f386f8

24 files changed

+123
-23
lines changed

deploy/cluster-manager/chart/cluster-manager/crds/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ spec:
279279
items:
280280
type: string
281281
type: array
282+
disableManagedIam:
283+
description: |-
284+
DisableManagedIam disables creation and management of IAM roles and policies on the hub.
285+
If true, all AWS permissions for awsirsa registration must be managed manually by the administrator.
286+
Used in cases where IAM permissions cannot be granted to OCM, or to run an EKS hub with non-aws spoke clusters.
287+
type: boolean
282288
hubClusterArn:
283289
description: |-
284290
This represents the hub cluster ARN

deploy/cluster-manager/config/crds/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ spec:
279279
items:
280280
type: string
281281
type: array
282+
disableManagedIam:
283+
description: |-
284+
DisableManagedIam disables creation and management of IAM roles and policies on the hub.
285+
If true, all AWS permissions for awsirsa registration must be managed manually by the administrator.
286+
Used in cases where IAM permissions cannot be granted to OCM, or to run an EKS hub with non-aws spoke clusters.
287+
type: boolean
282288
hubClusterArn:
283289
description: |-
284290
This represents the hub cluster ARN

deploy/cluster-manager/olm-catalog/latest/manifests/operator.open-cluster-management.io_clustermanagers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ spec:
279279
items:
280280
type: string
281281
type: array
282+
disableManagedIam:
283+
description: |-
284+
DisableManagedIAM disables IAM role management in the hub. All required IAM roles
285+
must be created by the administrator.
286+
type: boolean
282287
hubClusterArn:
283288
description: |-
284289
This represents the hub cluster ARN

deploy/klusterlet/chart/klusterlet/crds/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,20 @@ spec:
341341
minLength: 1
342342
pattern: ^arn:aws:eks:([a-zA-Z0-9-]+):(\d{12}):cluster/([a-zA-Z0-9-]+)$
343343
type: string
344+
iamConfigSecret:
345+
description: |-
346+
IamConfigSecret is the name of a secret containing "config" and/or "credentials" files mounted to ~/.aws/config and ~/.aws/credentials respectively.
347+
More Info: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
348+
type: string
344349
managedClusterArn:
345350
description: |-
346-
The arn of the managed cluster (ie: an EKS cluster). This will be required to generate the md5hash which will be used as a suffix to create IAM role on hub
351+
The arn of the managed cluster (ie: an EKS cluster). This will be used when managed IAM is enabled to generate the md5hash as a suffix to create IAM role on hub
347352
as well as used by kluslerlet-agent, to assume role suffixed with the md5hash, on startup.
348353
Example - arn:eks:us-west-2:12345678910:cluster/managed-cluster1.
349-
minLength: 1
350354
pattern: ^arn:aws:eks:([a-zA-Z0-9-]+):(\d{12}):cluster/([a-zA-Z0-9-]+)$
351355
type: string
352356
required:
353357
- hubClusterArn
354-
- managedClusterArn
355358
type: object
356359
required:
357360
- authType

deploy/klusterlet/config/crds/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,20 @@ spec:
341341
minLength: 1
342342
pattern: ^arn:aws:eks:([a-zA-Z0-9-]+):(\d{12}):cluster/([a-zA-Z0-9-]+)$
343343
type: string
344+
iamConfigSecret:
345+
description: |-
346+
IamConfigSecret is the name of a secret containing "config" and/or "credentials" files mounted to ~/.aws/config and ~/.aws/credentials respectively.
347+
More Info: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
348+
type: string
344349
managedClusterArn:
345350
description: |-
346-
The arn of the managed cluster (ie: an EKS cluster). This will be required to generate the md5hash which will be used as a suffix to create IAM role on hub
351+
The arn of the managed cluster (ie: an EKS cluster). This will be used when managed IAM is enabled to generate the md5hash as a suffix to create IAM role on hub
347352
as well as used by kluslerlet-agent, to assume role suffixed with the md5hash, on startup.
348353
Example - arn:eks:us-west-2:12345678910:cluster/managed-cluster1.
349-
minLength: 1
350354
pattern: ^arn:aws:eks:([a-zA-Z0-9-]+):(\d{12}):cluster/([a-zA-Z0-9-]+)$
351355
type: string
352356
required:
353357
- hubClusterArn
354-
- managedClusterArn
355358
type: object
356359
required:
357360
- authType

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module open-cluster-management.io/ocm
22

33
go 1.23.6
44

5+
replace open-cluster-management.io/api => /home/bhperry/go/src/open-cluster-management.io/api
6+
57
require (
68
github.com/aws/aws-sdk-go-v2 v1.36.3
79
github.com/aws/aws-sdk-go-v2/config v1.29.14

manifests/cluster-manager/management/cluster-manager-registration-deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ spec:
9898
{{if .AwsResourceTags}}
9999
- "--aws-resource-tags={{ .AwsResourceTags }}"
100100
{{end}}
101+
{{ if .DisableManagedIam }}
102+
- "--disable-managed-iam"
103+
{{ end }}
101104
env:
102105
- name: POD_NAME
103106
valueFrom:

manifests/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type HubConfig struct {
3434
ResourceRequirements []byte
3535
ManagedClusterIdentityCreatorRole string
3636
HubClusterArn string
37+
DisableManagedIam bool
3738
EnabledRegistrationDrivers string
3839
AutoApprovedCSRUsers string
3940
AutoApprovedARNPatterns string

manifests/klusterlet/management/klusterlet-agent-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,14 @@ spec:
230230
- name: tmpdir
231231
emptyDir: { }
232232
{{if eq .RegistrationDriver.AuthType "awsirsa"}}
233+
{{if and .RegistrationDriver.AwsIrsa .RegistrationDriver.AwsIrsa.IamConfigSecret }}
234+
- name: dot-aws
235+
secret:
236+
secretName: {{ .RegistrationDriver.AwsIrsa.IamConfigSecret }}
237+
{{else}}
233238
- name: dot-aws
234239
emptyDir: { }
240+
{{end}}
235241
- name: awscli
236242
emptyDir: { }
237243
{{end}}

manifests/klusterlet/management/klusterlet-registration-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,14 @@ spec:
208208
- name: tmpdir
209209
emptyDir: { }
210210
{{if eq .RegistrationDriver.AuthType "awsirsa"}}
211+
{{if and .RegistrationDriver.AwsIrsa .RegistrationDriver.AwsIrsa.IamConfigSecret }}
212+
- name: dot-aws
213+
secret:
214+
secretName: {{ .RegistrationDriver.AwsIrsa.IamConfigSecret }}
215+
{{else}}
211216
- name: dot-aws
212217
emptyDir: { }
218+
{{end}}
213219
- name: awscli
214220
emptyDir: { }
215221
{{end}}

0 commit comments

Comments
 (0)