From 89e9c898b7ed59413c4838987201aac3dda253a1 Mon Sep 17 00:00:00 2001 From: Antonia von den Driesch Date: Mon, 19 Aug 2024 17:58:06 +0900 Subject: [PATCH] Do not reconcile aws infrastructure clusters --- .circleci/config.yml | 13 +++++++++++++ CHANGELOG.md | 4 ++++ controllers/cluster_controller.go | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a556eacd..c22df87e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -62,3 +62,16 @@ workflows: ignore: /.*/ tags: only: /^v.*/ + + - architect/push-to-app-collection: + context: architect + name: push-to-vsphere-aws-addons-app-collection + app_name: "dns-operator-route53" + app_collection_repo: "vsphere-aws-addons-app-collection" + requires: + - push-to-app-catalog + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 4146790b..3348f048 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Do not reconcile Cluster if the infrastructure cluster kind is AWSCluster. + ## [0.9.0] - 2024-07-25 ### Changed diff --git a/controllers/cluster_controller.go b/controllers/cluster_controller.go index b58370d7..f691af55 100644 --- a/controllers/cluster_controller.go +++ b/controllers/cluster_controller.go @@ -64,6 +64,12 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct // get the InfrastructureRef (v1.ObjectReference) from the CAPI cluster infraRef := cluster.Spec.InfrastructureRef + // Return early if the infrastructure cluster type is not enabled + if !r.enabledInfrastructureProvider(infraRef.Kind) { + log.Info(fmt.Sprintf("Infrastructure provider %s is not enabled", infraRef.Kind)) + return reconcile.Result{}, nil + } + // set the GVK to the unstructured infraCluster infraCluster.SetGroupVersionKind(infraRef.GroupVersionKind()) @@ -188,3 +194,15 @@ func (r *ClusterReconciler) reconcileDelete(ctx context.Context, clusterScope *s RequeueAfter: time.Minute * 5, }, nil } + +// check if the infrastructure provider is enabled +// for now we simply disable the AWS provider here. +// if needed in the future we should extend this to accept a list of enabled providers from the config. +func (r *ClusterReconciler) enabledInfrastructureProvider(kind string) bool { + switch kind { + case "AWSCluster": + return false + default: + return true + } +}