From ad6486c49af39035a7bc3e4579d5da5b670e8b4b Mon Sep 17 00:00:00 2001 From: shadowlegend Date: Tue, 1 Apr 2025 14:55:07 +0700 Subject: [PATCH] chore: add managemnet plugins --- k8s-bootstrap/management-plugin-patch.yml | 77 +++++++++++++++++++++++ k8s-bootstrap/management-plugin.yml | 32 ++++++++++ 2 files changed, 109 insertions(+) create mode 100644 k8s-bootstrap/management-plugin-patch.yml create mode 100644 k8s-bootstrap/management-plugin.yml diff --git a/k8s-bootstrap/management-plugin-patch.yml b/k8s-bootstrap/management-plugin-patch.yml new file mode 100644 index 0000000..413ee57 --- /dev/null +++ b/k8s-bootstrap/management-plugin-patch.yml @@ -0,0 +1,77 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: argocd-repo-server + namespace: argocd +spec: + template: + spec: + initContainers: + - name: download-copy-timoni + image: alpine/curl + command: [/bin/sh] + args: + - -c + - >- + curl -sLO https://github.com/stefanprodan/timoni/releases/download/v0.23.0/timoni_0.23.0_linux_$(arch | sed 's/aarch/arm/' | sed 's/x86_64/amd64/').tar.gz && + tar -xzf timoni_0.23.0_linux_$(arch | sed 's/aarch/arm/' | sed 's/x86_64/amd64/').tar.gz -C /var/run/argocd/ timoni + volumeMounts: + - mountPath: /var/run/argocd + name: var-files + + - name: copyutil + command: [ /bin/bash ] + args: + - -c + - >- + /bin/cp -n /usr/local/bin/helm /var/run/argocd/helm && + /bin/cp -n /usr/local/bin/kustomize /var/run/argocd/kustomize && + /bin/cp -n /usr/local/bin/argocd /var/run/argocd/argocd-cmp-server + volumeMounts: + - mountPath: /var/run/argocd + name: var-files + + containers: + - name: timoni + image: alpine + securityContext: + runAsUser: 999 + runAsNonRoot: true + imagePullPolicy: IfNotPresent + command: [/var/run/argocd/argocd-cmp-server] + volumeMounts: + - name: var-files + mountPath: /var/run/argocd + - name: plugins + mountPath: /home/argocd/cmp-server/plugins + - name: cmp-plugins + mountPath: /home/argocd/cmp-server/config/plugin.yaml + subPath: timoni.yml + - name: cmp-tmp + mountPath: /tmp + + - name: kustomize-helm-enabled + image: alpine + securityContext: + runAsUser: 999 + runAsNonRoot: true + imagePullPolicy: IfNotPresent + command: [/var/run/argocd/argocd-cmp-server] + volumeMounts: + - name: var-files + mountPath: /var/run/argocd + - name: plugins + mountPath: /home/argocd/cmp-server/plugins + - name: cmp-plugins + mountPath: /home/argocd/cmp-server/config/plugin.yaml + subPath: kustomize-helm-enabled.yml + - name: cmp-tmp + mountPath: /tmp + + volumes: + - name: cmp-plugins + configMap: + name: argocd-custom-plugins + - name: cmp-tmp + emptyDir: {} diff --git a/k8s-bootstrap/management-plugin.yml b/k8s-bootstrap/management-plugin.yml new file mode 100644 index 0000000..5516b67 --- /dev/null +++ b/k8s-bootstrap/management-plugin.yml @@ -0,0 +1,32 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: argocd-custom-plugins + namespace: argocd +data: + timoni.yml: | + --- + apiVersion: argoproj.io/v1alpha1 + kind: ConfigManagementPlugin + metadata: + name: timoni + spec: + generate: + command: + - /bin/sh + - -c + - /var/run/argocd/timoni build $ARGOCD_APP_NAME $ARGOCD_APP_SOURCE_PATH + + kustomize-helm-enabled.yml: | + --- + apiVersion: argoproj.io/v1alpha1 + kind: ConfigManagementPlugin + metadata: + name: kustomize-helm-enabled + spec: + generate: + command: + - /bin/sh + - -c + - /var/run/argocd/kustomize build --enable-helm