[rabbitmq-ha] Unify .Chart.Version sanitization (#13003)

* [rabbitmq-ha] Unify .Chart.Version sanitization

Replace plus sign (+) with underscore sign (_) for all objects to avoid
errors during deployment like:

```
Error: release rabbitmq-ha failed: Secret "rabbitmq-ha" is invalid:
metadata.labels: Invalid value: "rabbitmq-ha-1.24.0+something": a valid
label must be an empty string or consist of alphanumeric characters,
'-', '_' or '.', and must start and end with an alphanumeric character
(e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation
is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
```

Signed-off-by: hasul <matej.hasul@gooddata.com>

* Use template function for chart name+version

Steal function from `helm create` and use it in all objects

Signed-off-by: hasul <matej.hasul@gooddata.com>
This commit is contained in:
matejhasul
2019-04-17 20:48:02 -07:00
committed by Kubernetes Prow Robot
parent fbd958f786
commit bcb0dbba7c
13 changed files with 20 additions and 13 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
name: rabbitmq-ha
apiVersion: v1
appVersion: 3.7.12
version: 1.24.0
version: 1.25.0
description: Highly available RabbitMQ cluster, the open source message broker
software that implements the Advanced Message Queuing Protocol (AMQP).
keywords:
@@ -24,6 +24,13 @@ If release name contains chart name it will be used as a full name.
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "rabbitmq-ha.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
+1 -1
View File
@@ -6,7 +6,7 @@ metadata:
namespace: {{ .Values.prometheus.operator.serviceMonitor.namespace }}
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.prometheus.operator.serviceMonitor.selector }}
+1 -1
View File
@@ -5,7 +5,7 @@ metadata:
name: {{ template "rabbitmq-ha.fullname" . }}
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
+1 -1
View File
@@ -5,7 +5,7 @@ metadata:
name: {{ template "rabbitmq-ha.fullname" . }}
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
+1 -1
View File
@@ -5,7 +5,7 @@ metadata:
name: {{ template "rabbitmq-ha.fullname" . }}
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
+1 -1
View File
@@ -4,7 +4,7 @@ kind: Role
metadata:
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.extraLabels }}
@@ -4,7 +4,7 @@ kind: RoleBinding
metadata:
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.extraLabels }}
+2 -2
View File
@@ -5,7 +5,7 @@ metadata:
name: {{ template "rabbitmq-ha.fullname" . }}
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "rabbitmq-ha.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.extraLabels }}
@@ -28,7 +28,7 @@ metadata:
name: {{ template "rabbitmq-ha.fullname" . }}-cert
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "rabbitmq-ha.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.extraLabels }}
@@ -9,7 +9,7 @@ metadata:
name: {{ printf "%s-discovery" (include "rabbitmq-ha.fullname" .) | trunc 63 | trimSuffix "-" }}
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
+1 -1
View File
@@ -14,7 +14,7 @@ metadata:
name: {{ template "rabbitmq-ha.fullname" . }}
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
@@ -4,7 +4,7 @@ kind: ServiceAccount
metadata:
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.extraLabels }}
@@ -4,7 +4,7 @@ metadata:
name: {{ template "rabbitmq-ha.fullname" . }}
labels:
app: {{ template "rabbitmq-ha.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
chart: {{ template "rabbitmq-ha.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}