-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a cluster chart and documentation of how to use it
- Loading branch information
Showing
9 changed files
with
266 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{{/* 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://{{- urlquery .Values.appUser -}}:{{- urlquery .Values.appPassword -}}@ | ||
{{- include "mysql-cluster.clusterName" . -}}-mysql-master:3306/{{- .Values.appDatabase -}} | ||
{{- 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 -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{- 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 }} | ||
type: Opaque | ||
data: | ||
{{- range $key, $value := .Values.backupCredentials }} | ||
{{ $key | upper }}: {{ $value | b64enc | quote }} | ||
{{ end }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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 }} | ||
secretName: {{ include "mysql-cluster.secretName" . }} | ||
|
||
{{- if .Values.backupSecretName }} | ||
backupSecretName: {{ .Values.backupSecretName }} | ||
{{- else if .Values.backupCredentials }} | ||
backupSecretName: {{ include "mysql-cluster.backupSecretName" . }} | ||
{{- else if .Values.backupSchedule }} | ||
{{ required "One of .mysql.backupBucketSecretName and .mysql.backupCredentails should be specified" "" }} | ||
{{- end }} | ||
|
||
{{- if .Values.backupSchedule }} | ||
backupSchedule: {{ .Values.backupSchedule }} | ||
backupURL: {{ required ".mysql.backupURL is missing" .Values.backupURL }} | ||
{{- end }} | ||
|
||
{{- if .Values.mysqlConfig }} | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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 }} | ||
type: Opaque | ||
data: | ||
ROOT_PASSWORD: {{ required ".rootPassword is missing" .Values.rootPassword | b64enc | quote }} | ||
USER: {{ required ".appUser is missing" .Values.appUser | b64enc | quote }} | ||
PASSWORD: {{ required ".appPassword is missing" .Values.appPassword | b64enc | quote }} | ||
DATABASE: {{ required ".appDatabase is missing" .Values.appDatabase | b64enc | quote }} | ||
DB_CONNECT_URL: {{ include "mysql-cluster.dbConnectURL" . | b64enc | quote }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 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 | ||
|
||
## MySQL connect credentials, thoses credentials will be provisioned in the cluster | ||
# rootPassword: | ||
# appUser: | ||
# appPassword: | ||
# appDatabase: | ||
|
||
podSpec: | ||
mysqlConf: | ||
volumeSpec: | ||
|
||
backupSchedule: | ||
backupURL: | ||
backupSecretName: | ||
backupCredentials: | ||
# AWS_ACCESS_KEY_ID: ? | ||
# AWS_SECRET_KEY: ? | ||
# AWS_REGION: us-east-1 | ||
# AWS_ACL: ? | ||
|
||
# GCS_SERVICE_ACCOUNT_JSON_KEY: ? | ||
# GCS_PROJECT_ID: ? | ||
# GCS_OBJECT_ACL: ? | ||
# GCS_BUCKET_ACL: ? | ||
# GCS_LOCATION: ? | ||
# GCS_STORAGE_CLASS: MULTI_REGIONAL | ||
|
||
# HTTP_URL: ? | ||
|