From 37620d43064f7b24e6591c27fd4d110b30c83cce Mon Sep 17 00:00:00 2001 From: Stephan van Maris Date: Tue, 27 Mar 2018 18:12:02 +0200 Subject: [PATCH] add initContainer to copy config from ConfigMap (#4169) * Update statefulset.yaml ConfigMaps are read-only since Kubernetes 1.9.4 (https://github.com/kubernetes/kubernetes/pull/58720). The rabbitmq-ha Chart uses a ConfigMap to provision /etc/rabbitmq. The official RabbitMQ docker image modifies these files in its docker-entrypoint.sh. This PR adds an initContainer to the StatefulSet to copy the configs from the ConfigMap to a new emptyDir volume. * Update Chart.yaml Bump version * Update statefulset.yaml --- stable/rabbitmq-ha/Chart.yaml | 2 +- stable/rabbitmq-ha/templates/statefulset.yaml | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/stable/rabbitmq-ha/Chart.yaml b/stable/rabbitmq-ha/Chart.yaml index 177c7d81fb..7d2c61915d 100644 --- a/stable/rabbitmq-ha/Chart.yaml +++ b/stable/rabbitmq-ha/Chart.yaml @@ -1,7 +1,7 @@ name: rabbitmq-ha apiVersion: v1 appVersion: 3.7.3 -version: 1.0.2 +version: 1.0.3 description: Highly available RabbitMQ cluster, the open source message broker software that implements the Advanced Message Queuing Protocol (AMQP). keywords: diff --git a/stable/rabbitmq-ha/templates/statefulset.yaml b/stable/rabbitmq-ha/templates/statefulset.yaml index 57f230f8bb..ff46b8811d 100644 --- a/stable/rabbitmq-ha/templates/statefulset.yaml +++ b/stable/rabbitmq-ha/templates/statefulset.yaml @@ -24,6 +24,15 @@ spec: spec: terminationGracePeriodSeconds: 10 serviceAccountName: {{ template "rabbitmq-ha.serviceAccountName" . }} + initContainers: + - name: copy-rabbitmq-config + image: busybox + command: ['sh', '-c', 'cp /configmap/* /etc/rabbitmq'] + volumeMounts: + - name: configmap + mountPath: /configmap + - name: config + mountPath: /etc/rabbitmq containers: - name: {{ .Chart.Name }} image: {{ .Values.image.repository }}:{{ .Values.image.tag }} @@ -154,6 +163,8 @@ spec: {{- end }} volumes: - name: config + emptyDir: {} + - name: configmap configMap: name: {{ template "rabbitmq-ha.fullname" . }} {{- if .Values.rabbitmqCert.enabled }}