From cddb64ad51b6778bd638cd7471fd879066a8c607 Mon Sep 17 00:00:00 2001 From: Mike Mason Date: Tue, 20 Jun 2023 11:14:40 -0500 Subject: [PATCH] worker volumes also need events volume support (#120) Signed-off-by: Mike Mason --- chart/permissions-api/templates/_helpers.tpl | 45 ++++++++++++++++++- .../templates/deployment-server.yaml | 4 +- .../templates/deployment-worker.yaml | 4 +- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/chart/permissions-api/templates/_helpers.tpl b/chart/permissions-api/templates/_helpers.tpl index 0b8d583e..168a6173 100644 --- a/chart/permissions-api/templates/_helpers.tpl +++ b/chart/permissions-api/templates/_helpers.tpl @@ -4,7 +4,7 @@ {{- .Values.config.server.port | default 8080 }} {{- end }} -{{- define "permapi.volumes" }} +{{- define "permapi.server.volumes" }} {{- if or .Values.config.spicedb.caSecretName .Values.config.spicedb.policyConfigMapName }} {{- with .Values.config.spicedb.caSecretName }} - name: spicedb-ca @@ -21,7 +21,7 @@ {{- end }} {{- end }} -{{- define "permapi.volumeMounts" }} +{{- define "permapi.server.volumeMounts" }} {{- if or .Values.config.spicedb.caSecretName .Values.config.spicedb.policyConfigMapName }} {{- if .Values.config.spicedb.caSecretName }} - name: spicedb-ca @@ -35,3 +35,44 @@ [] {{- end }} {{- end }} + +{{- define "permapi.worker.volumes" }} +{{- if or .Values.config.spicedb.caSecretName .Values.config.spicedb.policyConfigMapName .Values.config.events.nats.credsSecretName }} +{{- with .Values.config.spicedb.caSecretName }} +- name: spicedb-ca + secret: + secretName: {{ . }} +{{- end }} +{{- with .Values.config.events.nats.credsSecretName }} +- name: nats-creds + secret: + secretName: {{ . }} +{{- end }} +{{- with .Values.config.spicedb.policyConfigMapName }} +- name: policy-file + configMap: + name: {{ . }} +{{- end }} +{{- else -}} +[] +{{- end }} +{{- end }} + +{{- define "permapi.worker.volumeMounts" }} +{{- if or .Values.config.spicedb.caSecretName .Values.config.spicedb.policyConfigMapName .Values.config.events.nats.credsSecretName }} +{{- if .Values.config.spicedb.caSecretName }} +- name: spicedb-ca + mountPath: /etc/ssl/spicedb/ +{{- end }} +{{- if .Values.config.events.nats.credsSecretName }} +- name: nats-creds + mountPath: /nats +{{- end }} +{{- if .Values.config.spicedb.policyConfigMapName }} +- name: policy-file + mountPath: /policy +{{- end }} +{{- else -}} +[] +{{- end }} +{{- end }} diff --git a/chart/permissions-api/templates/deployment-server.yaml b/chart/permissions-api/templates/deployment-server.yaml index afe6f943..f6444b6e 100644 --- a/chart/permissions-api/templates/deployment-server.yaml +++ b/chart/permissions-api/templates/deployment-server.yaml @@ -125,7 +125,7 @@ spec: resources: {{- toYaml . | nindent 12 }} {{- end }} - volumeMounts: {{ include "permapi.volumeMounts" . | nindent 12 }} + volumeMounts: {{ include "permapi.server.volumeMounts" . | nindent 12 }} {{- with .Values.deployment.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -138,4 +138,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - volumes: {{ include "permapi.volumes" . | nindent 8 }} + volumes: {{ include "permapi.server.volumes" . | nindent 8 }} diff --git a/chart/permissions-api/templates/deployment-worker.yaml b/chart/permissions-api/templates/deployment-worker.yaml index 8a08e4e4..8e4f293d 100644 --- a/chart/permissions-api/templates/deployment-worker.yaml +++ b/chart/permissions-api/templates/deployment-worker.yaml @@ -147,7 +147,7 @@ spec: resources: {{- toYaml . | nindent 12 }} {{- end }} - volumeMounts: {{ include "permapi.volumeMounts" . | nindent 12 }} + volumeMounts: {{ include "permapi.worker.volumeMounts" . | nindent 12 }} {{- with .Values.deployment.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -160,4 +160,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - volumes: {{ include "permapi.volumes" . | nindent 8 }} + volumes: {{ include "permapi.worker.volumes" . | nindent 8 }}