diff --git a/charts/netbox/Chart.yaml b/charts/netbox/Chart.yaml index f090d60..a872800 100644 --- a/charts/netbox/Chart.yaml +++ b/charts/netbox/Chart.yaml @@ -4,4 +4,4 @@ appVersion: "2.6.1" description: An IP address management (IPAM) and data center infrastructure management (DCIM) tool. icon: https://raw.githubusercontent.com/digitalocean/netbox/develop/netbox/project-static/img/netbox.ico name: netbox -version: 0.2.3 +version: 0.3.0 diff --git a/charts/netbox/templates/deployment.yaml b/charts/netbox/templates/deployment.yaml index 682b9dc..eae8791 100644 --- a/charts/netbox/templates/deployment.yaml +++ b/charts/netbox/templates/deployment.yaml @@ -44,10 +44,8 @@ spec: readOnly: true - name: netbox-socket mountPath: /tmp/netbox - {{- if .Values.persistence.enabled }} - name: data mountPath: /etc/netbox/media - {{- end }} {{- if .Values.extraVolumeMounts }} {{ toYaml .Values.extraVolumeMounts | indent 12 }} {{- end }} @@ -93,11 +91,13 @@ spec: emptyDir: {} - name: netbox-socket emptyDir: {} - {{- if .Values.persistence.enabled }} - name: data + {{- if .Values.persistence.enabled }} persistentVolumeClaim: - claimName: {{ include "netbox.fullname" . }} - {{- end }} + claimName: {{ .Values.persistence.existingClaim | default (include "netbox.fullname" .) }} + {{- else }} + emptyDir: {} + {{- end }} {{- if .Values.extraVolumes }} {{ toYaml .Values.extraVolumes | indent 8 }} {{- end }} diff --git a/charts/netbox/templates/pvc.yaml b/charts/netbox/templates/pvc.yaml new file mode 100644 index 0000000..edb758a --- /dev/null +++ b/charts/netbox/templates/pvc.yaml @@ -0,0 +1,24 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "netbox.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "netbox.name" . }} + helm.sh/chart: {{ include "netbox.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/netbox/values.yaml b/charts/netbox/values.yaml index c2c3008..282952b 100644 --- a/charts/netbox/values.yaml +++ b/charts/netbox/values.yaml @@ -110,6 +110,10 @@ extraVolumeMounts: [] persistence: enabled: false + # existingClaim: netbox-data + # storageClass: "-" + accessMode: ReadWriteOnce + size: 10Gi worker: enabled: false