From 398b98cfffbc064cf492d1c8af904c20d236e76d Mon Sep 17 00:00:00 2001 From: Vegard Hagen Date: Sat, 6 Apr 2024 17:28:29 +0200 Subject: [PATCH] feat(Argo CD): Switch to Helm chart --- ...gocd-cm-cmp-kustomize-build-with-helm.yaml | 14 ------ infra/argocd/{ => auth}/auth-values.yaml | 0 infra/argocd/auth/kustomization.yaml | 14 ++++++ .../traefik-forward-auth-secrets.yaml | 0 .../{ingress.yaml => ingress-route.yaml} | 0 infra/argocd/kustomization.yaml | 36 +++++----------- infra/argocd/{namespace.yaml => ns.yaml} | 0 ...ource-exclusion-cilium-identity-patch.yaml | 12 ------ .../argocd-cm-tracking-method-annotation.yaml | 6 --- ...d-cmd-params-cm-server-insecure-patch.yaml | 7 --- .../patches/argocd-repo-copyutil-patch.yaml | 16 ------- ...gocd-repo-server-plugin-sidecar-patch.yaml | 34 --------------- infra/argocd/values.yaml | 43 +++++++++++++++++++ 13 files changed, 67 insertions(+), 115 deletions(-) delete mode 100644 infra/argocd/argocd-cm-cmp-kustomize-build-with-helm.yaml rename infra/argocd/{ => auth}/auth-values.yaml (100%) create mode 100644 infra/argocd/auth/kustomization.yaml rename infra/argocd/{ => auth}/traefik-forward-auth-secrets.yaml (100%) rename infra/argocd/{ingress.yaml => ingress-route.yaml} (100%) rename infra/argocd/{namespace.yaml => ns.yaml} (100%) delete mode 100644 infra/argocd/patches/argocd-cm-resource-exclusion-cilium-identity-patch.yaml delete mode 100644 infra/argocd/patches/argocd-cm-tracking-method-annotation.yaml delete mode 100644 infra/argocd/patches/argocd-cmd-params-cm-server-insecure-patch.yaml delete mode 100644 infra/argocd/patches/argocd-repo-copyutil-patch.yaml delete mode 100644 infra/argocd/patches/argocd-repo-server-plugin-sidecar-patch.yaml create mode 100644 infra/argocd/values.yaml diff --git a/infra/argocd/argocd-cm-cmp-kustomize-build-with-helm.yaml b/infra/argocd/argocd-cm-cmp-kustomize-build-with-helm.yaml deleted file mode 100644 index 8bf6c3a..0000000 --- a/infra/argocd/argocd-cm-cmp-kustomize-build-with-helm.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: argocd-cm-cmp-kustomize-build-with-helm -data: - kustomize-build-with-helm.yaml: | - apiVersion: argoproj.io/v1alpha1 - kind: ConfigManagementPlugin - metadata: - name: kustomize-build-with-helm - spec: - generate: - command: [ "sh", "-c" ] - args: [ "kustomize build --enable-helm" ] \ No newline at end of file diff --git a/infra/argocd/auth-values.yaml b/infra/argocd/auth/auth-values.yaml similarity index 100% rename from infra/argocd/auth-values.yaml rename to infra/argocd/auth/auth-values.yaml diff --git a/infra/argocd/auth/kustomization.yaml b/infra/argocd/auth/kustomization.yaml new file mode 100644 index 0000000..ff6c2e7 --- /dev/null +++ b/infra/argocd/auth/kustomization.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: argocd + +helmGlobals: + chartHome: ../../../charts + +helmCharts: + - name: application + releaseName: auth + valuesFile: auth-values.yaml + +resources: + - traefik-forward-auth-secrets.yaml diff --git a/infra/argocd/traefik-forward-auth-secrets.yaml b/infra/argocd/auth/traefik-forward-auth-secrets.yaml similarity index 100% rename from infra/argocd/traefik-forward-auth-secrets.yaml rename to infra/argocd/auth/traefik-forward-auth-secrets.yaml diff --git a/infra/argocd/ingress.yaml b/infra/argocd/ingress-route.yaml similarity index 100% rename from infra/argocd/ingress.yaml rename to infra/argocd/ingress-route.yaml diff --git a/infra/argocd/kustomization.yaml b/infra/argocd/kustomization.yaml index 2653792..c1a6562 100644 --- a/infra/argocd/kustomization.yaml +++ b/infra/argocd/kustomization.yaml @@ -1,31 +1,15 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: argocd - -helmGlobals: - chartHome: ../../charts - -helmCharts: - - name: application - releaseName: auth - valuesFile: auth-values.yaml resources: - - namespace.yaml - - traefik-forward-auth-secrets.yaml - - https://raw.githubusercontent.com/argoproj/argo-cd/v2.10.0/manifests/install.yaml - - ingress.yaml - - argocd-cm-cmp-kustomize-build-with-helm.yaml + - ns.yaml + - ingress-route.yaml + - auth -patches: - # Copy binaries from ArgoCD-image - - path: patches/argocd-repo-copyutil-patch.yaml - # Plugin to enable Kustomize with Helm - - path: patches/argocd-repo-server-plugin-sidecar-patch.yaml -# # Ignore CiliumIdentity CRDs -# - path: patches/argocd-cm-resource-exclusion-cilium-identity-patch.yaml - # Configure tracking method to annotation - # https://argo-cd.readthedocs.io/en/stable/user-guide/resource_tracking/#additional-tracking-methods-via-an-annotation - - path: patches/argocd-cm-tracking-method-annotation.yaml - # Traefik handles TLS - - path: patches/argocd-cmd-params-cm-server-insecure-patch.yaml +helmCharts: + - name: argo-cd + repo: https://argoproj.github.io/argo-helm + version: 6.0.6 + releaseName: "argocd" + namespace: argocd + valuesFile: values.yaml \ No newline at end of file diff --git a/infra/argocd/namespace.yaml b/infra/argocd/ns.yaml similarity index 100% rename from infra/argocd/namespace.yaml rename to infra/argocd/ns.yaml diff --git a/infra/argocd/patches/argocd-cm-resource-exclusion-cilium-identity-patch.yaml b/infra/argocd/patches/argocd-cm-resource-exclusion-cilium-identity-patch.yaml deleted file mode 100644 index 6c68ada..0000000 --- a/infra/argocd/patches/argocd-cm-resource-exclusion-cilium-identity-patch.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: argocd-cm -data: - resource.exclusions: | - - apiGroups: - - cilium.io - kinds: - - CiliumIdentity - clusters: - - "*" diff --git a/infra/argocd/patches/argocd-cm-tracking-method-annotation.yaml b/infra/argocd/patches/argocd-cm-tracking-method-annotation.yaml deleted file mode 100644 index 4f9d0c0..0000000 --- a/infra/argocd/patches/argocd-cm-tracking-method-annotation.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: argocd-cm -data: - application.resourceTrackingMethod: "annotation" diff --git a/infra/argocd/patches/argocd-cmd-params-cm-server-insecure-patch.yaml b/infra/argocd/patches/argocd-cmd-params-cm-server-insecure-patch.yaml deleted file mode 100644 index 619973d..0000000 --- a/infra/argocd/patches/argocd-cmd-params-cm-server-insecure-patch.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: argocd-cmd-params-cm -data: - # Traefik handles TLS - server.insecure: "true" \ No newline at end of file diff --git a/infra/argocd/patches/argocd-repo-copyutil-patch.yaml b/infra/argocd/patches/argocd-repo-copyutil-patch.yaml deleted file mode 100644 index 0cb6252..0000000 --- a/infra/argocd/patches/argocd-repo-copyutil-patch.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: argocd-repo-server -spec: - template: - spec: - initContainers: - - name: copyutil - command: [ /bin/bash ] - args: - - -c - - >- - /bin/cp -n /usr/local/bin/argocd /var/run/argocd/argocd-cmp-server && - /bin/cp -n /usr/local/bin/kustomize /var/run/argocd/kustomize && - /bin/cp -n /usr/local/bin/helm /var/run/argocd/helm \ No newline at end of file diff --git a/infra/argocd/patches/argocd-repo-server-plugin-sidecar-patch.yaml b/infra/argocd/patches/argocd-repo-server-plugin-sidecar-patch.yaml deleted file mode 100644 index a50cccd..0000000 --- a/infra/argocd/patches/argocd-repo-server-plugin-sidecar-patch.yaml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: argocd-repo-server -spec: - template: - spec: - containers: - - name: kustomize-build-with-helm - env: - - name: PATH - value: "/var/run/argocd:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - command: - - argocd-cmp-server - image: alpine/git:2.40.1 - securityContext: - runAsNonRoot: true - runAsUser: 999 - volumeMounts: - - name: var-files - mountPath: /var/run/argocd - - name: plugins - mountPath: /home/argocd/cmp-server/plugins - - name: cmp-kustomize-build-with-helm - mountPath: /home/argocd/cmp-server/config/plugin.yaml - subPath: kustomize-build-with-helm.yaml - - mountPath: /tmp - name: cmp-tmp - volumes: - - name: cmp-kustomize-build-with-helm - configMap: - name: argocd-cm-cmp-kustomize-build-with-helm - - name: cmp-tmp - emptyDir: { } \ No newline at end of file diff --git a/infra/argocd/values.yaml b/infra/argocd/values.yaml new file mode 100644 index 0000000..931d6a4 --- /dev/null +++ b/infra/argocd/values.yaml @@ -0,0 +1,43 @@ +configs: + cm: + create: true + application.resourceTrackingMethod: "annotation+label" + cmp: + create: true + plugins: + kustomize-build-with-helm: + generate: + command: [ "sh", "-c" ] + args: [ "kustomize build --enable-helm" ] + params: + server.insecure: true + +crds: + install: true + # -- Keep CRDs on chart uninstall + keep: false + +repoServer: + extraContainers: + - name: kustomize-build-with-helm + command: + - argocd-cmp-server + image: '{{ default .Values.global.image.repository .Values.repoServer.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.repoServer.image.tag }}' + securityContext: + runAsNonRoot: true + runAsUser: 999 + volumeMounts: + - name: plugins + mountPath: /home/argocd/cmp-server/plugins + - name: cmp-kustomize-build-with-helm + mountPath: /home/argocd/cmp-server/config/plugin.yaml + subPath: kustomize-build-with-helm.yaml + - mountPath: /tmp + name: cmp-tmp + volumes: + - name: cmp-kustomize-build-with-helm + configMap: + name: argocd-cmp-cm + - name: cmp-tmp + emptyDir: { } +