Skip to content

Commit e9516bd

Browse files
committed
Review fixes
1 parent b43ea50 commit e9516bd

14 files changed

+247
-82
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,15 @@ spec:
759759
[\n\t\t{\n\t\t\t\"Effect\": \"Allow\",\n\t\t\t\"Action\": [\n\t\t\t\t\"ec2:AttachVolume\",\n\t\t\t\t\"ec2:CreateSnapshot\",\n\t\t\t\t\"ec2:CreateTags\",\n\t\t\t\t\"ec2:CreateVolume\",\n\t\t\t\t\"ec2:DeleteSnapshot\",\n\t\t\t\t\"ec2:DeleteTags\",\n\t\t\t\t\"ec2:DeleteVolume\",\n\t\t\t\t\"ec2:DescribeInstances\",\n\t\t\t\t\"ec2:DescribeSnapshots\",\n\t\t\t\t\"ec2:DescribeTags\",\n\t\t\t\t\"ec2:DescribeVolumes\",\n\t\t\t\t\"ec2:DescribeVolumesModifications\",\n\t\t\t\t\"ec2:DetachVolume\",\n\t\t\t\t\"ec2:ModifyVolume\"\n\t\t\t],\n\t\t\t\"Resource\":
760760
\"*\"\n\t\t}\n\t]\n}"
761761
type: string
762+
required:
763+
- controlPlaneOperatorARN
764+
- imageRegistryARN
765+
- ingressARN
766+
- kmsProviderARN
767+
- kubeCloudControllerARN
768+
- networkARN
769+
- nodePoolManagementARN
770+
- storageARN
762771
type: object
763772
rosaClusterName:
764773
description: |-

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,15 @@ spec:
410410
[\n\t\t{\n\t\t\t\"Effect\": \"Allow\",\n\t\t\t\"Action\": [\n\t\t\t\t\"ec2:AttachVolume\",\n\t\t\t\t\"ec2:CreateSnapshot\",\n\t\t\t\t\"ec2:CreateTags\",\n\t\t\t\t\"ec2:CreateVolume\",\n\t\t\t\t\"ec2:DeleteSnapshot\",\n\t\t\t\t\"ec2:DeleteTags\",\n\t\t\t\t\"ec2:DeleteVolume\",\n\t\t\t\t\"ec2:DescribeInstances\",\n\t\t\t\t\"ec2:DescribeSnapshots\",\n\t\t\t\t\"ec2:DescribeTags\",\n\t\t\t\t\"ec2:DescribeVolumes\",\n\t\t\t\t\"ec2:DescribeVolumesModifications\",\n\t\t\t\t\"ec2:DetachVolume\",\n\t\t\t\t\"ec2:ModifyVolume\"\n\t\t\t],\n\t\t\t\"Resource\":
411411
\"*\"\n\t\t}\n\t]\n}"
412412
type: string
413+
required:
414+
- controlPlaneOperatorARN
415+
- imageRegistryARN
416+
- ingressARN
417+
- kmsProviderARN
418+
- kubeCloudControllerARN
419+
- networkARN
420+
- nodePoolManagementARN
421+
- storageARN
413422
type: object
414423
type: object
415424
type: object

controlplane/rosa/api/v1beta2/rosacontrolplane_types.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ type AWSRolesRef struct {
414414
// }
415415
// ]
416416
// }
417-
IngressARN string `json:"ingressARN,omitempty"`
417+
IngressARN string `json:"ingressARN"`
418418

419419
// ImageRegistryARN is an ARN value referencing a role appropriate for the Image Registry Operator.
420420
//
@@ -449,7 +449,7 @@ type AWSRolesRef struct {
449449
// }
450450
// ]
451451
// }
452-
ImageRegistryARN string `json:"imageRegistryARN,omitempty"`
452+
ImageRegistryARN string `json:"imageRegistryARN"`
453453

454454
// StorageARN is an ARN value referencing a role appropriate for the Storage Operator.
455455
//
@@ -480,7 +480,7 @@ type AWSRolesRef struct {
480480
// }
481481
// ]
482482
// }
483-
StorageARN string `json:"storageARN,omitempty"`
483+
StorageARN string `json:"storageARN"`
484484

485485
// NetworkARN is an ARN value referencing a role appropriate for the Network Operator.
486486
//
@@ -506,7 +506,7 @@ type AWSRolesRef struct {
506506
// }
507507
// ]
508508
// }
509-
NetworkARN string `json:"networkARN,omitempty"`
509+
NetworkARN string `json:"networkARN"`
510510

511511
// KubeCloudControllerARN is an ARN value referencing a role appropriate for the KCM/KCC.
512512
// Source: https://cloud-provider-aws.sigs.k8s.io/prerequisites/#iam-policies
@@ -584,7 +584,7 @@ type AWSRolesRef struct {
584584
// ]
585585
// }
586586
// +immutable
587-
KubeCloudControllerARN string `json:"kubeCloudControllerARN,omitempty"`
587+
KubeCloudControllerARN string `json:"kubeCloudControllerARN"`
588588

589589
// NodePoolManagementARN is an ARN value referencing a role appropriate for the CAPI Controller.
590590
//
@@ -697,7 +697,7 @@ type AWSRolesRef struct {
697697
// }
698698
//
699699
// +immutable
700-
NodePoolManagementARN string `json:"nodePoolManagementARN,omitempty"`
700+
NodePoolManagementARN string `json:"nodePoolManagementARN"`
701701

702702
// ControlPlaneOperatorARN is an ARN value referencing a role appropriate for the Control Plane Operator.
703703
//
@@ -737,8 +737,8 @@ type AWSRolesRef struct {
737737
// ]
738738
// }
739739
// +immutable
740-
ControlPlaneOperatorARN string `json:"controlPlaneOperatorARN,omitempty"`
741-
KMSProviderARN string `json:"kmsProviderARN,omitempty"`
740+
ControlPlaneOperatorARN string `json:"controlPlaneOperatorARN"`
741+
KMSProviderARN string `json:"kmsProviderARN"`
742742
}
743743

744744
// RosaControlPlaneStatus defines the observed state of ROSAControlPlane.

controlplane/rosa/api/v1beta2/rosacontrolplane_webhook.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package v1beta2
218

319
import (

exp/api/v1beta2/rosaroleconfig_types.go

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright The Kubernetes Authors.
2+
Copyright 2025 The Kubernetes Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -25,9 +25,6 @@ import (
2525
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2626
)
2727

28-
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
29-
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
30-
3128
// ROSARoleConfigSpec defines the desired state of ROSARoleConfig
3229
type ROSARoleConfigSpec struct {
3330
AccountRoleConfig AccountRoleConfig `json:"accountRoleConfig"`
@@ -158,6 +155,25 @@ const (
158155
RosaRoleConfigCreatedReason = "Created"
159156
)
160157

158+
const (
159+
// IngressOperatorARNSuffix is the suffix for the ingress operator role.
160+
IngressOperatorARNSuffix = "-openshift-ingress-operator-cloud-credentials"
161+
// ImageRegistryARNSuffix is the suffix for the image registry operator role.
162+
ImageRegistryARNSuffix = "-openshift-image-registry-installer-cloud-credentials"
163+
// StorageARNSuffix is the suffix for the storage operator role.
164+
StorageARNSuffix = "-openshift-cluster-csi-drivers-ebs-cloud-credentials"
165+
// NetworkARNSuffix is the suffix for the network operator role.
166+
NetworkARNSuffix = "-openshift-cloud-network-config-controller-cloud-credentials"
167+
// KubeCloudControllerARNSuffix is the suffix for the kube cloud controller role.
168+
KubeCloudControllerARNSuffix = "-kube-system-kube-controller-manager"
169+
// NodePoolManagementARNSuffix is the suffix for the node pool management role.
170+
NodePoolManagementARNSuffix = "-kube-system-capa-controller-manager"
171+
// ControlPlaneOperatorARNSuffix is the suffix for the control plane operator role.
172+
ControlPlaneOperatorARNSuffix = "-kube-system-control-plane-operator"
173+
// KMSProviderARNSuffix is the suffix for the kms provider role.
174+
KMSProviderARNSuffix = "-kube-system-kms-provider"
175+
)
176+
161177
// SetConditions sets the conditions of the ROSARoleConfig.
162178
func (r *ROSARoleConfig) SetConditions(conditions clusterv1.Conditions) {
163179
r.Status.Conditions = conditions
@@ -168,6 +184,11 @@ func (r *ROSARoleConfig) GetConditions() clusterv1.Conditions {
168184
return r.Status.Conditions
169185
}
170186

187+
// IsSharedVPC checks if the shared VPC config is set.
188+
func (s SharedVPCConfig) IsSharedVPC() bool {
189+
return s.VPCEndpointRoleARN != "" && s.RouteRoleARN != ""
190+
}
191+
171192
func init() {
172193
SchemeBuilder.Register(&ROSARoleConfig{}, &ROSARoleConfigList{})
173194
}

exp/controllers/rosamachinepool_controller.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package controllers
218

319
import (

0 commit comments

Comments
 (0)