Add prom/mysqld-exporter to mysqlha (#13028)

Signed-off-by: Aisuko <urakiny@gmail.com>
This commit is contained in:
Aisuko
2019-04-29 15:11:35 -07:00
committed by Kubernetes Prow Robot
parent 2aae418aa7
commit da0c276d29
5 changed files with 89 additions and 20 deletions
+1 -1
View File
@@ -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:
+28 -19
View File
@@ -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,
@@ -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: {}
+9
View File
@@ -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" . }}
+18
View File
@@ -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