From d112c90f1b79ad466f60cc2e87c70395a990d337 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 26 Jun 2024 12:25:00 -0500 Subject: [PATCH] feat: convert operators to ArgoCD ApplicationSet Convert the operators to being deployed by an ArgoCD ApplicationSet. --- .../operators/argocd-operators-project.yaml | 6 ++- apps/appsets/operators/operators.yaml | 37 +++++++++++++++++++ apps/operators/mariadb-operator.yaml | 19 ---------- .../messaging-topology-operator.yaml | 19 ---------- apps/operators/postgres-operator.yaml | 19 ---------- apps/operators/rabbitmq-operator.yaml | 19 ---------- .../kustomization.yaml | 13 ------- .../rabbitmq-operator/kustomization.yaml | 5 --- operators/rabbitmq-system/kustomization.yaml | 14 +++++++ 9 files changed, 55 insertions(+), 96 deletions(-) rename apps/{ => appsets}/operators/argocd-operators-project.yaml (70%) create mode 100644 apps/appsets/operators/operators.yaml delete mode 100644 apps/operators/mariadb-operator.yaml delete mode 100644 apps/operators/messaging-topology-operator.yaml delete mode 100644 apps/operators/postgres-operator.yaml delete mode 100644 apps/operators/rabbitmq-operator.yaml delete mode 100644 operators/messaging-topology-operator/kustomization.yaml delete mode 100644 operators/rabbitmq-operator/kustomization.yaml create mode 100644 operators/rabbitmq-system/kustomization.yaml diff --git a/apps/operators/argocd-operators-project.yaml b/apps/appsets/operators/argocd-operators-project.yaml similarity index 70% rename from apps/operators/argocd-operators-project.yaml rename to apps/appsets/operators/argocd-operators-project.yaml index 473390e31..64a1ecc5d 100644 --- a/apps/operators/argocd-operators-project.yaml +++ b/apps/appsets/operators/argocd-operators-project.yaml @@ -8,9 +8,11 @@ spec: - '*' destinations: # make sure our operators don't install in the wrong place - - namespace: '!nautobot' + - namespace: 'rabbitmq-system' server: '*' - - namespace: '!openstack' + - namespace: 'mariadb-operator' + server: '*' + - namespace: 'postgres-operator' server: '*' clusterResourceWhitelist: - group: '*' diff --git a/apps/appsets/operators/operators.yaml b/apps/appsets/operators/operators.yaml new file mode 100644 index 000000000..340b9011a --- /dev/null +++ b/apps/appsets/operators/operators.yaml @@ -0,0 +1,37 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: operators +spec: + goTemplate: true + goTemplateOptions: ["missingkey=error"] + generators: + - matrix: + generators: + - clusters: + selector: + matchLabels: + argocd.argoproj.io/secret-type: cluster + - git: + repoURL: '{{index .metadata.annotations "uc_repo_git_url"}}' + revision: '{{index .metadata.annotations "uc_repo_ref"}}' + directories: + - path: operators/* + template: + metadata: + name: '{{.name}}-{{.path.basename}}' + spec: + project: operators + source: + repoURL: '{{index .metadata.annotations "uc_repo_git_url"}}' + targetRevision: '{{index .metadata.annotations "uc_repo_ref"}}' + path: '{{.path.path}}' + destination: + server: '{{.server}}' + namespace: '{{.path.basename}}' + syncPolicy: + automated: + selfHeal: true + syncOptions: + - CreateNamespace=true + - ServerSideApply=true diff --git a/apps/operators/mariadb-operator.yaml b/apps/operators/mariadb-operator.yaml deleted file mode 100644 index edd4e3bdc..000000000 --- a/apps/operators/mariadb-operator.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: mariadb-operator -spec: - project: operators - source: - repoURL: https://github.com/rackerlabs/understack.git - path: operators/mariadb-operator/ - targetRevision: ${UC_REPO_REF} - destination: - server: "https://kubernetes.default.svc" - namespace: mariadb-operator - syncPolicy: - automated: - selfHeal: true - syncOptions: - - CreateNamespace=true - - ServerSideApply=true diff --git a/apps/operators/messaging-topology-operator.yaml b/apps/operators/messaging-topology-operator.yaml deleted file mode 100644 index 95a2edcbd..000000000 --- a/apps/operators/messaging-topology-operator.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: messaging-topology-operator -spec: - project: operators - source: - repoURL: https://github.com/rackerlabs/understack.git - path: operators/messaging-topology-operator/ - targetRevision: ${UC_REPO_REF} - destination: - server: "https://kubernetes.default.svc" - namespace: rabbitmq-system - syncPolicy: - automated: - selfHeal: true - syncOptions: - - CreateNamespace=true - - ServerSideApply=true diff --git a/apps/operators/postgres-operator.yaml b/apps/operators/postgres-operator.yaml deleted file mode 100644 index 96d074452..000000000 --- a/apps/operators/postgres-operator.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: postgres-operator -spec: - project: operators - source: - repoURL: https://github.com/rackerlabs/understack.git - path: operators/postgres-operator/ - targetRevision: ${UC_REPO_REF} - destination: - server: "https://kubernetes.default.svc" - namespace: postgres-operator - syncPolicy: - automated: - selfHeal: true - syncOptions: - - CreateNamespace=true - - ServerSideApply=true diff --git a/apps/operators/rabbitmq-operator.yaml b/apps/operators/rabbitmq-operator.yaml deleted file mode 100644 index 62115477f..000000000 --- a/apps/operators/rabbitmq-operator.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: rabbitmq-operator -spec: - project: operators - source: - repoURL: https://github.com/rackerlabs/understack.git - path: operators/rabbitmq-operator/ - targetRevision: ${UC_REPO_REF} - destination: - server: "https://kubernetes.default.svc" - namespace: rabbitmq-system - syncPolicy: - automated: - selfHeal: true - syncOptions: - - CreateNamespace=true - - ServerSideApply=true diff --git a/operators/messaging-topology-operator/kustomization.yaml b/operators/messaging-topology-operator/kustomization.yaml deleted file mode 100644 index a8eed4462..000000000 --- a/operators/messaging-topology-operator/kustomization.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: -- https://github.com/rabbitmq/messaging-topology-operator/releases/download/v1.13.0/messaging-topology-operator-with-certmanager.yaml - -patches: -- patch: |- - apiVersion: v1 - kind: Namespace - metadata: - name: rabbitmq-system - $patch: delete diff --git a/operators/rabbitmq-operator/kustomization.yaml b/operators/rabbitmq-operator/kustomization.yaml deleted file mode 100644 index b42f3fedf..000000000 --- a/operators/rabbitmq-operator/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: - - https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml diff --git a/operators/rabbitmq-system/kustomization.yaml b/operators/rabbitmq-system/kustomization.yaml new file mode 100644 index 000000000..bd5f36cbe --- /dev/null +++ b/operators/rabbitmq-system/kustomization.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml + - https://github.com/rabbitmq/messaging-topology-operator/releases/download/v1.13.0/messaging-topology-operator-with-certmanager.yaml + +patches: +- patch: |- + apiVersion: v1 + kind: Namespace + metadata: + name: rabbitmq-system + $patch: delete