Skip to content

Commit 5aa57a1

Browse files
PanSpagetkaserngawy
authored andcommitted
Review fixes
1 parent 4481032 commit 5aa57a1

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
@@ -760,6 +760,15 @@ spec:
760760
[\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\":
761761
\"*\"\n\t\t}\n\t]\n}"
762762
type: string
763+
required:
764+
- controlPlaneOperatorARN
765+
- imageRegistryARN
766+
- ingressARN
767+
- kmsProviderARN
768+
- kubeCloudControllerARN
769+
- networkARN
770+
- nodePoolManagementARN
771+
- storageARN
763772
type: object
764773
rosaClusterName:
765774
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
@@ -417,7 +417,7 @@ type AWSRolesRef struct {
417417
// }
418418
// ]
419419
// }
420-
IngressARN string `json:"ingressARN,omitempty"`
420+
IngressARN string `json:"ingressARN"`
421421

422422
// ImageRegistryARN is an ARN value referencing a role appropriate for the Image Registry Operator.
423423
//
@@ -452,7 +452,7 @@ type AWSRolesRef struct {
452452
// }
453453
// ]
454454
// }
455-
ImageRegistryARN string `json:"imageRegistryARN,omitempty"`
455+
ImageRegistryARN string `json:"imageRegistryARN"`
456456

457457
// StorageARN is an ARN value referencing a role appropriate for the Storage Operator.
458458
//
@@ -483,7 +483,7 @@ type AWSRolesRef struct {
483483
// }
484484
// ]
485485
// }
486-
StorageARN string `json:"storageARN,omitempty"`
486+
StorageARN string `json:"storageARN"`
487487

488488
// NetworkARN is an ARN value referencing a role appropriate for the Network Operator.
489489
//
@@ -509,7 +509,7 @@ type AWSRolesRef struct {
509509
// }
510510
// ]
511511
// }
512-
NetworkARN string `json:"networkARN,omitempty"`
512+
NetworkARN string `json:"networkARN"`
513513

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

592592
// NodePoolManagementARN is an ARN value referencing a role appropriate for the CAPI Controller.
593593
//
@@ -700,7 +700,7 @@ type AWSRolesRef struct {
700700
// }
701701
//
702702
// +immutable
703-
NodePoolManagementARN string `json:"nodePoolManagementARN,omitempty"`
703+
NodePoolManagementARN string `json:"nodePoolManagementARN"`
704704

705705
// ControlPlaneOperatorARN is an ARN value referencing a role appropriate for the Control Plane Operator.
706706
//
@@ -740,8 +740,8 @@ type AWSRolesRef struct {
740740
// ]
741741
// }
742742
// +immutable
743-
ControlPlaneOperatorARN string `json:"controlPlaneOperatorARN,omitempty"`
744-
KMSProviderARN string `json:"kmsProviderARN,omitempty"`
743+
ControlPlaneOperatorARN string `json:"controlPlaneOperatorARN"`
744+
KMSProviderARN string `json:"kmsProviderARN"`
745745
}
746746

747747
// 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)