Skip to content

Commit 09a5a37

Browse files
committed
Add Crossplane IAM roles, policies, and instance profiles for worker nodes
1 parent 450255f commit 09a5a37

File tree

5 files changed

+126
-4
lines changed

5 files changed

+126
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add Crossplane IAM Roles, policies and instance profiles for the worker nodes. Instead of having an IAM Role per node pool, now we'll use the same for all node pools. *This change will roll the worker nodes*.
13+
1014
## [6.3.0] - 2025-10-24
1115

1216
### Changed

helm/cluster-aws/templates/_aws_cluster.tpl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,6 @@ spec:
258258
controlPlaneIAMInstanceProfile: control-plane-{{ include "resource.default.name" $ }}
259259
name: {{ include "aws-region" . }}-capa-{{ include "resource.default.name" $ }}
260260
nodesIAMInstanceProfiles:
261-
{{- range $name, $value := .Values.global.nodePools | default .Values.cluster.providerIntegration.workers.defaultNodePools }}
262-
- nodes-{{ $name }}-{{ include "resource.default.name" $ }}
263-
{{- end }}
261+
- {{ include "resource.default.name" $ }}-workers
264262
region: {{ include "aws-region" . }}
265263
{{ end }}

helm/cluster-aws/templates/_karpenter_machine_pools.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ spec:
3838
volumeType: gp3
3939
deleteOnTermination: true
4040
instanceProfile: nodes-{{ $name }}-{{ include "resource.default.name" $ }}
41+
instanceProfile: {{ include "resource.default.name" $ }}-workers
4142
metadataOptions:
4243
{{- if eq $.Values.global.connectivity.cilium.ipamMode "eni" }}
4344
httpPutResponseHopLimit: 2

helm/cluster-aws/templates/_machine_pools.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ spec:
5050
{{- else }}
5151
{{- include "imageLookupParameters" $ | nindent 4 }}
5252
{{- end }}
53-
iamInstanceProfile: nodes-{{ $name }}-{{ include "resource.default.name" $ }}
53+
iamInstanceProfile: {{ include "resource.default.name" $ }}-workers
5454
instanceType: {{ $value.instanceType | default "r6i.xlarge" }}
5555
rootVolume:
5656
size: {{ $value.rootVolumeSizeGB | default 8 }}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
apiVersion: iam.aws.upbound.io/v1beta1
3+
kind: Role
4+
metadata:
5+
name: {{ include "resource.default.name" $ }}-workers
6+
labels:
7+
{{- include "labels.common" $ | nindent 4 }}
8+
app.kubernetes.io/version: {{ .Chart.Version | quote }}
9+
spec:
10+
forProvider:
11+
assumeRolePolicy: |
12+
{
13+
"Version": "2012-10-17",
14+
"Statement": [
15+
{
16+
"Effect": "Allow",
17+
"Principal": {
18+
"Service": "ec2.amazonaws.com"
19+
},
20+
"Action": "sts:AssumeRole"
21+
}
22+
]
23+
}
24+
tags:
25+
managed-by: "cluster-aws"
26+
giantswarm.io/cluster: {{ include "resource.default.name" $ }}
27+
giantswarm.io/installation: {{ .Values.global.managementCluster }}
28+
{{- if .Values.global.providerSpecific.additionalResourceTags -}}{{- toYaml .Values.global.providerSpecific.additionalResourceTags | nindent 4 }}{{- end}}
29+
providerConfigRef:
30+
name: {{ include "resource.default.name" $ }}
31+
---
32+
apiVersion: iam.aws.upbound.io/v1beta1
33+
kind: RolePolicy
34+
metadata:
35+
name: {{ include "resource.default.name" $ }}-workers
36+
labels:
37+
{{- include "labels.common" $ | nindent 4 }}
38+
app.kubernetes.io/version: {{ .Chart.Version | quote }}
39+
spec:
40+
forProvider:
41+
roleRef:
42+
name: {{ include "resource.default.name" $ }}-workers
43+
policy: |
44+
{
45+
"Version": "2012-10-17",
46+
"Statement": [
47+
{{- if eq .Values.global.connectivity.cilium.ipamMode "eni" }}
48+
{
49+
"Action": [
50+
"ec2:AssignPrivateIpAddresses",
51+
"ec2:AttachNetworkInterface",
52+
"ec2:CreateNetworkInterface",
53+
"ec2:CreateTags",
54+
"ec2:DeleteNetworkInterface",
55+
"ec2:DescribeInstances",
56+
"ec2:DescribeInstanceTypes",
57+
"ec2:DescribeNetworkInterfaces",
58+
"ec2:DescribeRouteTables",
59+
"ec2:DescribeSecurityGroups",
60+
"ec2:DescribeSubnets",
61+
"ec2:DescribeTags",
62+
"ec2:DescribeVpcs",
63+
"ec2:ModifyNetworkInterfaceAttribute",
64+
"ec2:UnassignPrivateIpAddresses"
65+
],
66+
"Resource": "*",
67+
"Effect": "Allow"
68+
},
69+
{{- end }}
70+
{
71+
"Action": [
72+
"ecr:BatchCheckLayerAvailability",
73+
"ecr:BatchGetImage",
74+
"ecr:DescribeRepositories",
75+
"ecr:GetAuthorizationToken",
76+
"ecr:GetDownloadUrlForLayer",
77+
"ecr:GetRepositoryPolicy",
78+
"ecr:ListImages"
79+
],
80+
"Resource": "*",
81+
"Effect": "Allow"
82+
}
83+
]
84+
}
85+
providerConfigRef:
86+
name: {{ include "resource.default.name" $ }}
87+
---
88+
apiVersion: iam.aws.upbound.io/v1beta1
89+
kind: InstanceProfile
90+
metadata:
91+
name: {{ include "resource.default.name" $ }}-workers
92+
labels:
93+
{{- include "labels.common" $ | nindent 4 }}
94+
app.kubernetes.io/version: {{ .Chart.Version | quote }}
95+
spec:
96+
forProvider:
97+
tags:
98+
managed-by: "cluster-aws"
99+
giantswarm.io/cluster: {{ include "resource.default.name" $ }}
100+
giantswarm.io/installation: {{ .Values.global.managementCluster }}
101+
{{- if .Values.global.providerSpecific.additionalResourceTags -}}{{- toYaml .Values.global.providerSpecific.additionalResourceTags | nindent 4 }}{{- end}}
102+
providerConfigRef:
103+
name: {{ include "resource.default.name" $ }}
104+
---
105+
apiVersion: iam.aws.upbound.io/v1beta1
106+
kind: RolePolicyAttachment
107+
metadata:
108+
name: {{ include "resource.default.name" $ }}-workers
109+
labels:
110+
{{- include "labels.common" $ | nindent 4 }}
111+
app.kubernetes.io/version: {{ .Chart.Version | quote }}
112+
spec:
113+
forProvider:
114+
roleRef:
115+
name: {{ include "resource.default.name" $ }}-workers
116+
instanceProfileRef:
117+
name: {{ include "resource.default.name" $ }}-workers
118+
providerConfigRef:
119+
name: {{ include "resource.default.name" $ }}

0 commit comments

Comments
 (0)