This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix gcp mysql deployment file (#135)
- Loading branch information
1 parent
4dbd925
commit 85c5ffc
Showing
20 changed files
with
1,084 additions
and
3 deletions.
There are no files selected for viewing
Binary file removed
BIN
-9.31 KB
addons/gcp-service-broker-0.1.0/chart/gcp-service-broker/charts/mysql-0.15.0.tgz
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
addons/gcp-service-broker-0.1.0/chart/gcp-service-broker/charts/mysql/.helmignore
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,2 @@ | ||
.git | ||
OWNERS |
21 changes: 21 additions & 0 deletions
21
addons/gcp-service-broker-0.1.0/chart/gcp-service-broker/charts/mysql/Chart.yaml
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 @@ | ||
apiVersion: v1 | ||
name: mysql | ||
version: 1.6.2 | ||
appVersion: 5.7.28 | ||
description: Fast, reliable, scalable, and easy to use open-source relational database | ||
system. | ||
keywords: | ||
- mysql | ||
- database | ||
- sql | ||
home: https://www.mysql.com/ | ||
icon: https://www.mysql.com/common/logos/logo-mysql-170x115.png | ||
sources: | ||
- https://github.com/kubernetes/charts | ||
- https://github.com/docker-library/mysql | ||
maintainers: | ||
- name: olemarkus | ||
email: o.with@sportradar.com | ||
- name: viglesiasce | ||
email: viglesias@google.com | ||
engine: gotpl |
4 changes: 4 additions & 0 deletions
4
addons/gcp-service-broker-0.1.0/chart/gcp-service-broker/charts/mysql/OWNERS
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,4 @@ | ||
approvers: | ||
- olemarkus | ||
reviewers: | ||
- olemarkus |
241 changes: 241 additions & 0 deletions
241
addons/gcp-service-broker-0.1.0/chart/gcp-service-broker/charts/mysql/README.md
Large diffs are not rendered by default.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
addons/gcp-service-broker-0.1.0/chart/gcp-service-broker/charts/mysql/templates/NOTES.txt
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,43 @@ | ||
MySQL can be accessed via port 3306 on the following DNS name from within your cluster: | ||
{{ template "mysql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local | ||
|
||
{{- if .Values.existingSecret }} | ||
If you have not already created the mysql password secret: | ||
|
||
kubectl create secret generic {{ .Values.existingSecret }} --namespace {{ .Release.Namespace }} --from-file=./mysql-root-password --from-file=./mysql-password | ||
{{ else }} | ||
|
||
To get your root password run: | ||
|
||
MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mysql.fullname" . }} -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo) | ||
{{- end }} | ||
|
||
To connect to your database: | ||
|
||
1. Run an Ubuntu pod that you can use as a client: | ||
|
||
kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il | ||
|
||
2. Install the mysql client: | ||
|
||
$ apt-get update && apt-get install mysql-client -y | ||
|
||
3. Connect using the mysql cli, then provide your password: | ||
$ mysql -h {{ template "mysql.fullname" . }} -p | ||
|
||
To connect to your database directly from outside the K8s cluster: | ||
{{- if contains "NodePort" .Values.service.type }} | ||
MYSQL_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath='{.items[0].status.addresses[0].address}') | ||
MYSQL_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "mysql.fullname" . }} -o jsonpath='{.spec.ports[0].nodePort}') | ||
|
||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
MYSQL_HOST=127.0.0.1 | ||
MYSQL_PORT={{ .Values.service.port }} | ||
|
||
# Execute the following command to route the connection: | ||
kubectl port-forward svc/{{ template "mysql.fullname" . }} {{ .Values.service.port }} | ||
|
||
{{- end }} | ||
|
||
mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD} | ||
|
43 changes: 43 additions & 0 deletions
43
addons/gcp-service-broker-0.1.0/chart/gcp-service-broker/charts/mysql/templates/_helpers.tpl
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,43 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "mysql.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.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- printf .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Generate chart secret name | ||
*/}} | ||
{{- define "mysql.secretName" -}} | ||
{{ default (include "mysql.fullname" .) .Values.existingSecret }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "mysql.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{ default (include "mysql.fullname" .) .Values.serviceAccount.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.name }} | ||
{{- end -}} | ||
{{- end -}} |
12 changes: 12 additions & 0 deletions
12
...r-0.1.0/chart/gcp-service-broker/charts/mysql/templates/configurationFiles-configmap.yaml
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,12 @@ | ||
{{- if .Values.configurationFiles }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "mysql.fullname" . }}-configuration | ||
namespace: {{ .Release.Namespace }} | ||
data: | ||
{{- range $key, $val := .Values.configurationFiles }} | ||
{{ $key }}: |- | ||
{{ $val | indent 4}} | ||
{{- end }} | ||
{{- end -}} |
248 changes: 248 additions & 0 deletions
248
.../gcp-service-broker-0.1.0/chart/gcp-service-broker/charts/mysql/templates/deployment.yaml
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,248 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "mysql.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app: {{ template "mysql.fullname" . }} | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
release: "{{ .Release.Name }}" | ||
heritage: "{{ .Release.Service }}" | ||
{{- with .Values.deploymentAnnotations }} | ||
annotations: | ||
{{ toYaml . | indent 4 }} | ||
{{- end }} | ||
|
||
spec: | ||
strategy: | ||
{{ toYaml .Values.strategy | indent 4 }} | ||
selector: | ||
matchLabels: | ||
app: {{ template "mysql.fullname" . }} | ||
release: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ template "mysql.fullname" . }} | ||
release: {{ .Release.Name }} | ||
{{- with .Values.podLabels }} | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.schedulerName }} | ||
schedulerName: "{{ .Values.schedulerName }}" | ||
{{- end }} | ||
{{- if .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{ toYaml .Values.imagePullSecrets | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.priorityClassName }} | ||
priorityClassName: "{{ .Values.priorityClassName }}" | ||
{{- end }} | ||
{{- if .Values.securityContext.enabled }} | ||
securityContext: | ||
fsGroup: {{ .Values.securityContext.fsGroup }} | ||
runAsUser: {{ .Values.securityContext.runAsUser }} | ||
{{- end }} | ||
serviceAccountName: {{ template "mysql.serviceAccountName" . }} | ||
initContainers: | ||
- name: "remove-lost-found" | ||
image: "{{ .Values.busybox.image}}:{{ .Values.busybox.tag }}" | ||
imagePullPolicy: {{ .Values.imagePullPolicy | quote }} | ||
resources: | ||
{{ toYaml .Values.initContainer.resources | indent 10 }} | ||
command: ["rm", "-fr", "/var/lib/mysql/lost+found"] | ||
volumeMounts: | ||
- name: data | ||
mountPath: /var/lib/mysql | ||
{{- if .Values.persistence.subPath }} | ||
subPath: {{ .Values.persistence.subPath }} | ||
{{- end }} | ||
{{- if .Values.extraInitContainers }} | ||
{{ tpl .Values.extraInitContainers . | indent 6 }} | ||
{{- end }} | ||
{{- if .Values.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml .Values.nodeSelector | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.tolerations }} | ||
tolerations: | ||
{{ toYaml .Values.tolerations | indent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: {{ template "mysql.fullname" . }} | ||
image: "{{ .Values.image }}:{{ .Values.imageTag }}" | ||
imagePullPolicy: {{ .Values.imagePullPolicy | quote }} | ||
|
||
{{- with .Values.args }} | ||
args: | ||
{{- range . }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
{{- end }} | ||
resources: | ||
{{ toYaml .Values.resources | indent 10 }} | ||
env: | ||
{{- if .Values.mysqlAllowEmptyPassword }} | ||
- name: MYSQL_ALLOW_EMPTY_PASSWORD | ||
value: "true" | ||
{{- end }} | ||
{{- if not (and .Values.allowEmptyRootPassword (not .Values.mysqlRootPassword)) }} | ||
- name: MYSQL_ROOT_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ template "mysql.secretName" . }} | ||
key: mysql-root-password | ||
{{- if .Values.mysqlAllowEmptyPassword }} | ||
optional: true | ||
{{- end }} | ||
{{- end }} | ||
{{- if not (and .Values.allowEmptyRootPassword (not .Values.mysqPassword)) }} | ||
- name: MYSQL_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ template "mysql.secretName" . }} | ||
key: mysql-password | ||
{{- if or .Values.mysqlAllowEmptyPassword (empty .Values.mysqlUser) }} | ||
optional: true | ||
{{- end }} | ||
{{- end }} | ||
- name: MYSQL_USER | ||
value: {{ default "" .Values.mysqlUser | quote }} | ||
- name: MYSQL_DATABASE | ||
value: {{ default "" .Values.mysqlDatabase | quote }} | ||
{{- if .Values.timezone }} | ||
- name: TZ | ||
value: {{ .Values.timezone }} | ||
{{- end }} | ||
ports: | ||
- name: mysql | ||
containerPort: 3306 | ||
livenessProbe: | ||
exec: | ||
command: | ||
{{- if .Values.mysqlAllowEmptyPassword }} | ||
- mysqladmin | ||
- ping | ||
{{- else }} | ||
- sh | ||
- -c | ||
- "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}" | ||
{{- end }} | ||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} | ||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }} | ||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} | ||
successThreshold: {{ .Values.livenessProbe.successThreshold }} | ||
failureThreshold: {{ .Values.livenessProbe.failureThreshold }} | ||
readinessProbe: | ||
exec: | ||
command: | ||
{{- if .Values.mysqlAllowEmptyPassword }} | ||
- mysqladmin | ||
- ping | ||
{{- else }} | ||
- sh | ||
- -c | ||
- "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}" | ||
{{- end }} | ||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} | ||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }} | ||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} | ||
successThreshold: {{ .Values.readinessProbe.successThreshold }} | ||
failureThreshold: {{ .Values.readinessProbe.failureThreshold }} | ||
volumeMounts: | ||
- name: data | ||
mountPath: /var/lib/mysql | ||
{{- if .Values.persistence.subPath }} | ||
subPath: {{ .Values.persistence.subPath }} | ||
{{- end }} | ||
{{- if .Values.configurationFiles }} | ||
{{- range $key, $val := .Values.configurationFiles }} | ||
- name: configurations | ||
mountPath: {{ $.Values.configurationFilesPath }}{{ $key }} | ||
subPath: {{ $key }} | ||
{{- end -}} | ||
{{- end }} | ||
{{- if .Values.initializationFiles }} | ||
- name: migrations | ||
mountPath: /docker-entrypoint-initdb.d | ||
{{- end }} | ||
{{- if .Values.ssl.enabled }} | ||
- name: certificates | ||
mountPath: /ssl | ||
{{- end }} | ||
{{- if .Values.extraVolumeMounts }} | ||
{{ tpl .Values.extraVolumeMounts . | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.metrics.enabled }} | ||
- name: metrics | ||
image: "{{ .Values.metrics.image }}:{{ .Values.metrics.imageTag }}" | ||
imagePullPolicy: {{ .Values.metrics.imagePullPolicy | quote }} | ||
{{- if .Values.mysqlAllowEmptyPassword }} | ||
command: | ||
- 'sh' | ||
- '-c' | ||
- 'DATA_SOURCE_NAME="root@(localhost:3306)/" /bin/mysqld_exporter' | ||
{{- else }} | ||
env: | ||
- name: MYSQL_ROOT_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ template "mysql.secretName" . }} | ||
key: mysql-root-password | ||
command: | ||
- 'sh' | ||
- '-c' | ||
- 'DATA_SOURCE_NAME="root:$MYSQL_ROOT_PASSWORD@(localhost:3306)/" /bin/mysqld_exporter' | ||
{{- end }} | ||
{{- range $f := .Values.metrics.flags }} | ||
- {{ $f | quote }} | ||
{{- 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: | ||
{{- if .Values.configurationFiles }} | ||
- name: configurations | ||
configMap: | ||
name: {{ template "mysql.fullname" . }}-configuration | ||
{{- end }} | ||
{{- if .Values.initializationFiles }} | ||
- name: migrations | ||
configMap: | ||
name: {{ template "mysql.fullname" . }}-initialization | ||
{{- end }} | ||
{{- if .Values.ssl.enabled }} | ||
- name: certificates | ||
secret: | ||
secretName: {{ .Values.ssl.secret }} | ||
{{- end }} | ||
- name: data | ||
{{- if .Values.persistence.enabled }} | ||
persistentVolumeClaim: | ||
claimName: {{ .Values.persistence.existingClaim | default (include "mysql.fullname" .) }} | ||
{{- else }} | ||
emptyDir: {} | ||
{{- end -}} | ||
{{- if .Values.extraVolumes }} | ||
{{ tpl .Values.extraVolumes . | indent 6 }} | ||
{{- end }} |
12 changes: 12 additions & 0 deletions
12
...-0.1.0/chart/gcp-service-broker/charts/mysql/templates/initializationFiles-configmap.yaml
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,12 @@ | ||
{{- if .Values.initializationFiles }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "mysql.fullname" . }}-initialization | ||
namespace: {{ .Release.Namespace }} | ||
data: | ||
{{- range $key, $val := .Values.initializationFiles }} | ||
{{ $key }}: |- | ||
{{ $val | indent 4}} | ||
{{- end }} | ||
{{- end -}} |
Oops, something went wrong.