Skip to content

Commit 121d0ff

Browse files
authored
Merge pull request #4767 from stevekuznetsov/skuznets/rosa-aws-session
✨ rosa: load identity dynamically
2 parents 6193d17 + 1e11e57 commit 121d0ff

21 files changed

+211
-53
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ defaulters: $(DEFAULTER_GEN) ## Generate all Go types
190190
$(DEFAULTER_GEN) \
191191
--input-dirs=./api/v1beta2 \
192192
--input-dirs=./$(EXP_DIR)/api/v1beta2 \
193+
--input-dirs=./controlplane/rosa/api/v1beta2 \
193194
--input-dirs=./cmd/clusterawsadm/api/bootstrap/v1beta1 \
194195
--input-dirs=./cmd/clusterawsadm/api/bootstrap/v1alpha1 \
195196
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \

api/v1beta1/awscluster_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ type AWSClusterSpec struct {
8787
// +optional
8888
Bastion Bastion `json:"bastion"`
8989

90-
// IdentityRef is a reference to a identity to be used when reconciling this cluster
9190
// +optional
91+
92+
// IdentityRef is a reference to an identity to be used when reconciling the managed control plane.
93+
// If no identity is specified, the default identity for this controller will be used.
9294
IdentityRef *AWSIdentityReference `json:"identityRef,omitempty"`
9395

9496
// S3Bucket contains options to configure a supporting S3 bucket for this

api/v1beta2/awscluster_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ type AWSClusterSpec struct {
9999
// +optional
100100
Bastion Bastion `json:"bastion"`
101101

102-
// IdentityRef is a reference to a identity to be used when reconciling this cluster
103102
// +optional
103+
104+
// IdentityRef is a reference to an identity to be used when reconciling the managed control plane.
105+
// If no identity is specified, the default identity for this controller will be used.
104106
IdentityRef *AWSIdentityReference `json:"identityRef,omitempty"`
105107

106108
// S3Bucket contains options to configure a supporting S3 bucket for this

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,9 @@ spec:
258258
type: array
259259
type: object
260260
identityRef:
261-
description: IdentityRef is a reference to a identity to be used when
262-
reconciling the managed control plane.
261+
description: IdentityRef is a reference to an identity to be used
262+
when reconciling the managed control plane. If no identity is specified,
263+
the default identity for this controller will be used.
263264
properties:
264265
kind:
265266
description: Kind of the identity.
@@ -2096,8 +2097,9 @@ spec:
20962097
type: array
20972098
type: object
20982099
identityRef:
2099-
description: IdentityRef is a reference to a identity to be used when
2100-
reconciling the managed control plane.
2100+
description: IdentityRef is a reference to an identity to be used
2101+
when reconciling the managed control plane. If no identity is specified,
2102+
the default identity for this controller will be used.
21012103
properties:
21022104
kind:
21032105
description: Kind of the identity.

config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ spec:
4545
type: object
4646
spec:
4747
properties:
48-
accountID:
49-
description: 'TODO: these are to satisfy ocm sdk. Explore how to drop
50-
them.'
51-
type: string
5248
availabilityZones:
5349
description: AWS AvailabilityZones of the worker nodes should match
5450
the AvailabilityZones of the Subnets.
@@ -70,8 +66,6 @@ spec:
7066
- host
7167
- port
7268
type: object
73-
creatorARN:
74-
type: string
7569
credentialsSecretRef:
7670
description: 'CredentialsSecretRef references a secret with necessary
7771
credentials to connect to the OCM API. The secret should contain
@@ -84,7 +78,29 @@ spec:
8478
type: string
8579
type: object
8680
x-kubernetes-map-type: atomic
81+
identityRef:
82+
description: IdentityRef is a reference to an identity to be used
83+
when reconciling the managed control plane. If no identity is specified,
84+
the default identity for this controller will be used.
85+
properties:
86+
kind:
87+
description: Kind of the identity.
88+
enum:
89+
- AWSClusterControllerIdentity
90+
- AWSClusterRoleIdentity
91+
- AWSClusterStaticIdentity
92+
type: string
93+
name:
94+
description: Name of the identity.
95+
minLength: 1
96+
type: string
97+
required:
98+
- kind
99+
- name
100+
type: object
87101
installerRoleARN:
102+
description: 'TODO: these are to satisfy ocm sdk. Explore how to drop
103+
them.'
88104
type: string
89105
machineCIDR:
90106
description: Block of IP addresses used by OpenShift while installing
@@ -276,9 +292,7 @@ spec:
276292
workerRoleARN:
277293
type: string
278294
required:
279-
- accountID
280295
- availabilityZones
281-
- creatorARN
282296
- installerRoleARN
283297
- machineCIDR
284298
- oidcID

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ spec:
167167
type: array
168168
type: object
169169
identityRef:
170-
description: IdentityRef is a reference to a identity to be used when
171-
reconciling this cluster
170+
description: IdentityRef is a reference to an identity to be used
171+
when reconciling the managed control plane. If no identity is specified,
172+
the default identity for this controller will be used.
172173
properties:
173174
kind:
174175
description: Kind of the identity.
@@ -1142,8 +1143,9 @@ spec:
11421143
type: array
11431144
type: object
11441145
identityRef:
1145-
description: IdentityRef is a reference to a identity to be used when
1146-
reconciling this cluster
1146+
description: IdentityRef is a reference to an identity to be used
1147+
when reconciling the managed control plane. If no identity is specified,
1148+
the default identity for this controller will be used.
11471149
properties:
11481150
kind:
11491151
description: Kind of the identity.

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,10 @@ spec:
183183
type: array
184184
type: object
185185
identityRef:
186-
description: IdentityRef is a reference to a identity to be
187-
used when reconciling this cluster
186+
description: IdentityRef is a reference to an identity to
187+
be used when reconciling the managed control plane. If no
188+
identity is specified, the default identity for this controller
189+
will be used.
188190
properties:
189191
kind:
190192
description: Kind of the identity.
@@ -742,8 +744,10 @@ spec:
742744
type: array
743745
type: object
744746
identityRef:
745-
description: IdentityRef is a reference to a identity to be
746-
used when reconciling this cluster
747+
description: IdentityRef is a reference to an identity to
748+
be used when reconciling the managed control plane. If no
749+
identity is specified, the default identity for this controller
750+
will be used.
747751
properties:
748752
kind:
749753
description: Kind of the identity.

controllers/rosacluster_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
3636
rosacontrolplanev1 "sigs.k8s.io/cluster-api-provider-aws/v2/controlplane/rosa/api/v1beta2"
3737
expinfrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/exp/api/v1beta2"
38+
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/scope"
3839
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
3940
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
4041
"sigs.k8s.io/cluster-api/util"
@@ -48,6 +49,7 @@ type ROSAClusterReconciler struct {
4849
client.Client
4950
Recorder record.EventRecorder
5051
WatchFilterValue string
52+
Endpoints []scope.ServiceEndpoint
5153
}
5254

5355
// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=rosaclusters,verbs=get;list;watch;update;patch;delete

controlplane/eks/api/v1beta1/awsmanagedcontrolplane_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ type AWSManagedControlPlaneSpec struct { //nolint: maligned
4040
// +optional
4141
EKSClusterName string `json:"eksClusterName,omitempty"`
4242

43-
// IdentityRef is a reference to a identity to be used when reconciling the managed control plane.
4443
// +optional
44+
45+
// IdentityRef is a reference to an identity to be used when reconciling the managed control plane.
46+
// If no identity is specified, the default identity for this controller will be used.
4547
IdentityRef *infrav1.AWSIdentityReference `json:"identityRef,omitempty"`
4648

4749
// NetworkSpec encapsulates all things related to AWS network.

controlplane/eks/api/v1beta2/awsmanagedcontrolplane_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ type AWSManagedControlPlaneSpec struct { //nolint: maligned
4040
// +optional
4141
EKSClusterName string `json:"eksClusterName,omitempty"`
4242

43-
// IdentityRef is a reference to a identity to be used when reconciling the managed control plane.
4443
// +optional
44+
45+
// IdentityRef is a reference to an identity to be used when reconciling the managed control plane.
46+
// If no identity is specified, the default identity for this controller will be used.
4547
IdentityRef *infrav1.AWSIdentityReference `json:"identityRef,omitempty"`
4648

4749
// NetworkSpec encapsulates all things related to AWS network.

0 commit comments

Comments
 (0)