Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(argo-cd): Add Volume Pesistence support for argocd-repo-server #1648

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions charts/argo-cd/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: v2.5.2
kubeVersion: ">=1.22.0-0"
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd
version: 5.13.9
version: 5.14.0
home: https://github.com/argoproj/argo-helm
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
sources:
Expand All @@ -23,4 +23,5 @@ dependencies:
condition: redis-ha.enabled
annotations:
artifacthub.io/changes: |
- "[Changed]: Document imporatant changes in changelog"
- "[Add]: Support to deploy argocd-repo-server as a StatefulSet"
- "[Add]: Creation of PVC for argocd-repo-server"
17 changes: 17 additions & 0 deletions charts/argo-cd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,20 @@ Merge Argo Params Configuration with Preset Configuration
{{ $key }}: {{ toString $value | toYaml }}
{{- end }}
{{- end -}}

{{/*
Return a PersistentVolumeClaim structure
*/}}
{{- define "argo-cd.repoServer.persistentVolumeClaim" -}}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .name }}
spec:
accessModes: {{ .context.accessModes }}
resources:
requests:
storage: {{ .context.storage }}
storageClassName: {{ .context.storageClassName }}
volumeMode: Filesystem
{{- end -}}
37 changes: 36 additions & 1 deletion charts/argo-cd/templates/argocd-repo-server/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
apiVersion: apps/v1
{{- if .Values.repoServer.enableStatefulSet }}
kind: StatefulSet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm little bit worried about this implementation because repo server is stateless, not stateful and typically runs with HPA (we run 30+ replicas). This feature will break the HPA that targets Deployment + will create large amount of PVCs.

{{- else }}
kind: Deployment
{{- end }}
metadata:
name: {{ template "argo-cd.repoServer.fullname" . }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.repoServer.name "name" .Values.repoServer.name) | nindent 4 }}
spec:
{{- if .Values.repoServer.enableStatefulSet }}
serviceName: {{ template "argo-cd.repoServerServiceAccountName" . }}
{{- end }}
{{- if not .Values.repoServer.autoscaling.enabled }}
replicas: {{ .Values.repoServer.replicas }}
{{- end }}
Expand Down Expand Up @@ -289,14 +296,22 @@ spec:
{{- with .Values.repoServer.volumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- if not $.Values.repoServer.volumeClaimTemplates.helm_working_dir }}
- name: helm-working-dir
emptyDir: {}
{{- end }}
{{- if not $.Values.repoServer.volumeClaimTemplates.plugins }}
- name: plugins
emptyDir: {}
{{- end }}
{{- if not $.Values.repoServer.volumeClaimTemplates.var_files }}
- name: var-files
emptyDir: {}
- name: tmp
{{- end }}
{{- if not $.Values.repoServer.volumeClaimTemplates.tmp_dir }}
- name: tmp-dir
emptyDir: {}
{{- end }}
- name: ssh-known-hosts
configMap:
name: argocd-ssh-known-hosts-cm
Expand All @@ -306,8 +321,10 @@ spec:
- name: gpg-keys
configMap:
name: argocd-gpg-keys-cm
{{- if not $.Values.repoServer.volumeClaimTemplates.gpg_keyring }}
- name: gpg-keyring
emptyDir: {}
{{- end }}
- name: argocd-repo-server-tls
secret:
secretName: argocd-repo-server-tls
Expand Down Expand Up @@ -345,3 +362,21 @@ spec:
{{- with .Values.repoServer.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- if .Values.repoServer.volumeClaimTemplates }}
volumeClaimTemplates:
{{- if .Values.repoServer.volumeClaimTemplates.gpg_keyring }}
{{- include "argo-cd.repoServer.persistentVolumeClaim" (dict "context" .Values.repoServer.volumeClaimTemplates.gpg_keyring "name" "gpg-keyring" ) | nindent 4 }}
{{- end }}
{{- if .Values.repoServer.volumeClaimTemplates.helm_working_dir }}
{{- include "argo-cd.repoServer.persistentVolumeClaim" (dict "context" .Values.repoServer.volumeClaimTemplates.helm_working_dir "name" "helm-working-dir" ) | nindent 4 }}
{{- end }}
{{- if .Values.repoServer.volumeClaimTemplates.tmp_dir }}
{{- include "argo-cd.repoServer.persistentVolumeClaim" (dict "context" .Values.repoServer.volumeClaimTemplates.tmp_dir "name" "tmp-dir" ) | nindent 4 }}
{{- end }}
{{- if .Values.repoServer.volumeClaimTemplates.var_files }}
{{- include "argo-cd.repoServer.persistentVolumeClaim" (dict "context" .Values.repoServer.volumeClaimTemplates.var_files "name" "var-files" ) | nindent 4 }}
{{- end }}
{{- if .Values.repoServer.volumeClaimTemplates.plugins }}
{{- include "argo-cd.repoServer.persistentVolumeClaim" (dict "context" .Values.repoServer.volumeClaimTemplates.plugins "name" "plugins" ) | nindent 4 }}
{{- end }}
{{- end }}
26 changes: 26 additions & 0 deletions charts/argo-cd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1951,6 +1951,32 @@ repoServer:
# - name: custom-tools
# emptyDir: {}

# deploy argocd-repo-server as a statefulset (in this case it is mandatory to have a service account)
enableStatefulSet: false

# create a list of persistent volumes to be created with your deployment or statefulset
volumeClaimTemplates: {}
# tmp_dir:
# accessModes: [ReadWriteOnce]
# storage: 1Gi
# storageClassName: gp2-topology-aware
# gpg_keyring:
# accessModes: [ReadWriteOnce]
# storage: 1Gi
# storageClassName: gp2-topology-aware
# helm_working_dir:
# accessModes: [ReadWriteOnce]
# storage: 1Gi
# storageClassName: gp2-topology-aware
# var_files:
# accessModes: [ReadWriteOnce]
# storage: 1Gi
# storageClassName: gp2-topology-aware
# plugins:
# accessModes: [ReadWriteOnce]
# storage: 1Gi
# storageClassName: gp2-topology-aware

# -- [Node selector]
nodeSelector: {}
# -- [Tolerations] for use with node taints
Expand Down