Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱ROSA Cleanup & Documentation #4665

Merged
merged 4 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TOOLS_DIR_DEPS := $(TOOLS_DIR)/go.sum $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/Makefile
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin


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

BIN_DIR := bin
Expand Down Expand Up @@ -229,6 +229,7 @@ generate-go-apis: ## Alias for .build/generate-go-apis
paths=./$(EXP_DIR)/controllers/... \
paths=./bootstrap/eks/controllers/... \
paths=./controlplane/eks/controllers/... \
paths=./controlplane/rosa/controllers/... \
output:crd:dir=config/crd/bases \
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
crd:crdVersions=v1 \
Expand Down
2 changes: 2 additions & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ resources:
- bases/infrastructure.cluster.x-k8s.io_awsmanagedclusters.yaml
- bases/bootstrap.cluster.x-k8s.io_eksconfigs.yaml
- bases/bootstrap.cluster.x-k8s.io_eksconfigtemplates.yaml
- bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml
- bases/infrastructure.cluster.x-k8s.io_rosaclusters.yaml
# +kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
containers:
- args:
- "--leader-elect"
- "--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}"
- "--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}"
- "--v=${CAPA_LOGLEVEL:=0}"
- "--metrics-bind-addr=0.0.0.0:8080"
image: controller:latest
Expand Down
19 changes: 19 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ rules:
- get
- patch
- update
- apiGroups:
- controlplane.cluster.x-k8s.io
resources:
- rosacontrolplanes
verbs:
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- controlplane.cluster.x-k8s.io
resources:
Expand All @@ -144,6 +155,14 @@ rules:
- get
- list
- watch
- apiGroups:
- controlplane.cluster.x-k8s.io
resources:
- rosacontrolplanes/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
11 changes: 10 additions & 1 deletion controlplane/rosa/controllers/rosacontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
)

const (
ocmAPIUrl = "https://api.stage.openshift.com"
rosaCreatorArnProperty = "rosa_creator_arn"

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

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

// Create the connection, and remember to close it:
token := os.Getenv("OCM_TOKEN")
ocmAPIUrl := os.Getenv("OCM_API_URL")
if ocmAPIUrl == "" {
ocmAPIUrl = "https://api.openshift.com"
}
connection, err := sdk.NewConnectionBuilder().
Logger(ocmLogger).
Tokens(token).
Expand Down Expand Up @@ -338,6 +343,10 @@ func (r *ROSAControlPlaneReconciler) reconcileDelete(_ context.Context, rosaScop
// Create the connection, and remember to close it:
// TODO: token should be read from a secret: https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4460
token := os.Getenv("OCM_TOKEN")
ocmAPIUrl := os.Getenv("OCM_API_URL")
muraee marked this conversation as resolved.
Show resolved Hide resolved
if ocmAPIUrl == "" {
ocmAPIUrl = "https://api.openshift.com"
}
connection, err := sdk.NewConnectionBuilder().
Logger(ocmLogger).
Tokens(token).
Expand Down
3 changes: 3 additions & 0 deletions docs/book/src/SUMMARY_PREFIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
- [Using EKS Addons](./topics/eks/addons.md)
- [Enabling Encryption](./topics/eks/encryption.md)
- [Cluster Upgrades](./topics/eks/cluster-upgrades.md)
- [ROSA Support](./topics/rosa/index.md)
- [Enabling ROSA Support](./topics/rosa/enabling.md)
- [Creating a cluster](./topics/rosa/creating-a-cluster.md)
- [Bring Your Own AWS Infrastructure](./topics/bring-your-own-aws-infrastructure.md)
- [Specifying the IAM Role to use for Management Components](./topics/specify-management-iam-role.md)
- [Using external cloud provider with EBS CSI driver](./topics/external-cloud-provider-with-ebs-csi-driver.md)
Expand Down
Loading