Skip to content

Commit a6fe8ce

Browse files
authored
Merge pull request #4665 from muraee/rosa-capi-follow-up
🌱ROSA Cleanup & Documentation
2 parents ce35766 + 4637126 commit a6fe8ce

File tree

12 files changed

+1681
-318
lines changed

12 files changed

+1681
-318
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ TOOLS_DIR_DEPS := $(TOOLS_DIR)/go.sum $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/Makefile
3030
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
3131

3232

33-
API_DIRS := cmd/clusterawsadm/api api exp/api controlplane/eks/api bootstrap/eks/api iam/api
33+
API_DIRS := cmd/clusterawsadm/api api exp/api controlplane/eks/api bootstrap/eks/api iam/api controlplane/rosa/api
3434
API_FILES := $(foreach dir, $(API_DIRS), $(call rwildcard,../../$(dir),*.go))
3535

3636
BIN_DIR := bin
@@ -229,6 +229,7 @@ generate-go-apis: ## Alias for .build/generate-go-apis
229229
paths=./$(EXP_DIR)/controllers/... \
230230
paths=./bootstrap/eks/controllers/... \
231231
paths=./controlplane/eks/controllers/... \
232+
paths=./controlplane/rosa/controllers/... \
232233
output:crd:dir=config/crd/bases \
233234
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
234235
crd:crdVersions=v1 \

config/crd/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resources:
2121
- bases/infrastructure.cluster.x-k8s.io_awsmanagedclusters.yaml
2222
- bases/bootstrap.cluster.x-k8s.io_eksconfigs.yaml
2323
- bases/bootstrap.cluster.x-k8s.io_eksconfigtemplates.yaml
24+
- bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml
25+
- bases/infrastructure.cluster.x-k8s.io_rosaclusters.yaml
2426
# +kubebuilder:scaffold:crdkustomizeresource
2527

2628
patchesStrategicMerge:

config/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
containers:
2020
- args:
2121
- "--leader-elect"
22-
- "--feature-gates=EKS=${CAPA_EKS:=true},EKSEnableIAM=${CAPA_EKS_IAM:=false},EKSAllowAddRoles=${CAPA_EKS_ADD_ROLES:=false},EKSFargate=${EXP_EKS_FARGATE:=false},MachinePool=${EXP_MACHINE_POOL:=false},EventBridgeInstanceState=${EVENT_BRIDGE_INSTANCE_STATE:=false},AutoControllerIdentityCreator=${AUTO_CONTROLLER_IDENTITY_CREATOR:=true},BootstrapFormatIgnition=${EXP_BOOTSTRAP_FORMAT_IGNITION:=false},ExternalResourceGC=${EXP_EXTERNAL_RESOURCE_GC:=false},AlternativeGCStrategy=${EXP_ALTERNATIVE_GC_STRATEGY:=false},TagUnmanagedNetworkResources=${TAG_UNMANAGED_NETWORK_RESOURCES:=true}"
22+
- "--feature-gates=EKS=${CAPA_EKS:=true},EKSEnableIAM=${CAPA_EKS_IAM:=false},EKSAllowAddRoles=${CAPA_EKS_ADD_ROLES:=false},EKSFargate=${EXP_EKS_FARGATE:=false},MachinePool=${EXP_MACHINE_POOL:=false},EventBridgeInstanceState=${EVENT_BRIDGE_INSTANCE_STATE:=false},AutoControllerIdentityCreator=${AUTO_CONTROLLER_IDENTITY_CREATOR:=true},BootstrapFormatIgnition=${EXP_BOOTSTRAP_FORMAT_IGNITION:=false},ExternalResourceGC=${EXP_EXTERNAL_RESOURCE_GC:=false},AlternativeGCStrategy=${EXP_ALTERNATIVE_GC_STRATEGY:=false},TagUnmanagedNetworkResources=${TAG_UNMANAGED_NETWORK_RESOURCES:=true},ROSA=${EXP_ROSA:=false}"
2323
- "--v=${CAPA_LOGLEVEL:=0}"
2424
- "--metrics-bind-addr=0.0.0.0:8080"
2525
image: controller:latest

