[stable/rabbitmq] Existing secret values switches for password / erlang cookie (#10699)

* [stable/rabbitmq] Existing password / erlang cookie secret

Allows usage of rabbitmq application password and erlang cookie values from an externally-managed Kube secret

Signed-off-by: Louise Champ <louise@livewyer.com>

* add new values to values-production

Signed-off-by: Louise Champ <louise@livewyer.com>

* suggested changed

Signed-off-by: Louise Champ <louise@livewyer.com>

* Revert "suggested changed"

This reverts commit 47afc08a4e571aeb79eda593ab3b5a18daf635a2.

Signed-off-by: Louise Champ <louise@livewyer.com>

* suggested changes

Signed-off-by: Louise Champ <louise@livewyer.com>

* use secret name helper function in metrics container env

Signed-off-by: Louise Champ <louise@livewyer.com>

* use newer appVersion in chart 4.2.0

Signed-off-by: Louise Champ <louise@livewyer.com>
This commit is contained in:
Louise Champ
2019-02-11 00:59:08 -08:00
committed by Kubernetes Prow Robot
parent 1499f66085
commit 81575c002d
7 changed files with 38 additions and 8 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: rabbitmq
version: 4.1.1
version: 4.2.0
appVersion: 3.7.11
description: Open source message broker software that implements the Advanced Message Queuing Protocol (AMQP)
keywords:
+2
View File
@@ -57,7 +57,9 @@ The following table lists the configurable parameters of the RabbitMQ chart and
| `rbacEnabled` | Specify if rbac is enabled in your cluster | `true` |
| `rabbitmq.username` | RabbitMQ application username | `user` |
| `rabbitmq.password` | RabbitMQ application password | _random 10 character long alphanumeric string_ |
| `rabbitmq.existingPasswordSecret` | Existing secret with RabbitMQ credentials | nil |
| `rabbitmq.erlangCookie` | Erlang cookie | _random 32 character long alphanumeric string_ |
| `rabbitmq.existingErlSecret` | Existing secret with RabbitMQ Erlang cookie | nil |
| `rabbitmq.plugins` | configuration file for plugins to enable | `[rabbitmq_management,rabbitmq_peer_discovery_k8s].` |
| `rabbitmq.clustering.address_type` | Switch clustering mode | `ip` or `hostname` |
| `rabbitmq.clustering.k8s_domain` | Customize internal k8s cluster domain | `cluster.local` |
+22
View File
@@ -63,3 +63,25 @@ Return the proper metrics image name
{{- $tag := .Values.metrics.image.tag | toString -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{/*
Get the password secret.
*/}}
{{- define "rabbitmq.secretPasswordName" -}}
{{- if .Values.rabbitmq.existingPasswordSecret -}}
{{- printf "%s" .Values.rabbitmq.existingPasswordSecret -}}
{{- else -}}
{{- printf "%s" (include "rabbitmq.fullname" .) -}}
{{- end -}}
{{- end -}}
{{/*
Get the erlang secret.
*/}}
{{- define "rabbitmq.secretErlangName" -}}
{{- if .Values.rabbitmq.existingErlangSecret -}}
{{- printf "%s" .Values.rabbitmq.existingErlangSecret -}}
{{- else -}}
{{- printf "%s" (include "rabbitmq.fullname" .) -}}
{{- end -}}
{{- end -}}
+6 -4
View File
@@ -1,3 +1,4 @@
{{ if or (not .Values.rabbitmq.existingErlangSecret) (not .Values.rabbitmq.existingPasswordSecret) }}
apiVersion: v1
kind: Secret
metadata:
@@ -9,13 +10,14 @@ metadata:
heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{ if .Values.rabbitmq.password }}
{{ if not .Values.rabbitmq.existingPasswordSecret }}{{ if .Values.rabbitmq.password }}
rabbitmq-password: {{ .Values.rabbitmq.password | b64enc | quote }}
{{ else }}
rabbitmq-password: {{ randAlphaNum 10 | b64enc | quote }}
{{ end }}
{{ if .Values.rabbitmq.erlangCookie }}
{{ end }}{{ end }}
{{ if not .Values.rabbitmq.existingErlangSecret }}{{ if .Values.rabbitmq.erlangCookie }}
rabbitmq-erlang-cookie: {{ .Values.rabbitmq.erlangCookie | b64enc | quote }}
{{ else }}
rabbitmq-erlang-cookie: {{ randAlphaNum 32 | b64enc | quote }}
{{ end }}
{{ end }}{{ end }}
{{ end }}
+3 -3
View File
@@ -152,12 +152,12 @@ spec:
- name: RABBITMQ_ERL_COOKIE
valueFrom:
secretKeyRef:
name: {{ template "rabbitmq.fullname" . }}
name: {{ template "rabbitmq.secretErlangName" . }}
key: rabbitmq-erlang-cookie
- name: RABBITMQ_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "rabbitmq.fullname" . }}
name: {{ template "rabbitmq.secretPasswordName" . }}
key: rabbitmq-password
{{- if .Values.metrics.enabled }}
- name: metrics
@@ -167,7 +167,7 @@ spec:
- name: RABBIT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "rabbitmq.fullname" . }}
name: {{ template "rabbitmq.secretPasswordName" . }}
key: rabbitmq-password
- name: RABBIT_URL
value: "http://localhost:{{ .Values.service.managerPort }}"
+2
View File
@@ -43,11 +43,13 @@ rabbitmq:
## ref: https://github.com/bitnami/bitnami-docker-rabbitmq#environment-variables
##
# password:
# existingPasswordSecret: name-of-existing-secret
## Erlang cookie to determine whether different nodes are allowed to communicate with each other
## ref: https://github.com/bitnami/bitnami-docker-rabbitmq#environment-variables
##
# erlangCookie:
# existingErlangSecret: name-of-existing-secret
## Node name to cluster with. e.g.: `clusternode@hostname`
## ref: https://github.com/bitnami/bitnami-docker-rabbitmq#environment-variables
+2
View File
@@ -43,11 +43,13 @@ rabbitmq:
## ref: https://github.com/bitnami/bitnami-docker-rabbitmq#environment-variables
##
# password:
# existingPasswordSecret: name-of-existing-secret
## Erlang cookie to determine whether different nodes are allowed to communicate with each other
## ref: https://github.com/bitnami/bitnami-docker-rabbitmq#environment-variables
##
# erlangCookie:
# existingErlangSecret: name-of-existing-secret
## Node name to cluster with. e.g.: `clusternode@hostname`
## ref: https://github.com/bitnami/bitnami-docker-rabbitmq#environment-variables