Created
April 17, 2024 16:47
-
-
Save leonardochaia/470adc15a1091246291e29565bab995d to your computer and use it in GitHub Desktop.
ArgoCD Kustomize Plugin Docker KRM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: argocd-repo-server | |
spec: | |
template: | |
spec: | |
containers: | |
- name: kustomize-docker | |
command: [/var/run/argocd/argocd-cmp-server] | |
image: your-registry/argocd-podman-plugin | |
securityContext: | |
privileged: true | |
runAsNonRoot: true | |
runAsUser: 999 | |
volumeMounts: | |
- mountPath: /var/run/argocd | |
name: var-files | |
- mountPath: /home/argocd/cmp-server/plugins | |
name: plugins | |
- mountPath: /tmp | |
name: tmp | |
env: | |
- name: KUSTOMIZE_PLUGIN_HOME | |
value: /tmp/docker | |
- name: XDG_RUNTIME_DIR | |
value: /tmp/docker | |
- name: XDG_DATA_HOME | |
value: /tmp/docker | |
- name: XDG_CONFIG_HOME | |
value: /tmp/docker | |
- name: TMPDIR | |
value: /tmp/docker | |
volumes: | |
- emptyDir: {} | |
name: tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# plugin-image/Dockerfile | |
FROM alpine:3.19 | |
RUN apk update && apk add --no-cache \ | |
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ | |
kustomize podman | |
RUN ln -s /usr/bin/podman /usr/bin/docker \ | |
&& adduser -h /home/argocd -s /bin/sh -G ping -u 999 -D argocd \ | |
&& echo 'argocd:165536:65536' >> /etc/subuid \ | |
&& echo 'argocd:165536:65536' >> /etc/subgid | |
COPY storage.conf /home/argocd/.config/containers/storage.conf | |
COPY plugin.yaml /home/argocd/cmp-server/config/plugin.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example app using plugin | |
apiVersion: argoproj.io/v1alpha1 | |
kind: Application | |
metadata: | |
name: root-app | |
namespace: argocd | |
spec: | |
source: | |
repoURL: Your Repo | |
targetRevision: main | |
path: 'applications' | |
plugin: | |
name: kustomize-docker-plugin | |
# You can't use this while using plugin | |
# kustomize: | |
# components: | |
# - ../../environments/azure-dev/hub/_config | |
# - ../../environments/azure-shared-infrastructure/_components-base | |
destination: | |
server: https://kubernetes.default.svc | |
namespace: your-ns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# plugin-image/plugin.yaml | |
apiVersion: argoproj.io/v1alpha1 | |
kind: ConfigManagementPlugin | |
metadata: | |
name: kustomize-docker-plugin | |
spec: | |
discover: | |
find: | |
command: [sh, -c, find . -name *.yaml] | |
generate: | |
command: [sh] | |
args: [-c, 'kustomize build --enable-alpha-plugins --enable-helm'] | |
init: | |
command: [sh] | |
args: [-c, 'echo "Initializing..."'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# plugin-image/storage.conf | |
[storage] | |
driver = "overlay" | |
runroot = "/tmp/docker/run/containers/storage" | |
graphroot = "/tmp/docker/var/lib/containers/storage" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment