From 84662c4c81dd2fbc9684c8649a778136496b657a Mon Sep 17 00:00:00 2001 From: Aisuko Date: Thu, 1 Aug 2019 01:20:13 +0800 Subject: [PATCH] feat:Add test scripts into Notes.txt, and image pull policy (#15354) Signed-off-by: Aisuko --- incubator/mysqlha/Chart.yaml | 2 +- incubator/mysqlha/README.md | 1 + incubator/mysqlha/templates/NOTES.txt | 14 +++++++++++--- incubator/mysqlha/templates/statefulset.yaml | 6 +++++- incubator/mysqlha/values.yaml | 7 ++++++- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/incubator/mysqlha/Chart.yaml b/incubator/mysqlha/Chart.yaml index 52c55148e0..67954c4580 100644 --- a/incubator/mysqlha/Chart.yaml +++ b/incubator/mysqlha/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: mysqlha -version: 0.7.1 +version: 0.8.0 appVersion: 5.7.13 description: MySQL cluster with a single master and zero or more slave replicas keywords: diff --git a/incubator/mysqlha/README.md b/incubator/mysqlha/README.md index fdcb7841bf..d92471b330 100644 --- a/incubator/mysqlha/README.md +++ b/incubator/mysqlha/README.md @@ -37,6 +37,7 @@ 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` | | `replicaCount` | Number of MySQL replicas | 3 | | `mysqlRootPassword` | Password for the `root` user. | Randomly generated | | `mysqlUser` | Username of new user to create. | `nil` | diff --git a/incubator/mysqlha/templates/NOTES.txt b/incubator/mysqlha/templates/NOTES.txt index dec0da6331..a9dbef9819 100644 --- a/incubator/mysqlha/templates/NOTES.txt +++ b/incubator/mysqlha/templates/NOTES.txt @@ -12,8 +12,16 @@ To connect to your database: 2. Run a pod to use as a client: - kubectl run mysql-client --image={{ .Values.mysqlImage }} -it --rm --restart=Never -- /bin/sh + kubectl run mysql-client --image={{ .Values.mysqlImage }} -it --rm --restart='Never' --namespace {{ .Release.Namespace }} -- /bin/sh -2. Open a connection to one of the MySQL pods +3. To connect to Master service (read/write): - mysql -h {{ template "fullname" . }}-0.{{ template "fullname" . }} -p + mysql -h {{ template "fullname" . }}-0.{{ template "fullname" . }} -u root -p + +{{- if lt 1 (.Values.mysqlha.replicaCount | int64) }} + +4. To connect to slave service (read-only): + + mysql -h {{ template "fullname" . }}-readonly -u root -p + +{{- end }} diff --git a/incubator/mysqlha/templates/statefulset.yaml b/incubator/mysqlha/templates/statefulset.yaml index ae6527de1a..6044da5044 100644 --- a/incubator/mysqlha/templates/statefulset.yaml +++ b/incubator/mysqlha/templates/statefulset.yaml @@ -25,6 +25,7 @@ spec: initContainers: - name: clone-mysql image: {{ .Values.xtraBackupImage }} + imagePullPolicy: {{ .Values.imagePullPolicy | quote }} command: - bash - "-c" @@ -58,6 +59,7 @@ spec: mountPath: /etc/mysql/conf.d - name: init-mysql image: {{ .Values.mysqlImage }} + imagePullPolicy: {{ .Values.imagePullPolicy | quote }} command: ["/bin/bash"] args: - "-c" @@ -89,6 +91,7 @@ spec: containers: - name: mysql image: {{ .Values.mysqlImage }} + imagePullPolicy: {{ .Values.imagePullPolicy | quote }} env: - name: MYSQL_DATABASE value: {{ default "" .Values.mysqlha.mysqlDatabase | quote }} @@ -146,6 +149,7 @@ spec: timeoutSeconds: 1 - name: xtrabackup image: {{ .Values.xtraBackupImage }} + imagePullPolicy: {{ .Values.imagePullPolicy | quote }} env: - name: MYSQL_PWD valueFrom: @@ -226,7 +230,7 @@ spec: {{- if .Values.metrics.enabled }} - name: metrics image: "{{ .Values.metrics.image }}:{{ .Values.metrics.imageTag }}" - imagePullPolicy: {{ .Values.pullPolicy | quote }} + imagePullPolicy: {{ .Values.imagePullPolicy | quote }} {{- if .Values.mysqlha.mysqlAllowEmptyPassword }} command: ['sh', '-c', 'DATA_SOURCE_NAME="root@(localhost:3306)/" /bin/mysqld_exporter' ] {{- else }} diff --git a/incubator/mysqlha/values.yaml b/incubator/mysqlha/values.yaml index 341ecc534f..0c8e23b073 100644 --- a/incubator/mysqlha/values.yaml +++ b/incubator/mysqlha/values.yaml @@ -4,6 +4,12 @@ mysqlImage: mysql:5.7.13 xtraBackupImage: gcr.io/google-samples/xtrabackup:1.0 +## Specify an imagePullPolicy (Required) +## It's recommended to change this to 'Always' if the image tag is 'latest' +## ref: http://kubernetes.io/docs/user-guide/images/#updating-images +## +imagePullPolicy: IfNotPresent + mysqlha: replicaCount: 3 @@ -76,7 +82,6 @@ metrics: enabled: false image: prom/mysqld-exporter imageTag: v0.10.0 - imagePullPolicy: IfNotPresent annotations: {} livenessProbe: