Skip to content

Commit

Permalink
feat: add support for extra volumes (#31)
Browse files Browse the repository at this point in the history
* feat: Add support for extra Volumes

* test: add extra volume test

Signed-off-by: Andreea-Lupu <[email protected]>

---------

Signed-off-by: Andreea-Lupu <[email protected]>
Co-authored-by: ericgraf <[email protected]>
  • Loading branch information
Andreea-Lupu and ericgraf authored Nov 23, 2023
1 parent 569f38e commit 90ed631
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/zot/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ appVersion: v2.0.0-rc7
description: A Helm chart for Kubernetes
name: zot
type: application
version: 0.1.38
version: 0.1.39
12 changes: 9 additions & 3 deletions charts/zot/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- toYaml .Values.env | nindent 12 }}
{{- toYaml .Values.env | nindent 12 }}
ports:
- name: zot
containerPort: 5000
protocol: TCP
{{- if or .Values.mountConfig .Values.mountSecret .Values.persistence .Values.externalSecrets }}
{{- if or (not (empty .Values.extraVolumeMounts)) .Values.mountConfig .Values.mountSecret .Values.persistence .Values.externalSecrets }}
volumeMounts:
{{- if .Values.mountConfig }}
- mountPath: '/etc/zot'
Expand All @@ -55,6 +55,9 @@ spec:
- mountPath: '/var/lib/registry'
name: {{ .Release.Name }}-volume
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
livenessProbe:
initialDelaySeconds: 5
Expand All @@ -80,7 +83,7 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if or .Values.mountConfig .Values.mountSecret .Values.persistence .Values.externalSecrets }}
{{- if or .Values.mountConfig .Values.mountSecret .Values.persistence .Values.externalSecrets (not (empty .Values.extraVolumes))}}
volumes:
{{- if .Values.mountConfig }}
- name: {{ .Release.Name }}-config
Expand All @@ -102,6 +105,9 @@ spec:
persistentVolumeClaim:
claimName: {{ .Values.pvc.name | default (printf "%s-pvc" .Release.Name) }}
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
Expand Down
10 changes: 10 additions & 0 deletions charts/zot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,13 @@ env:
# secretKeyRef:
# name: mysecret
# key: username

# Extra Volume Mounts
extraVolumeMounts: []
# - name: data
# mountPath: /var/lib/registry

# Extra Volumes
extraVolumes: []
# - name: data
# emptyDir: {}
23 changes: 23 additions & 0 deletions tests/ci/extra-volume/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
10 changes: 10 additions & 0 deletions tests/ci/extra-volume/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: extra-volumes
description: Test chart for zot extra-volumes values
type: application
version: 0.1.0
appVersion: "0.1.0"
dependencies:
- name: zot
version: ~0.1.39
repository: "file://../../../charts/zot"
11 changes: 11 additions & 0 deletions tests/ci/extra-volume/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
zot:
securityContext:
runAsUser: 1000

extraVolumeMounts:
- name: data
mountPath: /var/lib/registry

extraVolumes:
- name: data
emptyDir: {}

0 comments on commit 90ed631

Please sign in to comment.