config/rbac/role.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ rules:
135135
- get
136136
- patch
137137
- update
138+
- apiGroups:
139+
- controlplane.cluster.x-k8s.io
140+
resources:
141+
- rosacontrolplanes
142+
verbs:
143+
- delete
144+
- get
145+
- list
146+
- patch
147+
- update
148+
- watch
138149
- apiGroups:
139150
- controlplane.cluster.x-k8s.io
140151
resources:
@@ -144,6 +155,14 @@ rules:
144155
- get
145156
- list
146157
- watch
158+
- apiGroups:
159+
- controlplane.cluster.x-k8s.io
160+
resources:
161+
- rosacontrolplanes/status
162+
verbs:
163+
- get
164+
- patch
165+
- update
147166
- apiGroups:
148167
- ""
149168
resources:

controlplane/rosa/controllers/rosacontrolplane_controller.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import (
4646
)
4747

4848
const (
49-
ocmAPIUrl = "https://api.stage.openshift.com"
5049
rosaCreatorArnProperty = "rosa_creator_arn"
5150

5251
rosaControlPlaneKind = "ROSAControlPlane"
@@ -99,6 +98,8 @@ func (r *ROSAControlPlaneReconciler) SetupWithManager(ctx context.Context, mgr c
9998
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusters;clusters/status,verbs=get;list;watch
10099
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machinedeployments,verbs=get;list;watch
101100
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machinepools,verbs=get;list;watch
101+
// +kubebuilder:rbac:groups=controlplane.cluster.x-k8s.io,resources=rosacontrolplanes,verbs=get;list;watch;update;patch;delete
102+
// +kubebuilder:rbac:groups=controlplane.cluster.x-k8s.io,resources=rosacontrolplanes/status,verbs=get;update;patch
102103

103104
// Reconcile will reconcile RosaControlPlane Resources.
104105
func (r *ROSAControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, reterr error) {
@@ -291,6 +292,10 @@ func (r *ROSAControlPlaneReconciler) reconcileNormal(ctx context.Context, rosaSc
291292

292293
// Create the connection, and remember to close it:
293294
token := os.Getenv("OCM_TOKEN")
295+
ocmAPIUrl := os.Getenv("OCM_API_URL")
296+
if ocmAPIUrl == "" {
297+
ocmAPIUrl = "https://api.openshift.com"
298+
}
294299
connection, err := sdk.NewConnectionBuilder().
295300
Logger(ocmLogger).
296301
Tokens(token).
@@ -338,6 +343,10 @@ func (r *ROSAControlPlaneReconciler) reconcileDelete(_ context.Context, rosaScop
338343
// Create the connection, and remember to close it:
339344
// TODO: token should be read from a secret: https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4460
340345
token := os.Getenv("OCM_TOKEN")
346+
ocmAPIUrl := os.Getenv("OCM_API_URL")
347+
if ocmAPIUrl == "" {
348+
ocmAPIUrl = "https://api.openshift.com"
349+
}
341350
connection, err := sdk.NewConnectionBuilder().
342351
Logger(ocmLogger).
343352
Tokens(token).

docs/book/src/SUMMARY_PREFIX.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
- [Using EKS Addons](./topics/eks/addons.md)
2222
- [Enabling Encryption](./topics/eks/encryption.md)
2323
- [Cluster Upgrades](./topics/eks/cluster-upgrades.md)
24+
- [ROSA Support](./topics/rosa/index.md)
25+
- [Enabling ROSA Support](./topics/rosa/enabling.md)
26+
- [Creating a cluster](./topics/rosa/creating-a-cluster.md)
2427
- [Bring Your Own AWS Infrastructure](./topics/bring-your-own-aws-infrastructure.md)
2528
- [Specifying the IAM Role to use for Management Components](./topics/specify-management-iam-role.md)
2629
- [Using external cloud provider with EBS CSI driver](./topics/external-cloud-provider-with-ebs-csi-driver.md)

0 commit comments

Comments
 (0)