From d37ed6ffecbc0e735485f4a891f9dd610371d817 Mon Sep 17 00:00:00 2001 From: portdirect Date: Wed, 17 Jan 2018 12:31:42 -0500 Subject: [PATCH] RabbitMQ: permit multiple deployments within a single namespace This PS updates the RabbitMQ chart to permit multiple deployments within a single namespace. Change-Id: Idd3f13448b25a88d2b42db565ddb7b6af0a9f3cd --- rabbitmq/templates/configmap-bin.yaml | 2 +- rabbitmq/templates/configmap-etc.yaml | 2 +- rabbitmq/templates/statefulset.yaml | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rabbitmq/templates/configmap-bin.yaml b/rabbitmq/templates/configmap-bin.yaml index 4a6ef93bd6..600f523578 100644 --- a/rabbitmq/templates/configmap-bin.yaml +++ b/rabbitmq/templates/configmap-bin.yaml @@ -20,7 +20,7 @@ limitations under the License. apiVersion: v1 kind: ConfigMap metadata: - name: rabbitmq-bin + name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-bin" | quote }} data: rabbitmq-liveness.sh: | {{ tuple "bin/_rabbitmq-liveness.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} diff --git a/rabbitmq/templates/configmap-etc.yaml b/rabbitmq/templates/configmap-etc.yaml index 9a5491d5bc..ea2d1a91aa 100644 --- a/rabbitmq/templates/configmap-etc.yaml +++ b/rabbitmq/templates/configmap-etc.yaml @@ -37,7 +37,7 @@ limitations under the License. apiVersion: v1 kind: ConfigMap metadata: - name: rabbitmq-etc + name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-etc" | quote }} data: enabled_plugins: | {{ tuple "etc/_enabled_plugins.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} diff --git a/rabbitmq/templates/statefulset.yaml b/rabbitmq/templates/statefulset.yaml index b5347411c8..0a50902ed2 100644 --- a/rabbitmq/templates/statefulset.yaml +++ b/rabbitmq/templates/statefulset.yaml @@ -18,27 +18,27 @@ limitations under the License. {{- $envAll := . }} {{- $dependencies := .Values.dependencies.rabbitmq }} -{{- $serviceAccountName := "rabbitmq" }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} +{{- $rcControllerName := printf "%s-%s" $envAll.Release.Name "rabbitmq" }} +{{ tuple $envAll $dependencies $rcControllerName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: RoleBinding metadata: - name: {{ $serviceAccountName }} + name: {{ $rcControllerName | quote }} namespace: {{ .Release.Namespace }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role - name: {{ $serviceAccountName }} + name: {{ $rcControllerName | quote }} subjects: - kind: ServiceAccount - name: {{ $serviceAccountName }} + name: {{ $rcControllerName | quote }} namespace: {{ .Release.Namespace }} --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: Role metadata: - name: {{ $serviceAccountName }} + name: {{ $rcControllerName | quote }} namespace: {{ .Release.Namespace }} rules: - apiGroups: @@ -56,7 +56,7 @@ rules: apiVersion: apps/v1beta1 kind: StatefulSet metadata: - name: rabbitmq + name: {{ $rcControllerName | quote }} spec: serviceName: {{ tuple "oslo_messaging" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} replicas: {{ .Values.pod.replicas.server }} @@ -68,7 +68,7 @@ spec: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: - serviceAccountName: {{ $serviceAccountName }} + serviceAccountName: {{ $rcControllerName | quote }} affinity: {{ tuple $envAll "rabbitmq" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: @@ -131,10 +131,10 @@ spec: emptyDir: {} - name: rabbitmq-bin configMap: - name: rabbitmq-bin + name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-bin" | quote }} defaultMode: 0555 - name: rabbitmq-etc configMap: - name: rabbitmq-etc + name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-etc" | quote }} defaultMode: 0444 {{ end }}