From fdb69a8d2bf671d0068816971ab56b8f108a26cf Mon Sep 17 00:00:00 2001 From: Marius Ensrud Date: Thu, 20 Aug 2020 09:28:28 +0200 Subject: [PATCH] add pvc --- charts/cups-airprint/Chart.yaml | 2 +- .../cups-airprint/templates/deployment.yaml | 35 +++++++++++++++ charts/cups-airprint/templates/pvc.yaml | 45 +++++++++++++++++++ charts/cups-airprint/values.yaml | 10 ++++- 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 charts/cups-airprint/templates/pvc.yaml diff --git a/charts/cups-airprint/Chart.yaml b/charts/cups-airprint/Chart.yaml index 5d93062..b7755e7 100644 --- a/charts/cups-airprint/Chart.yaml +++ b/charts/cups-airprint/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.3 +version: 0.1.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/cups-airprint/templates/deployment.yaml b/charts/cups-airprint/templates/deployment.yaml index 4581ee9..03c70af 100644 --- a/charts/cups-airprint/templates/deployment.yaml +++ b/charts/cups-airprint/templates/deployment.yaml @@ -11,6 +11,7 @@ spec: selector: matchLabels: {{- include "cups-airprint.selectorLabels" . | nindent 6 }} + {{- if .Values.persistence.enabled }} template: metadata: {{- with .Values.podAnnotations }} @@ -47,6 +48,17 @@ spec: port: http resources: {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + {{- if .Values.persistence.enabled }} + - name: "config" + mountPath: /config + - name: "spool" + mountPath: /var/spool/cups-pdf + {{- end }} + {{- if .Values.avahi }} + - name: "avahi" + mountPath: /services + {{- end }} {{- if .Values.hostNetwork }} hostNetwork: {{ .Values.hostNetwork }} {{- end }} @@ -62,3 +74,26 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + volumes: + - name: config + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "cups-airprint.fullname" . }}-config + {{- else }} + emptyDir: {} + {{- end -}} + - name: spool + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "cups-airprint.fullname" . }}-spool + {{- else }} + emptyDir: {} + {{- end -}} + - name: avahi + {{- if .Values.avahi }} + hostPath: + path: /etc/avahi/services + type: Directory + {{- else }} + emptyDir: {} + {{- end -}} diff --git a/charts/cups-airprint/templates/pvc.yaml b/charts/cups-airprint/templates/pvc.yaml new file mode 100644 index 0000000..e430799 --- /dev/null +++ b/charts/cups-airprint/templates/pvc.yaml @@ -0,0 +1,45 @@ +{{- if .Values.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "cups-airprint.fullname" . }}-config + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + annotations: + {{- if .Values.persistence.storageClass }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- else }} + storageClassName: default + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "cups-airprint.fullname" . }}-spool + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + annotations: + {{- if .Values.persistence.storageClass }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- else }} + storageClassName: default + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end }} diff --git a/charts/cups-airprint/values.yaml b/charts/cups-airprint/values.yaml index a1e23a3..32b1c66 100644 --- a/charts/cups-airprint/values.yaml +++ b/charts/cups-airprint/values.yaml @@ -17,6 +17,14 @@ fullnameOverride: "" hostNetwork: false +avahi: true + +persistence: + enabled: false + # storageClass: + accessMode: ReadWriteOnce + size: 1Gi + serviceAccount: # Specifies whether a service account should be created create: false @@ -40,7 +48,7 @@ securityContext: {} # runAsUser: 1000 service: - enabled: false + enabled: true type: ClusterIP port: 631