add mysql ha
This commit is contained in:
21
deploy/mysql/mysql-cluster/.helmignore
Normal file
21
deploy/mysql/mysql-cluster/.helmignore
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
5
deploy/mysql/mysql-cluster/Chart.yaml
Normal file
5
deploy/mysql/mysql-cluster/Chart.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
appVersion: "1.0"
|
||||||
|
description: A Helm chart for easy deployment of a MySQL cluster with MySQL operator.
|
||||||
|
name: mysql-cluster
|
||||||
|
version: 0.3.1
|
||||||
59
deploy/mysql/mysql-cluster/templates/_helpers.tpl
Normal file
59
deploy/mysql/mysql-cluster/templates/_helpers.tpl
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "mysql-cluster.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "mysql-cluster.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride -}}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||||
|
{{- 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 "mysql-cluster.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "mysql-cluster.dbConnectURL" -}}
|
||||||
|
mysql://
|
||||||
|
{{- if .Values.appUser -}}
|
||||||
|
{{ urlquery .Values.appUser -}}
|
||||||
|
{{- if .Values.appPassword -}}
|
||||||
|
:{{ urlquery .Values.appPassword }}
|
||||||
|
{{- end -}}
|
||||||
|
@
|
||||||
|
{{- end -}}
|
||||||
|
{{- include "mysql-cluster.clusterName" . -}}-mysql-master:3306
|
||||||
|
{{- if .Values.appDatabase -}}
|
||||||
|
/{{- .Values.appDatabase -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "mysql-cluster.clusterName" -}}
|
||||||
|
{{- printf "%s-db" (include "mysql-cluster.fullname" .) | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "mysql-cluster.secretName" -}}
|
||||||
|
{{- printf "%s-db" (include "mysql-cluster.fullname" .) | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "mysql-cluster.backupSecretName" -}}
|
||||||
|
{{- printf "%s-db-backup" (include "mysql-cluster.fullname" .) | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
23
deploy/mysql/mysql-cluster/templates/backup-secret.yaml
Normal file
23
deploy/mysql/mysql-cluster/templates/backup-secret.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{{- if .Values.backupCredentials }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ template "mysql-cluster.backupSecretName" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ template "mysql-cluster.name" . }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
{{- if .Values.backupSecretLabels }}
|
||||||
|
{{- toYaml .Values.backupSecretLabels | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.backupSecretAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{ toYaml .Values.backupSecretAnnotations }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{- range $key, $value := .Values.backupCredentials }}
|
||||||
|
{{ $key | upper }}: {{ $value | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
78
deploy/mysql/mysql-cluster/templates/cluster.yaml
Normal file
78
deploy/mysql/mysql-cluster/templates/cluster.yaml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
apiVersion: mysql.presslabs.org/v1alpha1
|
||||||
|
kind: MysqlCluster
|
||||||
|
metadata:
|
||||||
|
name: {{ include "mysql-cluster.clusterName" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ template "mysql-cluster.name" . }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.replicas }}
|
||||||
|
|
||||||
|
{{- if .Values.customSecretName }}
|
||||||
|
secretName: {{ .Values.customSecretName }}
|
||||||
|
{{- else }}
|
||||||
|
secretName: {{ include "mysql-cluster.secretName" . }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.image }}
|
||||||
|
image: {{ .Values.image }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.mysqlVersion }}
|
||||||
|
mysqlVersion: {{ .Values.mysqlVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.initBucketURL }}
|
||||||
|
initBucketURL: {{ .Values.initBucketURL }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.initBucketSecretName }}
|
||||||
|
initBucketSecretName: {{ .Values.initBucketSecretName }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.backupSecretName }}
|
||||||
|
backupSecretName: {{ .Values.backupSecretName }}
|
||||||
|
{{- else if .Values.backupCredentials }}
|
||||||
|
backupSecretName: {{ include "mysql-cluster.backupSecretName" . }}
|
||||||
|
{{- else if .Values.backupSchedule }}
|
||||||
|
{{ required "One of .mysql.backupSecretName and .mysql.backupCredentials should be specified" "" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.serverIDOffset }}
|
||||||
|
serverIDOffset: {{ .Values.serverIDOffset }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.backupSchedule }}
|
||||||
|
backupSchedule: "{{ .Values.backupSchedule }}"
|
||||||
|
backupRemoteDeletePolicy: {{ .Values.backupRemoteDeletePolicy }}
|
||||||
|
backupURL: {{ required ".mysql.backupURL is missing" .Values.backupURL }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.backupScheduleJobsHistoryLimit }}
|
||||||
|
backupScheduleJobsHistoryLimit: {{ .Values.backupScheduleJobsHistoryLimit }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.mysqlConf }}
|
||||||
|
mysqlConf:
|
||||||
|
{{- toYaml .Values.mysqlConf | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.podSpec }}
|
||||||
|
podSpec:
|
||||||
|
{{- toYaml .Values.podSpec | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.volumeSpec }}
|
||||||
|
volumeSpec:
|
||||||
|
{{- toYaml .Values.volumeSpec | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.initFileExtraSQL }}
|
||||||
|
initFileExtraSQL:
|
||||||
|
{{- toYaml .Values.initFileExtraSQL | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.queryLimits }}
|
||||||
|
queryLimits:
|
||||||
|
{{ toYaml .Values.queryLimits | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
25
deploy/mysql/mysql-cluster/templates/secret.yaml
Normal file
25
deploy/mysql/mysql-cluster/templates/secret.yaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{{- if not .Values.customSecretName }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "mysql-cluster.secretName" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ template "mysql-cluster.name" . }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
{{- if .Values.appSecretLabels }}
|
||||||
|
{{- toYaml .Values.appSecretLabels | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.appSecretAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{ toYaml .Values.appSecretAnnotations }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
ROOT_PASSWORD: {{ required ".rootPassword is missing" .Values.rootPassword | b64enc | quote }}
|
||||||
|
USER: {{ .Values.appUser | b64enc | quote }}
|
||||||
|
PASSWORD: {{ .Values.appPassword | b64enc | quote }}
|
||||||
|
DATABASE: {{ .Values.appDatabase | b64enc | quote }}
|
||||||
|
DB_CONNECT_URL: {{ include "mysql-cluster.dbConnectURL" . | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
76
deploy/mysql/mysql-cluster/values.yaml
Normal file
76
deploy/mysql/mysql-cluster/values.yaml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# Default values for mysql-cluster.
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
# Declare variables to be passed into your templates.
|
||||||
|
|
||||||
|
## The cluster number of nodes
|
||||||
|
replicas: 1
|
||||||
|
|
||||||
|
## For setting custom docker image or specifying mysql version
|
||||||
|
## the image field has priority over mysqlVersion.
|
||||||
|
# image: percona:5.7
|
||||||
|
# mysqlVersion: "5.7"
|
||||||
|
|
||||||
|
## MySQL connect credentials, those credentials will be provisioned in the cluster
|
||||||
|
rootPassword: "CHANGE_ME"
|
||||||
|
appUser: ""
|
||||||
|
appPassword: ""
|
||||||
|
appDatabase: ""
|
||||||
|
# appSecretLabels: {}
|
||||||
|
# appSecretAnnotations: {}
|
||||||
|
|
||||||
|
podSpec:
|
||||||
|
mysqlConf:
|
||||||
|
volumeSpec:
|
||||||
|
|
||||||
|
serverIDOffset:
|
||||||
|
|
||||||
|
initBucketURL:
|
||||||
|
initBucketSecretName:
|
||||||
|
|
||||||
|
backupSchedule:
|
||||||
|
backupScheduleJobsHistoryLimit:
|
||||||
|
backupURL:
|
||||||
|
backupSecretName:
|
||||||
|
backupRemoteDeletePolicy:
|
||||||
|
# backupSecretLabels: {}
|
||||||
|
# backupSecretAnnotations: {}
|
||||||
|
backupCredentials:
|
||||||
|
# use s3 https://rclone.org/s3/
|
||||||
|
# S3_PROVIDER: ? # like: AWS, Minio, Ceph, and so on
|
||||||
|
# S3_ENDPOINT: ?
|
||||||
|
# AWS_ACCESS_KEY_ID: ?
|
||||||
|
# AWS_SECRET_ACCESS_KEY: ?
|
||||||
|
# AWS_REGION: ?
|
||||||
|
# AWS_ACL: ?
|
||||||
|
# AWS_STORAGE_CLASS: ?
|
||||||
|
# AWS_SESSION_TOKEN: ?
|
||||||
|
|
||||||
|
# use google cloud storage https://rclone.org/googlecloudstorage/
|
||||||
|
# GCS_SERVICE_ACCOUNT_JSON_KEY: ?
|
||||||
|
# GCS_PROJECT_ID: ?
|
||||||
|
# GCS_OBJECT_ACL: ?
|
||||||
|
# GCS_BUCKET_ACL: ?
|
||||||
|
# GCS_LOCATION: ?
|
||||||
|
# GCS_STORAGE_CLASS: MULTI_REGIONAL
|
||||||
|
|
||||||
|
# use http https://rclone.org/http/
|
||||||
|
# HTTP_URL: ?
|
||||||
|
|
||||||
|
# use google drive https://rclone.org/drive/
|
||||||
|
# GDRIVE_CLIENT_ID: ?
|
||||||
|
# GDRIVE_ROOT_FOLDER_ID: ?
|
||||||
|
# GDRIVE_IMPERSONATOR: ?
|
||||||
|
|
||||||
|
# use azure https://rclone.org/azureblob/
|
||||||
|
# AZUREBLOB_ACCOUNT: ?
|
||||||
|
# AZUREBLOB_KEY: ?
|
||||||
|
|
||||||
|
## For enabling and configuring pt-kill: https://www.percona.com/doc/percona-toolkit/LATEST/pt-kill.html
|
||||||
|
#queryLimits:
|
||||||
|
# maxIdleTime: ... # pt-kill --idle-time
|
||||||
|
# maxQueryTime: ... # pt-kill --busy-time
|
||||||
|
# kill: oldest|all|all-but-oldest # pt-kill --victims
|
||||||
|
# killMode: query|connection # pt-kill --kill-query or pt-kill --kill
|
||||||
|
# ignoreDb: [] # pt-kill --ignore-db ...
|
||||||
|
# ignoreCommand: [] # pt-kill --ignore-command ...
|
||||||
|
# ignoreUser: [] # pt-kill --ignore-user
|
||||||
21
deploy/mysql/mysql-operator/.helmignore
Normal file
21
deploy/mysql/mysql-operator/.helmignore
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
51
deploy/mysql/mysql-operator/Chart.yaml
Normal file
51
deploy/mysql/mysql-operator/Chart.yaml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: mysql-operator
|
||||||
|
description: A helm chart for Bitpoke Operator for MySQL
|
||||||
|
appVersion: "latest"
|
||||||
|
kubeVersion: ">= 1.19.0-0"
|
||||||
|
keywords:
|
||||||
|
- mysql
|
||||||
|
- percona
|
||||||
|
- orchestrator
|
||||||
|
- bitpoke
|
||||||
|
- database
|
||||||
|
version: 0.0.0
|
||||||
|
home: https://www.bitpoke.io/mysql-operator/
|
||||||
|
sources:
|
||||||
|
- https://github.com/bitpoke/mysql-operator.git
|
||||||
|
annotations:
|
||||||
|
artifacthub.io/license: "Apache-2.0"
|
||||||
|
artifacthub.io/operator: "true"
|
||||||
|
artifacthub.io/operatorCapabilities: "full lifecycle"
|
||||||
|
artifacthub.io/images: |
|
||||||
|
- name: mysql-operator
|
||||||
|
image: docker.io/bitpoke/mysql-operator:latest
|
||||||
|
whitelisted: true
|
||||||
|
- name: orchestrator
|
||||||
|
image: docker.io/bitpoke/mysql-operator-orchestrator:latest
|
||||||
|
whitelisted: true
|
||||||
|
- name: mysql-5.7-sidecar
|
||||||
|
image: docker.io/bitpoke/mysql-operator-sidecar-5.7:latest
|
||||||
|
whitelisted: true
|
||||||
|
- name: mysql-8.0-sidecar
|
||||||
|
image: docker.io/bitpoke/mysql-operator-sidecar-8.0:latest
|
||||||
|
whitelisted: true
|
||||||
|
artifacthub.io/crds: |
|
||||||
|
- kind: MySQLCluster
|
||||||
|
version: v1alpha1
|
||||||
|
name: mysqlclusters.mysql.presslabs.org
|
||||||
|
displayName: MySQLCluster
|
||||||
|
description: Represents a MySQL cluster managed by Bitpoke's Operator for MySQL.
|
||||||
|
artifacthub.io/crdsExamples: |
|
||||||
|
- apiVersion: v1alpha1
|
||||||
|
kind: MysqlCluster
|
||||||
|
metadata:
|
||||||
|
name: my-cluster
|
||||||
|
spec:
|
||||||
|
replicas: 3
|
||||||
|
secretName: my-secret
|
||||||
|
mysqlConf:
|
||||||
|
innodb-buffer-size: 128M
|
||||||
|
targetSLO:
|
||||||
|
maxSlaveLatency: 10s
|
||||||
|
|
||||||
58
deploy/mysql/mysql-operator/README.md
Normal file
58
deploy/mysql/mysql-operator/README.md
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# Bitpoke MySQL Operator
|
||||||
|
|
||||||
|
This is the helm chart for [mysql-operator](https://github.com/bitpoke/mysql-operator).
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```sh
|
||||||
|
## For Helm v3
|
||||||
|
helm repo add bitpoke https://helm-charts.bitpoke.io
|
||||||
|
helm install mysql-operator bitpoke/mysql-operator
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The following table contains the configuration parameters for mysql-operator and default values.
|
||||||
|
|
||||||
|
| Parameter | Description | Default value |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `replicaCount` | Replicas for controller | `1` |
|
||||||
|
| `image.repository` | Docker repository for MySQL operator controller | `docker.io/bitpoke/mysql-operator` |
|
||||||
|
| `image.tag` | Docker image tag for MySQL operator controller | `latest` |
|
||||||
|
| `image.pullPolicy` | Docker image pull policy for MySQL operator controller | `IfNotPresent` |
|
||||||
|
| `sidecar57.image.repository` | Docker repository for sidecar image for MySQL 5.7 | `docker.io/bitpoke/mysql-operator-sidecar-5.7` |
|
||||||
|
| `sidecar57.image.tag` | Docker image tag for sidecar image for MySQL 5.7 | `latest` |
|
||||||
|
| `sidecar80.image.repository` | Docker repository for sidecar image for MySQL 8.0 | `docker.io/bitpoke/mysql-operator-sidecar-8.0` |
|
||||||
|
| `sidecar80.image.tag` | Docker image tag for sidecar image for MySQL 8.0 | `latest` |
|
||||||
|
| `metricsExporter.image.repository` | Docker repository for MySQL metrics exporter | `docker.io/prom/mysqld-exporter` |
|
||||||
|
| `metricsExporter.image.tag` | Docker image tag for MySQL metrics exporter | `v0.13.0` |
|
||||||
|
| `imagePullSecrets` | Controller image pull secrets | `[]` |
|
||||||
|
| `extraEnv` | MySQL Operator controller extra environment variables | `[]` |
|
||||||
|
| `extraArgs` | MySQL Operator controller extra command line arguments | `[]` |
|
||||||
|
| `resources` | MySQL Operator controller resources limits and requests | `{}` |
|
||||||
|
| `rbac.create` | Specifies whether RBAC objects like `Role` and `RoleBinding` should be created | `true` |
|
||||||
|
| `serviceAccount.create` | Specifies whether a service account should be created | `true` |
|
||||||
|
| `serviceAccount.annotations` | Annotations to add to the service account | `{}` |
|
||||||
|
| `serviceAccount.name` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template. | `empty` |
|
||||||
|
| `podAnnotations` | Extra pod annotations | `{}` |
|
||||||
|
| `podSecurityContext` | The pod security context. `65532` is the UID/GID for the nonroot user in the official images | `{runAsNonRoot: true, runAsUser: 65532, runAsGroup: 65532, fsGroup: 65532}` |
|
||||||
|
| `securityContext` | Security context for the MySQL Operator container | `{}` |
|
||||||
|
| `podDisruptionBudget.enabled` | Specifies whether a PodDisruptionBudget for the MySQL operator StatefulSet should be created. <br /> _NOTE_ it only takes effect if `replicaCount` is greated than 1. | `true` |
|
||||||
|
| `podDisruptionBudget.minAvailable` | ref: <https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget> | `empty` |
|
||||||
|
| `podDisruptionBudget.maxUnavailable` | ref: <https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget> | `1` |
|
||||||
|
| `nodeSelector` | MySQL Operator pod nodeSelector | `{}` |
|
||||||
|
| `tolerations` | MySQL Operator pod tolerations | `[]` |
|
||||||
|
| `affinity` | MySQL Operator pod affinity | `{}` |
|
||||||
|
| `gracefulShutdown.enabled` | Insert a pre-stop lifecycle hook and trigger a failover when a MySQL pod is stopped | `true` |
|
||||||
|
| `watchNamespace` | The namespace where the operator to watch for resources. Leave empty to watch all namespaces. | `empty` |
|
||||||
|
| `orchestrator.image.repository` | Docker repository for [orchestrator](https://github.com/openark/orchestrator) | `docker.io/bitpoke/mysql-operator-orchestrator` |
|
||||||
|
| `orchestrator.image.tag` | Docker image tag for [orchestrator](https://github.com/openark/orchestrator) | `latest` |
|
||||||
|
| `orchestrator.image.pullPolicy` | Docker image pull policy for [orchestrator](https://github.com/openark/orchestrator) | `IfNotPresent` |
|
||||||
|
| `orchestrator.topologyUser` | Set a user for orchestrator to use it to connect to the MySQL cluster | `orchestrator` |
|
||||||
|
| `orchestrator.topologyPassword` | Set a password for the orchestrator user to connect to MySQL cluster | `<random string>` |
|
||||||
|
| `orchestrator.persistence.enabled` | Specifies whether to enable the persistence for Orchestrator pods | `true` |
|
||||||
|
| `orchestrator.persistence.*` | Check `values.yaml` | |
|
||||||
|
| `orchestrator.ingress.enabled` | Specifies whether to enable the ingress for Orchestrator | `false` |
|
||||||
|
| `orchestrator.ingress.*` | Check `values.yaml` | |
|
||||||
|
| `orchestrator.service.*` | Orchestrator `Service` definition. Check `values.yaml` | |
|
||||||
|
| `orchestrator.persistence.fsGroupWorkaroundEnabled` | Adds a workaround for persistent volume provisioners which don't support fsGroup (eg. when deploying to kind) [#615](https://github.com/bitpoke/mysql-operator/issues/615) | `false` |
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
controller-gen.kubebuilder.io/version: v0.7.0
|
||||||
|
name: mysqlbackups.mysql.presslabs.org
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: mysql-operator
|
||||||
|
spec:
|
||||||
|
group: mysql.presslabs.org
|
||||||
|
names:
|
||||||
|
kind: MysqlBackup
|
||||||
|
listKind: MysqlBackupList
|
||||||
|
plural: mysqlbackups
|
||||||
|
singular: mysqlbackup
|
||||||
|
scope: Namespaced
|
||||||
|
versions:
|
||||||
|
- name: v1alpha1
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
description: MysqlBackup is the Schema for the mysqlbackups API
|
||||||
|
properties:
|
||||||
|
apiVersion:
|
||||||
|
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||||
|
type: string
|
||||||
|
metadata:
|
||||||
|
type: object
|
||||||
|
spec:
|
||||||
|
description: MysqlBackupSpec defines the desired state of MysqlBackup
|
||||||
|
properties:
|
||||||
|
backupSecretName:
|
||||||
|
description: BackupSecretName the name of secrets that contains the credentials to access the bucket. Default is used the secret specified in cluster.
|
||||||
|
type: string
|
||||||
|
backupURL:
|
||||||
|
description: BackupURL represents the URL to the backup location, this can be partially specifyied. Default is used the one specified in the cluster.
|
||||||
|
type: string
|
||||||
|
clusterName:
|
||||||
|
description: ClustterName represents the cluster for which to take backup
|
||||||
|
type: string
|
||||||
|
remoteDeletePolicy:
|
||||||
|
description: RemoteDeletePolicy the deletion policy that specify how to treat the data from remote storage. By default it's used softDelete.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- clusterName
|
||||||
|
type: object
|
||||||
|
status:
|
||||||
|
description: MysqlBackupStatus defines the observed state of MysqlBackup
|
||||||
|
properties:
|
||||||
|
completed:
|
||||||
|
description: Completed indicates whether the backup is in a final state, no matter whether its' corresponding job failed or succeeded
|
||||||
|
type: boolean
|
||||||
|
conditions:
|
||||||
|
description: Conditions represents the backup resource conditions list.
|
||||||
|
items:
|
||||||
|
description: BackupCondition defines condition struct for backup resource
|
||||||
|
properties:
|
||||||
|
lastTransitionTime:
|
||||||
|
description: LastTransitionTime
|
||||||
|
format: date-time
|
||||||
|
type: string
|
||||||
|
message:
|
||||||
|
description: Message
|
||||||
|
type: string
|
||||||
|
reason:
|
||||||
|
description: Reason
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
description: Status of the condition, one of (\"True\", \"False\", \"Unknown\")
|
||||||
|
type: string
|
||||||
|
type:
|
||||||
|
description: type of cluster condition, values in (\"Ready\")
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- lastTransitionTime
|
||||||
|
- message
|
||||||
|
- reason
|
||||||
|
- status
|
||||||
|
- type
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
type: object
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
preserveUnknownFields: false
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,113 @@
|
|||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
controller-gen.kubebuilder.io/version: v0.7.0
|
||||||
|
name: mysqldatabases.mysql.presslabs.org
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: mysql-operator
|
||||||
|
spec:
|
||||||
|
group: mysql.presslabs.org
|
||||||
|
names:
|
||||||
|
kind: MysqlDatabase
|
||||||
|
listKind: MysqlDatabaseList
|
||||||
|
plural: mysqldatabases
|
||||||
|
singular: mysqldatabase
|
||||||
|
scope: Namespaced
|
||||||
|
versions:
|
||||||
|
- additionalPrinterColumns:
|
||||||
|
- description: The database status
|
||||||
|
jsonPath: .status.conditions[?(@.type == 'Ready')].status
|
||||||
|
name: Ready
|
||||||
|
type: string
|
||||||
|
- jsonPath: .spec.clusterRef.name
|
||||||
|
name: Cluster
|
||||||
|
type: string
|
||||||
|
- jsonPath: .spec.database
|
||||||
|
name: Database
|
||||||
|
type: string
|
||||||
|
- jsonPath: .metadata.creationTimestamp
|
||||||
|
name: Age
|
||||||
|
type: date
|
||||||
|
name: v1alpha1
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
description: MysqlDatabase is the Schema for the MySQL database API
|
||||||
|
properties:
|
||||||
|
apiVersion:
|
||||||
|
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||||
|
type: string
|
||||||
|
metadata:
|
||||||
|
type: object
|
||||||
|
spec:
|
||||||
|
description: MysqlDatabaseSpec defines the desired state of MysqlDatabaseSpec
|
||||||
|
properties:
|
||||||
|
characterSet:
|
||||||
|
description: CharacterSet represents the charset name used when database is created
|
||||||
|
type: string
|
||||||
|
clusterRef:
|
||||||
|
description: ClusterRef represents a reference to the MySQL cluster. This field should be immutable.
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
|
||||||
|
type: string
|
||||||
|
namespace:
|
||||||
|
description: Namespace the MySQL cluster namespace
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
collation:
|
||||||
|
description: Collation represents the collation name used as default database collation
|
||||||
|
type: string
|
||||||
|
database:
|
||||||
|
description: Database represents the database name which will be created. This field should be immutable.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- clusterRef
|
||||||
|
- database
|
||||||
|
type: object
|
||||||
|
status:
|
||||||
|
description: MysqlDatabaseStatus defines the observed state of MysqlDatabase
|
||||||
|
properties:
|
||||||
|
conditions:
|
||||||
|
description: Conditions represents the MysqlDatabase resource conditions list.
|
||||||
|
items:
|
||||||
|
description: MysqlDatabaseCondition defines the condition struct for a MysqlDatabase resource
|
||||||
|
properties:
|
||||||
|
lastTransitionTime:
|
||||||
|
description: Last time the condition transitioned from one status to another.
|
||||||
|
format: date-time
|
||||||
|
type: string
|
||||||
|
lastUpdateTime:
|
||||||
|
description: The last time this condition was updated.
|
||||||
|
format: date-time
|
||||||
|
type: string
|
||||||
|
message:
|
||||||
|
description: A human readable message indicating details about the transition.
|
||||||
|
type: string
|
||||||
|
reason:
|
||||||
|
description: The reason for the condition's last transition.
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
description: Status of the condition, one of True, False, Unknown.
|
||||||
|
type: string
|
||||||
|
type:
|
||||||
|
description: Type of MysqlDatabase condition.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- lastTransitionTime
|
||||||
|
- message
|
||||||
|
- reason
|
||||||
|
- status
|
||||||
|
- type
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
type: object
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
subresources:
|
||||||
|
status: {}
|
||||||
|
preserveUnknownFields: false
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
controller-gen.kubebuilder.io/version: v0.7.0
|
||||||
|
name: mysqlusers.mysql.presslabs.org
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: mysql-operator
|
||||||
|
spec:
|
||||||
|
group: mysql.presslabs.org
|
||||||
|
names:
|
||||||
|
kind: MysqlUser
|
||||||
|
listKind: MysqlUserList
|
||||||
|
plural: mysqlusers
|
||||||
|
singular: mysqluser
|
||||||
|
scope: Namespaced
|
||||||
|
versions:
|
||||||
|
- additionalPrinterColumns:
|
||||||
|
- description: The user status
|
||||||
|
jsonPath: .status.conditions[?(@.type == 'Ready')].status
|
||||||
|
name: Ready
|
||||||
|
type: string
|
||||||
|
- jsonPath: .spec.clusterRef.name
|
||||||
|
name: Cluster
|
||||||
|
type: string
|
||||||
|
- jsonPath: .spec.user
|
||||||
|
name: UserName
|
||||||
|
type: string
|
||||||
|
- jsonPath: .metadata.creationTimestamp
|
||||||
|
name: Age
|
||||||
|
type: date
|
||||||
|
name: v1alpha1
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
description: MysqlUser is the Schema for the MySQL User API
|
||||||
|
properties:
|
||||||
|
apiVersion:
|
||||||
|
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||||
|
type: string
|
||||||
|
metadata:
|
||||||
|
type: object
|
||||||
|
spec:
|
||||||
|
description: MysqlUserSpec defines the desired state of MysqlUserSpec
|
||||||
|
properties:
|
||||||
|
allowedHosts:
|
||||||
|
description: AllowedHosts is the allowed host to connect from.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
clusterRef:
|
||||||
|
description: ClusterRef represents a reference to the MySQL cluster. This field should be immutable.
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
|
||||||
|
type: string
|
||||||
|
namespace:
|
||||||
|
description: Namespace the MySQL cluster namespace
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
password:
|
||||||
|
description: Password is the password for the user.
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
description: The key of the secret to select from. Must be a valid secret key.
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
|
||||||
|
type: string
|
||||||
|
optional:
|
||||||
|
description: Specify whether the Secret or its key must be defined
|
||||||
|
type: boolean
|
||||||
|
required:
|
||||||
|
- key
|
||||||
|
type: object
|
||||||
|
permissions:
|
||||||
|
description: Permissions is the list of roles that user has in the specified database.
|
||||||
|
items:
|
||||||
|
description: MysqlPermission defines a MySQL schema permission
|
||||||
|
properties:
|
||||||
|
permissions:
|
||||||
|
description: Permissions represents the permissions granted on the schema/tables
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
schema:
|
||||||
|
description: Schema represents the schema to which the permission applies
|
||||||
|
type: string
|
||||||
|
tables:
|
||||||
|
description: Tables represents the tables inside the schema to which the permission applies
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
required:
|
||||||
|
- permissions
|
||||||
|
- schema
|
||||||
|
- tables
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
resourceLimits:
|
||||||
|
additionalProperties:
|
||||||
|
anyOf:
|
||||||
|
- type: integer
|
||||||
|
- type: string
|
||||||
|
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||||
|
x-kubernetes-int-or-string: true
|
||||||
|
description: 'ResourceLimits allow settings limit per mysql user as defined here: https://dev.mysql.com/doc/refman/5.7/en/user-resources.html'
|
||||||
|
type: object
|
||||||
|
user:
|
||||||
|
description: User is the name of the user that will be created with will access the specified database. This field should be immutable.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- allowedHosts
|
||||||
|
- clusterRef
|
||||||
|
- password
|
||||||
|
- user
|
||||||
|
type: object
|
||||||
|
status:
|
||||||
|
description: MysqlUserStatus defines the observed state of MysqlUser
|
||||||
|
properties:
|
||||||
|
allowedHosts:
|
||||||
|
description: AllowedHosts contains the list of hosts that the user is allowed to connect from.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
conditions:
|
||||||
|
description: Conditions represents the MysqlUser resource conditions list.
|
||||||
|
items:
|
||||||
|
description: MySQLUserCondition defines the condition struct for a MysqlUser resource
|
||||||
|
properties:
|
||||||
|
lastTransitionTime:
|
||||||
|
description: Last time the condition transitioned from one status to another.
|
||||||
|
format: date-time
|
||||||
|
type: string
|
||||||
|
lastUpdateTime:
|
||||||
|
description: The last time this condition was updated.
|
||||||
|
format: date-time
|
||||||
|
type: string
|
||||||
|
message:
|
||||||
|
description: A human readable message indicating details about the transition.
|
||||||
|
type: string
|
||||||
|
reason:
|
||||||
|
description: The reason for the condition's last transition.
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
description: Status of the condition, one of True, False, Unknown.
|
||||||
|
type: string
|
||||||
|
type:
|
||||||
|
description: Type of MysqlUser condition.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- lastTransitionTime
|
||||||
|
- message
|
||||||
|
- reason
|
||||||
|
- status
|
||||||
|
- type
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
type: object
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
subresources:
|
||||||
|
status: {}
|
||||||
|
preserveUnknownFields: false
|
||||||
19
deploy/mysql/mysql-operator/templates/NOTES.txt
Normal file
19
deploy/mysql/mysql-operator/templates/NOTES.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
You can create a new cluster by issuing:
|
||||||
|
|
||||||
|
cat <<EOF | kubectl apply -f-
|
||||||
|
apiVersion: mysql.presslabs.org/v1alpha1
|
||||||
|
kind: MysqlCluster
|
||||||
|
metadata:
|
||||||
|
name: my-cluster
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
secretName: my-cluster-secret
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: my-cluster-secret
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
ROOT_PASSWORD: $(echo -n "not-so-secure" | base64)
|
||||||
|
EOF
|
||||||
62
deploy/mysql/mysql-operator/templates/_helpers.tpl
Normal file
62
deploy/mysql/mysql-operator/templates/_helpers.tpl
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "mysql-operator.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "mysql-operator.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride }}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||||
|
{{- 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 "mysql-operator.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Common labels
|
||||||
|
*/}}
|
||||||
|
{{- define "mysql-operator.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "mysql-operator.chart" . }}
|
||||||
|
{{ include "mysql-operator.selectorLabels" . }}
|
||||||
|
{{- if .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Selector labels
|
||||||
|
*/}}
|
||||||
|
{{- define "mysql-operator.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "mysql-operator.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "mysql-operator.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
{{- default (include "mysql-operator.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else }}
|
||||||
|
{{- default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{{- define "orchestrator.name" -}}
|
||||||
|
{{- $name := include "mysql-operator.name" . | trunc 50 | trimSuffix "-" }}
|
||||||
|
{{- printf "%s-orchestrator" $name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "orchestrator.fullname" -}}
|
||||||
|
{{- $fullname := include "mysql-operator.fullname" . | trunc 59 | trimSuffix "-" }}
|
||||||
|
{{- printf "%s-orc" $fullname }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "orchestrator.raftList" -}}
|
||||||
|
{{- $replicas := int .Values.replicaCount }}
|
||||||
|
{{- $fullname := include "mysql-operator.fullname" . }}
|
||||||
|
{{- $nodes := (dict) }}
|
||||||
|
{{- range $i := until $replicas }}
|
||||||
|
{{- $_ := set $nodes (printf "%d" $i) (printf "%s-%d-orc-svc" $fullname $i) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- values $nodes | sortAlpha | join "," }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "orchestrator.secretName" -}}
|
||||||
|
{{- if .Values.orchestrator.secretName -}}
|
||||||
|
{{ .Values.orchestrator.secretName }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ include "orchestrator.fullname" . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "orchestrator.apiURL" -}}
|
||||||
|
{{- $port := "" }}
|
||||||
|
{{- if ne (printf "%d" .Values.orchestrator.service.port) "80" }}
|
||||||
|
{{- $port := printf ":$d" .Values.orchestrator.service.port }}
|
||||||
|
{{- end -}}
|
||||||
|
http://{{ template "mysql-operator.fullname" . }}.{{ .Release.Namespace }}{{ $port }}/api
|
||||||
|
{{- end }}
|
||||||
142
deploy/mysql/mysql-operator/templates/clusterrole.yaml
Normal file
142
deploy/mysql/mysql-operator/templates/clusterrole.yaml
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
{{- if .Values.rbac.create }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: {{ include "mysql-operator.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- apps
|
||||||
|
resources:
|
||||||
|
- statefulsets
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- batch
|
||||||
|
resources:
|
||||||
|
- jobs
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- coordination.k8s.io
|
||||||
|
resources:
|
||||||
|
- leases
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- configmaps
|
||||||
|
- events
|
||||||
|
- jobs
|
||||||
|
- persistentvolumeclaims
|
||||||
|
- pods
|
||||||
|
- secrets
|
||||||
|
- services
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- pods/status
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- mysql.presslabs.org
|
||||||
|
resources:
|
||||||
|
- mysqlbackups
|
||||||
|
- mysqlbackups/finalizers
|
||||||
|
- mysqlbackups/status
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- mysql.presslabs.org
|
||||||
|
resources:
|
||||||
|
- mysqlclusters
|
||||||
|
- mysqlclusters/finalizers
|
||||||
|
- mysqlclusters/status
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- mysql.presslabs.org
|
||||||
|
resources:
|
||||||
|
- mysqldatabases
|
||||||
|
- mysqldatabases/finalizers
|
||||||
|
- mysqldatabases/status
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- mysql.presslabs.org
|
||||||
|
resources:
|
||||||
|
- mysqlusers
|
||||||
|
- mysqlusers/status
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- policy
|
||||||
|
resources:
|
||||||
|
- poddisruptionbudgets
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{{- if .Values.rbac.create -}}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ include "mysql-operator.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: {{ template "mysql-operator.fullname" . }}
|
||||||
|
subjects:
|
||||||
|
- name: {{ template "mysql-operator.serviceAccountName" . }}
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
kind: ServiceAccount
|
||||||
|
{{- end -}}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# This is a ServicMonitor for the MySQL Clusters.
|
||||||
|
# To scrape the operator, we need https://github.com/bitpoke/mysql-operator/issues/151 first.
|
||||||
|
{{- if .Values.mysqlClustersGlobalServiceMonitor.enabled }}
|
||||||
|
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ template "mysql-operator.fullname" . }}-clusters
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
{{- if .Values.mysqlClustersGlobalServiceMonitor.additionalLabels }}
|
||||||
|
{{ toYaml .Values.mysqlClustersGlobalServiceMonitor.additionalLabels | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.mysqlClustersGlobalServiceMonitor.namespaceSelector }}
|
||||||
|
namespaceSelector:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.mysqlClustersGlobalServiceMonitor.selector }}
|
||||||
|
selector:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.mysqlClustersGlobalServiceMonitor.jobLabel }}
|
||||||
|
jobLabel: {{ . | quote}}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.mysqlClustersGlobalServiceMonitor.targetLabels }}
|
||||||
|
targetLabels:
|
||||||
|
{{ toYaml . | trim | indent 4 -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.serviceMonitor.podTargetLabels }}
|
||||||
|
podTargetLabels:
|
||||||
|
{{ toYaml . | trim | indent 4 -}}
|
||||||
|
{{- end }}
|
||||||
|
endpoints:
|
||||||
|
- path: /metrics
|
||||||
|
port: {{ .Values.mysqlClustersGlobalServiceMonitor.servicePortName }}
|
||||||
|
{{- if .Values.mysqlClustersGlobalServiceMonitor.interval }}
|
||||||
|
interval: {{ .Values.mysqlClustersGlobalServiceMonitor.interval }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.mysqlClustersGlobalServiceMonitor.scrapeTimeout }}
|
||||||
|
scrapeTimeout: {{ .Values.mysqlClustersGlobalServiceMonitor.scrapeTimeout }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.mysqlClustersGlobalServiceMonitor.metricRelabelings }}
|
||||||
|
metricRelabelings: {{ toYaml .Values.mysqlClustersGlobalServiceMonitor.metricRelabelings | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{{- $replicas := int .Values.replicaCount }}
|
||||||
|
{{- $raftNodes := include "orchestrator.raftList" . | splitList "," }}
|
||||||
|
{{- $conf := .Values.orchestrator.config }}
|
||||||
|
{{- $_ := set $conf "ListenAddress" ":3000" }}
|
||||||
|
{{- $_ := set $conf "MySQLTopologyCredentialsConfigFile" "/etc/orchestrator/orc-topology.cnf" }}
|
||||||
|
{{- $_ := set $conf "BackendDB" "sqlite" }}
|
||||||
|
{{- $_ := set $conf "SQLite3DataFile" "/var/lib/orchestrator/orc.db" }}
|
||||||
|
{{- $_ := set $conf "RaftEnabled" true }}
|
||||||
|
{{- $_ := set $conf "RaftDataDir" "/var/lib/orchestrator" }}
|
||||||
|
{{- $_ := set $conf "RaftAdvertise" "{{ .Env.HOSTNAME }}-orc-svc" }}
|
||||||
|
{{- $_ := set $conf "RaftBind" "{{ .Env.HOSTNAME }}"}}
|
||||||
|
{{- $_ := set $conf "HTTPAdvertise" "http://{{ .Env.HOSTNAME }}-orc-svc:80" }}
|
||||||
|
{{- if eq 1 $replicas -}}
|
||||||
|
{{- $_ := set $conf "RaftNodes" (list) }}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $_ := set $conf "RaftNodes" $raftNodes }}
|
||||||
|
{{- end -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "orchestrator.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
orchestrator.conf.json: {{ toPrettyJson $conf | quote }}
|
||||||
|
orc-topology.cnf: |
|
||||||
|
[client]
|
||||||
|
user = {{ printf "{{ .Env.ORC_TOPOLOGY_USER }}" }}
|
||||||
|
password = {{ printf "{{ .Env.ORC_TOPOLOGY_PASSWORD }}" }}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
{{- if .Values.orchestrator.ingress.enabled -}}
|
||||||
|
{{- $fullName := include "mysql-operator.fullname" . -}}
|
||||||
|
{{- $svcPort := .Values.orchestrator.service.port -}}
|
||||||
|
{{- if and .Values.orchestrator.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||||
|
{{- if not (hasKey .Values.orchestrator.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||||
|
{{- $_ := set .Values.orchestrator.ingress.annotations "kubernetes.io/ingress.class" .Values.orchestrator.ingress.className}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
apiVersion: networking.k8s.io/v1beta1
|
||||||
|
{{- else -}}
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
{{- end }}
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ $fullName }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.orchestrator.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if and .Values.orchestrator.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||||
|
ingressClassName: {{ .Values.orchestrator.ingress.className }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.orchestrator.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.orchestrator.ingress.tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
secretName: {{ .secretName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .Values.orchestrator.ingress.hosts }}
|
||||||
|
- host: {{ .host | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- range .paths }}
|
||||||
|
- path: {{ .path }}
|
||||||
|
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||||
|
pathType: {{ .pathType }}
|
||||||
|
{{- end }}
|
||||||
|
backend:
|
||||||
|
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||||
|
service:
|
||||||
|
name: {{ $fullName }}
|
||||||
|
port:
|
||||||
|
number: {{ $svcPort }}
|
||||||
|
{{- else }}
|
||||||
|
serviceName: {{ $fullName }}
|
||||||
|
servicePort: {{ $svcPort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{{- $replicas := int .Values.replicaCount -}}
|
||||||
|
{{- $labels := (include "mysql-operator.labels" .) -}}
|
||||||
|
{{- $fullName := (include "mysql-operator.fullname" .) -}}
|
||||||
|
{{- range $i := until $replicas -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ printf "%s-%d-orc-svc" $fullName $i }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: orchestrator-raft
|
||||||
|
{{- $labels | nindent 4}}
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
publishNotReadyAddresses: true
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
targetPort: 3000
|
||||||
|
- name: raft
|
||||||
|
port: 10008
|
||||||
|
targetPort: 10008
|
||||||
|
selector:
|
||||||
|
statefulset.kubernetes.io/pod-name: {{ printf "%s-%d" $fullName $i }}
|
||||||
|
---
|
||||||
|
{{end}}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{{- if not .Values.orchestrator.secretName }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ template "orchestrator.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
TOPOLOGY_USER: {{ printf "%s" .Values.orchestrator.topologyUser | b64enc | quote }}
|
||||||
|
{{- if .Values.orchestrator.topologyPassword }}
|
||||||
|
TOPOLOGY_PASSWORD: {{ printf "%s" .Values.orchestrator.topologyPassword | b64enc | quote }}
|
||||||
|
{{- else }}
|
||||||
|
TOPOLOGY_PASSWORD: {{ randAlphaNum 10 | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
18
deploy/mysql/mysql-operator/templates/pdb.yaml
Normal file
18
deploy/mysql/mysql-operator/templates/pdb.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{{- if and .Values.podDisruptionBudget.enabled (gt (int64 .Values.replicaCount) 1) }}
|
||||||
|
apiVersion: policy/v1
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ include "mysql-operator.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.podDisruptionBudget.minAvailable }}
|
||||||
|
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.podDisruptionBudget.maxUnavailable }}
|
||||||
|
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "mysql-operator.selectorLabels" . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
23
deploy/mysql/mysql-operator/templates/service.yaml
Normal file
23
deploy/mysql/mysql-operator/templates/service.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "mysql-operator.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: operator
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.orchestrator.service.type }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.orchestrator.service.port }}
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: http
|
||||||
|
{{- if .Values.orchestrator.service.nodePort }}
|
||||||
|
nodePort: {{ .Values.orchestrator.service.nodePort }}
|
||||||
|
{{- end }}
|
||||||
|
- port: {{ .Values.serviceMonitor.servicePort }}
|
||||||
|
name: {{ .Values.serviceMonitor.servicePortName }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: prometheus
|
||||||
|
selector:
|
||||||
|
{{- include "mysql-operator.selectorLabels" . | nindent 4 }}
|
||||||
12
deploy/mysql/mysql-operator/templates/serviceaccount.yaml
Normal file
12
deploy/mysql/mysql-operator/templates/serviceaccount.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ include "mysql-operator.serviceAccountName" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.serviceAccount.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
43
deploy/mysql/mysql-operator/templates/servicemonitor.yaml
Normal file
43
deploy/mysql/mysql-operator/templates/servicemonitor.yaml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# This is a ServicMonitor for the MySQL operator itself.
|
||||||
|
# To scrape the operator, we need https://github.com/bitpoke/mysql-operator/issues/151 first.
|
||||||
|
{{- if .Values.serviceMonitor.enabled }}
|
||||||
|
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ template "mysql-operator.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
{{- if .Values.serviceMonitor.additionalLabels }}
|
||||||
|
{{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "mysql-operator.selectorLabels" . | nindent 6 }}
|
||||||
|
app.kubernetes.io/component: operator
|
||||||
|
{{- with .Values.serviceMonitor.jobLabel }}
|
||||||
|
jobLabel: {{ . | quote}}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.serviceMonitor.targetLabels }}
|
||||||
|
targetLabels:
|
||||||
|
{{ toYaml . | trim | indent 4 -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.serviceMonitor.podTargetLabels }}
|
||||||
|
podTargetLabels:
|
||||||
|
{{ toYaml . | trim | indent 4 -}}
|
||||||
|
{{- end }}
|
||||||
|
endpoints:
|
||||||
|
- path: /metrics
|
||||||
|
port: {{ .Values.serviceMonitor.servicePortName }}
|
||||||
|
{{- if .Values.serviceMonitor.interval }}
|
||||||
|
interval: {{ .Values.serviceMonitor.interval }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.serviceMonitor.scrapeTimeout }}
|
||||||
|
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.serviceMonitor.metricRelabelings }}
|
||||||
|
metricRelabelings: {{ toYaml .Values.serviceMonitor.metricRelabelings | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
195
deploy/mysql/mysql-operator/templates/statefulset.yaml
Normal file
195
deploy/mysql/mysql-operator/templates/statefulset.yaml
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
{{- $appVersion := .Chart.AppVersion -}}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: {{ include "mysql-operator.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.replicaCount }}
|
||||||
|
serviceName: {{ include "orchestrator.fullname" . }}
|
||||||
|
podManagementPolicy: Parallel
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "mysql-operator.selectorLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
{{- with .Values.podAnnotations }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
checksum/orchestrator-config: {{ include (print $.Template.BasePath "/orchestrator-config.yaml") . | sha256sum }}
|
||||||
|
checksum/orchestrator-secret: {{ include (print $.Template.BasePath "/orchestrator-secret.yaml") . | sha256sum }}
|
||||||
|
labels:
|
||||||
|
{{- include "mysql-operator.selectorLabels" . | nindent 8 }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ include "mysql-operator.serviceAccountName" . }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
containers:
|
||||||
|
- name: operator
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default $appVersion }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: prometheus
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: ORC_TOPOLOGY_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "orchestrator.secretName" . }}
|
||||||
|
key: TOPOLOGY_USER
|
||||||
|
- name: ORC_TOPOLOGY_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "orchestrator.secretName" . }}
|
||||||
|
key: TOPOLOGY_PASSWORD
|
||||||
|
{{- if .Values.extraEnv }}
|
||||||
|
{{- toYaml .Values.extraEnv | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
args:
|
||||||
|
- --leader-election-namespace={{ .Release.Namespace }}
|
||||||
|
- --orchestrator-uri={{ include "orchestrator.apiURL" . }}
|
||||||
|
{{- with .Values.sidecar57 }}
|
||||||
|
- --sidecar-image={{ .image.repository }}:{{ .image.tag | default $appVersion }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Values.sidecar80 }}
|
||||||
|
- --sidecar-mysql8-image={{ .image.repository }}:{{ .image.tag | default $appVersion }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Values.metricsExporter }}
|
||||||
|
- --metrics-exporter-image={{ .image.repository }}:{{ .image.tag }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Values.watchNamespace }}
|
||||||
|
- --namespace={{ .Values.watchNamespace }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.gracefulShutdown.enabled }}
|
||||||
|
- --failover-before-shutdown=true
|
||||||
|
{{- else }}
|
||||||
|
- --failover-before-shutdown=false
|
||||||
|
{{- end }}
|
||||||
|
{{- range $arg := .Values.extraArgs }}
|
||||||
|
- {{ $arg }}
|
||||||
|
{{- end }}
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: 8081
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /readyz
|
||||||
|
port: 8081
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
- name: orchestrator
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.orchestrator.securityContext | nindent 12 }}
|
||||||
|
image: {{ .Values.orchestrator.image.repository }}:{{ .Values.orchestrator.image.tag | default .Chart.AppVersion }}
|
||||||
|
imagePullPolicy: {{ .Values.orchestrator.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- containerPort: 3000
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
|
- containerPort: 10008
|
||||||
|
name: raft
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
|
{{- if .Values.orchestrator.extraEnv }}
|
||||||
|
{{- toYaml .Values.orchestrator.extraEnv | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
envFrom:
|
||||||
|
- prefix: ORC_
|
||||||
|
secretRef:
|
||||||
|
name: {{ include "orchestrator.secretName" . }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /var/lib/orchestrator
|
||||||
|
- name: config
|
||||||
|
mountPath: /usr/local/share/orchestrator/templates
|
||||||
|
livenessProbe:
|
||||||
|
timeoutSeconds: 10
|
||||||
|
initialDelaySeconds: 200
|
||||||
|
httpGet:
|
||||||
|
path: /api/lb-check
|
||||||
|
port: 3000
|
||||||
|
# https://github.com/github/orchestrator/blob/master/docs/raft.md#proxy-healthy-raft-nodes
|
||||||
|
readinessProbe:
|
||||||
|
timeoutSeconds: 10
|
||||||
|
httpGet:
|
||||||
|
path: /api/raft-health
|
||||||
|
port: 3000
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.orchestrator.resources | nindent 12 }}
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: {{ template "orchestrator.fullname" . }}
|
||||||
|
{{- if not .Values.orchestrator.persistence.enabled }}
|
||||||
|
- name: data
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.orchestrator.persistence.fsGroupWorkaroundEnabled }}
|
||||||
|
initContainers:
|
||||||
|
- name: init-mount
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
image: busybox:1.34.0
|
||||||
|
command: ['sh', '-c', "chown -R {{ .Values.podSecurityContext.fsGroup | default "0" }}:{{ .Values.podSecurityContext.fsGroup | default "0" }} /var/lib/orchestrator"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /var/lib/orchestrator
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- with .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.orchestrator.persistence.enabled }}
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: data
|
||||||
|
{{- with .Values.orchestrator.persistence.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
accessModes: [ {{ .Values.orchestrator.persistence.accessMode }} ]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.orchestrator.persistence.size }}
|
||||||
|
{{- if .Values.orchestrator.persistence.selector }}
|
||||||
|
{{- with .Values.orchestrator.persistence.selector.matchLabels }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.orchestrator.persistence.storageClass }}
|
||||||
|
{{- if (eq "-" .Values.orchestrator.persistence.storageClass) }}
|
||||||
|
storageClassName: ""
|
||||||
|
{{- else }}
|
||||||
|
storageClassName: "{{ .Values.orchestrator.persistence.storageClass }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
276
deploy/mysql/mysql-operator/values.yaml
Normal file
276
deploy/mysql/mysql-operator/values.yaml
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
# Default values for mysql-operator.
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
# Declare variables to be passed into your templates.
|
||||||
|
replicaCount: 1
|
||||||
|
|
||||||
|
image:
|
||||||
|
repository: docker.io/bitpoke/mysql-operator
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
|
tag: ""
|
||||||
|
|
||||||
|
sidecar57:
|
||||||
|
image:
|
||||||
|
repository: docker.io/bitpoke/mysql-operator-sidecar-5.7
|
||||||
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
|
tag: ""
|
||||||
|
|
||||||
|
sidecar80:
|
||||||
|
image:
|
||||||
|
repository: docker.io/bitpoke/mysql-operator-sidecar-8.0
|
||||||
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
|
tag: ""
|
||||||
|
|
||||||
|
metricsExporter:
|
||||||
|
image:
|
||||||
|
repository: docker.io/prom/mysqld-exporter
|
||||||
|
tag: "v0.13.0"
|
||||||
|
|
||||||
|
imagePullSecrets: []
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
extraEnv: []
|
||||||
|
|
||||||
|
extraArgs: []
|
||||||
|
|
||||||
|
rbac:
|
||||||
|
create: true
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
# Specifies whether a service account should be created
|
||||||
|
create: true
|
||||||
|
# Annotations to add to the service account
|
||||||
|
annotations: {}
|
||||||
|
# The name of the service account to use.
|
||||||
|
# If not set and create is true, a name is generated using the fullname template
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
podSecurityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
# 65532 is the UID for nonroot user from distroless image
|
||||||
|
runAsUser: 65532
|
||||||
|
runAsGroup: 65532
|
||||||
|
fsGroup: 65532
|
||||||
|
|
||||||
|
securityContext: {}
|
||||||
|
# capabilities:
|
||||||
|
# drop:
|
||||||
|
# - ALL
|
||||||
|
# readOnlyRootFilesystem: true
|
||||||
|
# runAsNonRoot: true
|
||||||
|
# runAsUser: 1000
|
||||||
|
|
||||||
|
podDisruptionBudget:
|
||||||
|
enabled: true
|
||||||
|
maxUnavailable: 1
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
# limits:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
# requests:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
affinity: {}
|
||||||
|
|
||||||
|
# Insert a pre-stop lifecycle hook and trigger a failover. NOTE: Use this when your cluster network
|
||||||
|
# policy allows to connect across namespaces and the mysql node is able to connecto to operator pod
|
||||||
|
gracefulShutdown:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# in which namespace to watch for resource, leave empty to watch in all namespaces
|
||||||
|
watchNamespace:
|
||||||
|
|
||||||
|
# Install a ServiceMonitor for monitoring the operator
|
||||||
|
serviceMonitor:
|
||||||
|
# enabled should be set to true to enable prometheus-operator discovery of this service
|
||||||
|
enabled: false
|
||||||
|
# the Service port.name where prometheus metrics are exposed
|
||||||
|
servicePortName: prometheus
|
||||||
|
# the Service port.port where metrics are exposed
|
||||||
|
servicePort: 9125
|
||||||
|
# interval is the interval at which metrics should be scraped
|
||||||
|
# interval: 30s
|
||||||
|
# scrapeTimeout is the timeout after which the scrape is ended
|
||||||
|
# scrapeTimeout: 10s
|
||||||
|
# additionalLabels is the set of additional labels to add to the ServiceMonitor
|
||||||
|
additionalLabels: {}
|
||||||
|
jobLabel: ""
|
||||||
|
targetLabels: []
|
||||||
|
podTargetLabels: []
|
||||||
|
metricRelabelings: []
|
||||||
|
|
||||||
|
# The operator will install a ServiceMonitor if you have prometheus-operator installed.
|
||||||
|
mysqlClustersGlobalServiceMonitor:
|
||||||
|
enabled: false
|
||||||
|
## Additional labels for the serviceMonitor. Useful if you have multiple prometheus operators running to select only specific ServiceMonitors
|
||||||
|
# additionalLabels:
|
||||||
|
# prometheus: prom-internal
|
||||||
|
interval: 10s
|
||||||
|
scrapeTimeout: 3s
|
||||||
|
# jobLabel:
|
||||||
|
# targetLabels:
|
||||||
|
# podTargetLabels:
|
||||||
|
# metricRelabelings:
|
||||||
|
servicePortName: prometheus
|
||||||
|
namespaceSelector:
|
||||||
|
any: true
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/managed-by: mysql.presslabs.org
|
||||||
|
app.kubernetes.io/name: mysql
|
||||||
|
|
||||||
|
orchestrator:
|
||||||
|
image:
|
||||||
|
repository: docker.io/bitpoke/mysql-operator-orchestrator
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
|
tag: ""
|
||||||
|
|
||||||
|
securityContext: {}
|
||||||
|
# capabilities:
|
||||||
|
# drop:
|
||||||
|
# - ALL
|
||||||
|
# readOnlyRootFilesystem: true
|
||||||
|
# runAsNonRoot: true
|
||||||
|
# runAsUser: 1000
|
||||||
|
|
||||||
|
# secretName: # specify an existing secret to use for orchestrator topology credentials
|
||||||
|
|
||||||
|
# if a secret is not specified one will be created for orchestrator user and password used to manage MySQL clusters
|
||||||
|
topologyUser: orchestrator
|
||||||
|
topologyPassword: # this is empty and will be random generated if not specified
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
# For example
|
||||||
|
# limits:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
# requests:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 80
|
||||||
|
# nodePort: 3000
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
className: ""
|
||||||
|
annotations: {}
|
||||||
|
# kubernetes.io/ingress.class: nginx
|
||||||
|
# kubernetes.io/tls-acme: "true"
|
||||||
|
hosts:
|
||||||
|
- host: chart-example.local
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: ImplementationSpecific
|
||||||
|
tls: []
|
||||||
|
# - secretName: chart-example-tls
|
||||||
|
# hosts:
|
||||||
|
# - chart-example.local
|
||||||
|
|
||||||
|
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
## If defined, storageClassName: <storageClass>
|
||||||
|
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||||
|
## If undefined (the default) or set to null, no storageClassName spec is
|
||||||
|
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||||
|
## GKE, AWS & OpenStack)
|
||||||
|
##
|
||||||
|
storageClass: "longhorn"
|
||||||
|
# annotations: {}
|
||||||
|
# selector:
|
||||||
|
# matchLabels: {}
|
||||||
|
accessMode: "ReadWriteOnce"
|
||||||
|
size: 5Gi
|
||||||
|
# inject an init container which properly sets the ownership for the orchestrator's data volume
|
||||||
|
# this is needed when the PV provisioner does not properly sets permissions for fsGroup
|
||||||
|
# when enabling this, you MUST change the securityContext.runAsNonRoot to false
|
||||||
|
fsGroupWorkaroundEnabled: false
|
||||||
|
|
||||||
|
# key value map of orchestrator conf directives.
|
||||||
|
# see: https://github.com/github/orchestrator/blob/master/conf/orchestrator-sample.conf.json
|
||||||
|
# the following keys are manages and thus cannot be overwritten:
|
||||||
|
# - ListenAddress :3000
|
||||||
|
# - MySQLTopologyCredentialsConfigFile /orchestrator/conf/orc-topology.cnf
|
||||||
|
# - BackendDB sqlite
|
||||||
|
# - SQLite3DataFile /var/lib/orchestrator/orc.db
|
||||||
|
# - RaftEnabled true
|
||||||
|
# - RaftDataDir /var/lib/orchestrator
|
||||||
|
# - RaftBind $HOSTNAME
|
||||||
|
# - RaftNodes The statefullset members
|
||||||
|
config:
|
||||||
|
Debug: false
|
||||||
|
# the operator is handling the registries, do not auto discover
|
||||||
|
DiscoverByShowSlaveHosts: false
|
||||||
|
# forget missing instances automatically
|
||||||
|
UnseenInstanceForgetHours: 1
|
||||||
|
|
||||||
|
InstancePollSeconds: 5
|
||||||
|
HostnameResolveMethod: "none"
|
||||||
|
MySQLHostnameResolveMethod: "@@report_host"
|
||||||
|
RemoveTextFromHostnameDisplay: ":3306"
|
||||||
|
DetectClusterAliasQuery: "SELECT CONCAT(SUBSTRING(@@hostname, 1, LENGTH(@@hostname) - 1 - LENGTH(SUBSTRING_INDEX(@@hostname,'-',-2))),'.',SUBSTRING_INDEX(@@report_host,'.',-1))"
|
||||||
|
DetectInstanceAliasQuery: "SELECT @@hostname"
|
||||||
|
SlaveLagQuery: "SELECT TIMESTAMPDIFF(SECOND,ts,UTC_TIMESTAMP()) as drift FROM sys_operator.heartbeat ORDER BY drift ASC LIMIT 1"
|
||||||
|
|
||||||
|
# Automated recovery (this is opt-in, so we need to set these)
|
||||||
|
# Prevent recovery flip-flop, by disabling auto-recovery for 5 minutes per
|
||||||
|
# cluster
|
||||||
|
RecoveryPeriodBlockSeconds: 300
|
||||||
|
# Do not ignore any host for auto-recovery
|
||||||
|
RecoveryIgnoreHostnameFilters: []
|
||||||
|
# Recover both, masters and intermediate masters
|
||||||
|
RecoverMasterClusterFilters: ['.*']
|
||||||
|
RecoverIntermediateMasterClusterFilters: ['.*']
|
||||||
|
# `reset slave all` and `set read_only=0` on promoted master
|
||||||
|
ApplyMySQLPromotionAfterMasterFailover: true
|
||||||
|
# https://github.com/github/orchestrator/blob/master/docs/configuration-recovery.md#promotion-actions
|
||||||
|
# Safety! do not disable unless you know what you are doing
|
||||||
|
FailMasterPromotionIfSQLThreadNotUpToDate: true
|
||||||
|
DetachLostReplicasAfterMasterFailover: true
|
||||||
|
# set downtime on the failed master
|
||||||
|
MasterFailoverLostInstancesDowntimeMinutes: 10
|
||||||
|
|
||||||
|
# orchestrator hooks called in the following order
|
||||||
|
# for more information about template: https://github.com/github/orchestrator/blob/master/go/logic/topology_recovery.go#L256
|
||||||
|
ProcessesShellCommand: "sh"
|
||||||
|
|
||||||
|
OnFailureDetectionProcesses:
|
||||||
|
- "/usr/local/bin/orc-helper event -w '{failureClusterAlias}' 'OrcFailureDetection' 'Failure: {failureType}, failed host: {failedHost}, lost replcas: {lostReplicas}' || true"
|
||||||
|
- "/usr/local/bin/orc-helper failover-in-progress '{failureClusterAlias}' '{failureDescription}' || true"
|
||||||
|
|
||||||
|
PreGracefulTakeoverProcesses:
|
||||||
|
- "/usr/local/bin/orc-helper failover-in-progress '{failureClusterAlias}' '{failureDescription}' || true"
|
||||||
|
|
||||||
|
PreFailoverProcesses:
|
||||||
|
# as backup in case the first request fails
|
||||||
|
- "/usr/local/bin/orc-helper failover-in-progress '{failureClusterAlias}' '{failureDescription}' || true"
|
||||||
|
# PostFailoverProcesses:
|
||||||
|
# - "/usr/local/bin/orchestrator-helper event '{failureClusterAlias}' 'Orc{command}' 'Failure type: {failureType}, failed hosts: {failedHost}, slaves: {countSlaves}' || true"
|
||||||
|
|
||||||
|
PostUnsuccessfulFailoverProcesses:
|
||||||
|
- "/usr/local/bin/orc-helper event -w '{failureClusterAlias}' 'OrcPostUnsuccessfulFailover' 'Failure: {failureType}, failed host: {failedHost} with {countSlaves} slaves' || true"
|
||||||
|
|
||||||
|
PostMasterFailoverProcesses:
|
||||||
|
- "/usr/local/bin/orc-helper event '{failureClusterAlias}' 'OrcPostMasterFailover' 'Failure type: {failureType}, new master: {successorHost}, slaves: {slaveHosts}' || true"
|
||||||
|
|
||||||
|
PostIntermediateMasterFailoverProcesses:
|
||||||
|
- "/usr/local/bin/orc-helper event '{failureClusterAlias}' 'OrcPostIntermediateMasterFailover' 'Failure type: {failureType}, failed hosts: {failedHost}, slaves: {countSlaves}' || true"
|
||||||
|
|
||||||
|
# PostGracefulTakeoverProcesses:
|
||||||
Reference in New Issue
Block a user