Skip to content

Commit

Permalink
feat(rsyncd) allow overriding PV(C)s based on global value from paren…
Browse files Browse the repository at this point in the history
…t chart

Signed-off-by: Damien Duportal <[email protected]>
  • Loading branch information
dduportal committed Oct 5, 2023
1 parent 00be960 commit a6314ad
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions charts/rsyncd/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
Expand Down
5 changes: 4 additions & 1 deletion charts/rsyncd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
apiVersion: v1
description: rsyncd helm chart for Kubernetes
name: rsyncd
version: 1.3.2
version: 1.4.0
maintainers:
- email: [email protected]
name: jenkins-infra-team
19 changes: 19 additions & 0 deletions charts/rsyncd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}


{{/*
Data directory volume definition. Might be defined from parent chart templates or autonomously
based on the presence of the global value provided by the parent chart.
Expected argument: dict{
"currentRsyncComponent": <string>,
"rootContext": { },
}
*/}}
{{- define "rsync.datadir-volumedef" -}}
{{- if .currentRsyncComponent.volumeTpl -}}
{{- printf "%s" (tpl .currentRsyncComponent.volumeTpl .rootContext) | trim | trunc 63 }}
{{- else if .currentRsyncComponent.volume -}}
{{- toYaml .currentRsyncComponent.volume -}}
{{- else -}}
emptyDir: {}
{{- end -}}
{{- end -}}
6 changes: 1 addition & 5 deletions charts/rsyncd/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,5 @@ spec:
sizeLimit: 32Mi
{{- range .Values.configuration.components }}
- name: datadir-{{ .name }}
{{- if .volume }}
{{- toYaml .volume | nindent 10 }}
{{- else }}
emptyDir:
{{ end }}
{{- include "rsync.datadir-volumedef" (dict "currentRsyncComponent" . "rootContext" .) | nindent 10 }}
{{- end }}

0 comments on commit a6314ad

Please sign in to comment.