From f9cdb4ce7ce8d3392ff8ab964250f87042504c5d Mon Sep 17 00:00:00 2001 From: Samuel Alfageme Date: Fri, 18 Sep 2020 09:48:08 +0200 Subject: [PATCH] Fetch the pod's HOSTNAME via downward API and pass it as env.var ... when the pod is deployed as part of an StatefulSet, so it can determine its identity on startup and pick the right config file from the '*-configfiles' mount. --- revad/Chart.yaml | 2 +- revad/templates/deployment.yaml | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/revad/Chart.yaml b/revad/Chart.yaml index ecd2cba..b89238b 100644 --- a/revad/Chart.yaml +++ b/revad/Chart.yaml @@ -3,7 +3,7 @@ apiVersion: v2 name: revad description: The Reva daemon (revad) helm chart type: application -version: 1.2.2 +version: 1.2.4 appVersion: v1.2.1 icon: https://reva.link/logo.svg home: https://reva.link diff --git a/revad/templates/deployment.yaml b/revad/templates/deployment.yaml index 5a41ad4..139196d 100644 --- a/revad/templates/deployment.yaml +++ b/revad/templates/deployment.yaml @@ -35,7 +35,7 @@ spec: args: - "-c" {{- if .Values.useStatefulSet }} - - "/etc/revad/${HOSTNAME}.toml" + - "/etc/revad/$(HOSTNAME).toml" {{- else }} - "/etc/revad/revad.toml" {{- end }} @@ -50,9 +50,17 @@ spec: {{- if .Values.extraVolumeMounts }} {{ toYaml .Values.extraVolumeMounts | nindent 12 }} {{- end }} - {{- if .Values.env }} + {{- if or .Values.env .Values.useStatefulSet }} env: - {{ toYaml .Values.env | nindent 12}} + {{- if .Values.useStatefulSet }} + - name: HOSTNAME + valueFrom: + fieldRef: + fieldPath: metadata.name + {{- end }} + {{- if .Values.env }} + {{ toYaml .Values.env | nindent 12 }} + {{- end }} {{- end }} volumes: - name: {{ include "revad.fullname" . }}-configfiles