Add fullnameOverride and nameoverride (#15706)

Signed-off-by: Aisuko <urakiny@gmail.com>
This commit is contained in:
Aisuko
2019-08-12 01:25:10 -07:00
committed by Kubernetes Prow Robot
parent 642a5ebeaf
commit 72c94c525c
8 changed files with 45 additions and 23 deletions
+1 -3
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: mysqlha
version: 0.8.0
version: 1.0.0
appVersion: 5.7.13
description: MySQL cluster with a single master and zero or more slave replicas
keywords:
@@ -12,7 +12,5 @@ icon: https://www.mysql.com/common/logos/logo-mysql-170x115.png
maintainers:
- name: jpoon
email: helmchart-mysql@jasonpoon.ca
- name: jonhoare
email: jon.bitbucket@livewire-uk.co.uk
- name: aisuko
email: urakiny@gmail.com
+2
View File
@@ -38,6 +38,8 @@ The following table lists the configurable parameters of the MySQL chart and the
| `mysqlImage` | `mysql` image and tag. | `mysql:5.7.13` |
| `xtraBackupImage` | `xtrabackup` image and tag. | `gcr.io/google-samples/xtrabackup:1.0` |
| `imagePullPolicy` | Image pull policy. | `IfNotPresent` |
| `nameOverride` | `String to partially override mysqlha.fullname template with a string (will prepend the release name)` | `nil` |
| `fullnameOverride` | `String to fully override mysqlha.fullname template with a string` | `nil` |
| `replicaCount` | Number of MySQL replicas | 3 |
| `mysqlRootPassword` | Password for the `root` user. | Randomly generated |
| `mysqlUser` | Username of new user to create. | `nil` |
+18 -3
View File
@@ -3,14 +3,29 @@
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 24 | trimSuffix "-" -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "mysqlha.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
+1 -1
View File
@@ -4,7 +4,7 @@ metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: "{{ template "mysqlha.chart" . }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
+12 -12
View File
@@ -4,25 +4,25 @@ metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: "{{ template "mysqlha.chart" . }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{ if .Values.mysqlha.mysqlRootPassword }}
{{- if .Values.mysqlha.mysqlRootPassword }}
mysql-root-password: {{ .Values.mysqlha.mysqlRootPassword | b64enc | quote }}
{{ else }}
{{- else }}
mysql-root-password: {{ randAlphaNum 12 | b64enc | quote }}
{{ end }}
{{ if .Values.mysqlha.mysqlUser }}
{{ if .Values.mysqlha.mysqlPassword }}
{{- end }}
{{- if .Values.mysqlha.mysqlUser }}
{{- if .Values.mysqlha.mysqlPassword }}
mysql-password: {{ .Values.mysqlha.mysqlPassword | b64enc | quote }}
{{ else }}
{{- else }}
mysql-password: {{ randAlphaNum 12 | b64enc | quote }}
{{ end }}
{{ end }}
{{ if .Values.mysqlha.mysqlReplicationPassword }}
{{- end }}
{{- end }}
{{- if .Values.mysqlha.mysqlReplicationPassword }}
mysql-replication-password: {{ .Values.mysqlha.mysqlReplicationPassword | b64enc | quote }}
{{ else }}
{{- else }}
mysql-replication-password: {{ randAlphaNum 12 | b64enc | quote }}
{{ end }}
{{- end }}
+2 -2
View File
@@ -4,7 +4,7 @@ metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: "{{ template "mysqlha.chart" . }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
@@ -251,7 +251,7 @@ spec:
port: metrics
initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
readinessprobe:
readinessProbe:
httpGet:
path: /
port: metrics
+2 -2
View File
@@ -5,7 +5,7 @@ metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: "{{ template "mysqlha.chart" . }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
@@ -24,7 +24,7 @@ metadata:
name: {{ template "fullname" . }}-readonly
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: "{{ template "mysqlha.chart" . }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
+7
View File
@@ -10,6 +10,13 @@ xtraBackupImage: gcr.io/google-samples/xtrabackup:1.0
##
imagePullPolicy: IfNotPresent
## String to partially override orangehrm.fullname template (will maintain the release name)
##
# nameOverride: ""
## String to fully override orangehrm.fullname template
##
# fullnameOverride: ""
mysqlha:
replicaCount: 3