diff --git a/incubator/mysqlha/Chart.yaml b/incubator/mysqlha/Chart.yaml index f4e7188692..1707d6bc70 100644 --- a/incubator/mysqlha/Chart.yaml +++ b/incubator/mysqlha/Chart.yaml @@ -1,5 +1,5 @@ name: mysqlha -version: 0.4.0 +version: 0.5.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 2736cd7860..a280e3d757 100644 --- a/incubator/mysqlha/README.md +++ b/incubator/mysqlha/README.md @@ -33,25 +33,34 @@ $ helm delete my-release The following table lists the configurable parameters of the MySQL chart and their default values. -| Parameter | Description | Default | -| ----------------------- | ----------------------------------- | -------------------------------------- | -| `mysqlImage` | `mysql` image and tag. | `mysql:5.7.13` | -| `xtraBackupImage` | `xtrabackup` image and tag. | `gcr.io/google-samples/xtrabackup:1.0` | -| `replicaCount` | Number of MySQL replicas | 3 | -| `mysqlRootPassword` | Password for the `root` user. | Randomly generated | -| `mysqlUser` | Username of new user to create. | `nil` | -| `mysqlPassword` | Password for the new user. | Randomly generated | -| `mysqlReplicationUser` | Username for replication user | `repl` | -| `mysqlReplicationPassword` | Password for replication user. | Randomly generated | -| `mysqlDatabase` | Name of the new Database to create | `nil` | -| `configFiles.master.cnf` | Master configuration file | See `values.yaml` | -| `configFiles.slave.cnf` | Slave configuration file | See `values.yaml` | -| `persistence.enabled` | Create a volume to store data | true | -| `persistence.size` | Size of persistent volume claim | 10Gi | -| `persistence.storageClass` | Type of persistent volume claim | `nil` | -| `persistence.accessModes` | Persistent volume access modes | `[ReadWriteOnce]` | -| `persistence.annotations` | Persistent volume annotations | `{}` | -| `resources` | CPU/Memory resource requests/limits | Memory: `128Mi`, CPU: `100m` | +| Parameter | Description | Default | +| ----------------------------------------- | ------------------------------------------------- | -------------------------------------- | +| `mysqlImage` | `mysql` image and tag. | `mysql:5.7.13` | +| `xtraBackupImage` | `xtrabackup` image and tag. | `gcr.io/google-samples/xtrabackup:1.0` | +| `replicaCount` | Number of MySQL replicas | 3 | +| `mysqlRootPassword` | Password for the `root` user. | Randomly generated | +| `mysqlUser` | Username of new user to create. | `nil` | +| `mysqlPassword` | Password for the new user. | Randomly generated | +| `mysqlReplicationUser` | Username for replication user | `repl` | +| `mysqlReplicationPassword` | Password for replication user. | Randomly generated | +| `mysqlDatabase` | Name of the new Database to create | `nil` | +| `configFiles.master.cnf` | Master configuration file | See `values.yaml` | +| `configFiles.slave.cnf` | Slave configuration file | See `values.yaml` | +| `persistence.enabled` | Create a volume to store data | true | +| `persistence.size` | Size of persistent volume claim | 10Gi | +| `persistence.storageClass` | Type of persistent volume claim | `nil` | +| `persistence.accessModes` | Persistent volume access modes | `[ReadWriteOnce]` | +| `persistence.annotations` | Persistent volume annotations | `{}` | +| `resources` | CPU/Memory resource requests/limits | Memory: `128Mi`, CPU: `100m` | +| `metrics.enabled` | Start a side-car prometheus exporter | false | +| `metrics.image` | Exporter image | `prom/mysqld-exporter` | +| `metrics.imageTag` | Exporter image | `v0.10.0` | +| `metrics.imagePullPolicy` | Exporter image pull policy | `IfNotPresent` | +| `metrics.resources` | Exporter resource requests/limit | See `values.yaml` | +| `metrics.livenessProbe.initialDelaySeconds` | Delay before metrics liveness probe is initiated | 15 | +| `metrics.livenessProbe.timeoutSeconds` | When the probe times out | 5 | +| `metrics.readinessProbe.initialDelaySeconds` | Delay before metrics readiness probe is initiated | 5 | +| `metrics.readinessProbe.timeoutSeconds` | When the probe times out | 1 | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/incubator/mysqlha/templates/statefulset.yaml b/incubator/mysqlha/templates/statefulset.yaml index 29db5db8f7..e7b3745a16 100644 --- a/incubator/mysqlha/templates/statefulset.yaml +++ b/incubator/mysqlha/templates/statefulset.yaml @@ -216,6 +216,39 @@ spec: requests: cpu: 100m memory: 100Mi + {{- if .Values.metrics.enabled }} + - name: metrics + image: "{{ .Values.metrics.image }}:{{ .Values.metrics.imageTag }}" + imagePullPolicy: {{ .Values.pullPolicy | quote }} + {{- if .Values.mysqlha.mysqlAllowEmptyPassword }} + command: ['sh', '-c', 'DATA_SOURCE_NAME="root@(localhost:3306)/" /bin/mysqld_exporter' ] + {{- else }} + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: mysql-root-password + command: [ 'sh', '-c', 'DATA_SOURCE_NAME="root:$MYSQL_ROOT_PASSWORD@(localhost:3306)/" /bin/mysqld_exporter' ] + {{- end }} + ports: + - name: metrics + containerPort: 9104 + livenessProbe: + httpGet: + path: / + port: metrics + initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }} + timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }} + readinessprobe: + httpGet: + path: / + port: metrics + initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }} + timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }} + resources: +{{ toYaml .Values.metrics.resources | indent 10 }} + {{- end }} volumes: - name: conf emptyDir: {} diff --git a/incubator/mysqlha/templates/svc.yaml b/incubator/mysqlha/templates/svc.yaml index 00532f257a..f0e24c7877 100644 --- a/incubator/mysqlha/templates/svc.yaml +++ b/incubator/mysqlha/templates/svc.yaml @@ -27,9 +27,18 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + annotations: +{{- if and (.Values.metrics.enabled) (.Values.metrics.annotations) }} +{{ toYaml .Values.metrics.annotations | indent 4 }} +{{- end }} spec: ports: - name: {{ template "fullname" . }} port: 3306 + {{- if .Values.metrics.enabled }} + - name: metrics + port: 9104 + targetPort: metrics + {{- end }} selector: app: {{ template "fullname" . }} diff --git a/incubator/mysqlha/values.yaml b/incubator/mysqlha/values.yaml index 83ba0f89ce..cf22d6c0ca 100644 --- a/incubator/mysqlha/values.yaml +++ b/incubator/mysqlha/values.yaml @@ -64,3 +64,21 @@ resources: requests: cpu: 100m memory: 128Mi + +metrics: + enabled: false + image: prom/mysqld-exporter + imageTag: v0.10.0 + imagePullPolicy: IfNotPresent + annotations: {} + + livenessProbe: + initialDelaySeconds: 15 + timeoutSeconds: 5 + readinessProbe: + initialDelaySeconds: 5 + timeoutSeconds: 1 + resources: + requests: + cpu: 100m + memory: 100Mi