564f9757fc
This large commit refactors mariadb and creates a utils and openstack chart to facilitate installing all openstack elemenets and supporting infrastructure.
206 lines
5.8 KiB
YAML
206 lines
5.8 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: infra-db
|
|
spec:
|
|
ports:
|
|
- name: db
|
|
port: {{ .Values.network.port.mariadb }}
|
|
selector:
|
|
app: mariadb
|
|
{{- $root := . -}}
|
|
{{ range $k, $v := until (atoi .Values.replicas) }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: infra-db-{{$v}}
|
|
labels:
|
|
release: {{ $root.Release.Name | quote }}
|
|
chart: "{{ $root.Chart.Name }}-{{ $root.Chart.Version }}"
|
|
spec:
|
|
ports:
|
|
- name: db
|
|
port: {{ $root.Values.network.port.mariadb }}
|
|
- name: wsrep
|
|
port: {{ $root.Values.network.port.wsrep }}
|
|
selector:
|
|
app: mariadb
|
|
server-id: "{{$v}}"
|
|
---
|
|
kind: PersistentVolumeClaim
|
|
apiVersion: v1
|
|
metadata:
|
|
name: mariadb-{{$v}}
|
|
annotations:
|
|
volume.beta.kubernetes.io/storage-class: "general"
|
|
spec:
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
resources:
|
|
requests:
|
|
storage: {{ $root.Values.volume.size }}
|
|
---
|
|
kind: Deployment
|
|
apiVersion: extensions/v1beta1
|
|
metadata:
|
|
labels:
|
|
app: mariadb
|
|
galera: enabled
|
|
server-id: "{{$v}}"
|
|
name: mariadb-{{$v}}
|
|
spec:
|
|
replicas: 1
|
|
template:
|
|
securityContext:
|
|
runAsUser: 0
|
|
metadata:
|
|
name: mariadb-{{$v}}
|
|
labels:
|
|
app: mariadb
|
|
galera: enabled
|
|
server-id: "{{$v}}"
|
|
annotations:
|
|
pod.beta.kubernetes.io/hostname: mariadb-{{$v}}
|
|
helm.sh/created: {{ $root.Release.Time.Seconds | quote }}
|
|
# alanmeadows: this soft requirement allows single
|
|
# host deployments to spawn several mariadb containers
|
|
# but in a larger environment, would attempt to spread
|
|
# them out
|
|
scheduler.alpha.kubernetes.io/affinity: >
|
|
{
|
|
"podAntiAffinity": {
|
|
"preferredDuringSchedulingIgnoredDuringExecution": [{
|
|
"labelSelector": {
|
|
"matchExpressions": [{
|
|
"key": "app",
|
|
"operator": "In",
|
|
"values":["mariadb"]
|
|
}]
|
|
},
|
|
"topologyKey": "kubernetes.io/hostname",
|
|
"weight": 10
|
|
}]
|
|
}
|
|
}
|
|
spec:
|
|
nodeSelector:
|
|
{{ $root.Values.labels.control_node_label }}: enabled
|
|
containers:
|
|
- name: mariadb-{{$v}}
|
|
image: {{ $root.Values.images.mariadb }}
|
|
imagePullPolicy: Always
|
|
env:
|
|
- name: INTERFACE_NAME
|
|
value: "eth0"
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: COMMAND
|
|
value: "bash /tmp/start.sh"
|
|
- name: DEPENDENCY_CONFIG
|
|
value: "/etc/my.cnf.d/wsrep.cnf"
|
|
ports:
|
|
- containerPort: {{ $root.Values.network.port.mariadb }}
|
|
- containerPort: {{ $root.Values.network.port.wsrep }}
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- python
|
|
- /mariadb-readiness.py
|
|
volumeMounts:
|
|
- name: mycnfd
|
|
mountPath: /etc/my.cnf.d
|
|
- name: startsh
|
|
mountPath: /tmp/start.sh
|
|
subPath: start.sh
|
|
- name: bootstrapdb
|
|
mountPath: /tmp/bootstrap-db.sh
|
|
subPath: bootstrap-db.sh
|
|
- name: peer-finder
|
|
mountPath: /tmp/peer-finder.py
|
|
subPath: peer-finder.py
|
|
- name: charsets
|
|
mountPath: /etc/my.cnf.d/charsets.cnf
|
|
subPath: charsets.cnf
|
|
- name: engine
|
|
mountPath: /etc/my.cnf.d/engine.cnf
|
|
subPath: engine.cnf
|
|
- name: log
|
|
mountPath: /etc/my.cnf.d/log.cnf
|
|
subPath: log.cnf
|
|
- name: mycnf
|
|
mountPath: /etc/my.cnf
|
|
subPath: my.cnf
|
|
- name: networking
|
|
mountPath: /etc/my.cnf.d/networking.cnf
|
|
subPath: networking.cnf
|
|
- name: pid
|
|
mountPath: /etc/my.cnf.d/pid.cnf
|
|
subPath: pid.cnf
|
|
- name: tuning
|
|
mountPath: /etc/my.cnf.d/tuning.cnf
|
|
subPath: tuning.cnf
|
|
- name: wsrep
|
|
mountPath: /configmaps/wsrep.cnf
|
|
- name: replicas
|
|
mountPath: /tmp/replicas.py
|
|
subPath: replicas.py
|
|
- name: readiness
|
|
mountPath: /mariadb-readiness.py
|
|
subPath: mariadb-readiness.py
|
|
- name: mysql-data
|
|
mountPath: /var/lib/mysql
|
|
volumes:
|
|
- name: mycnfd
|
|
emptyDir: {}
|
|
- name: startsh
|
|
configMap:
|
|
name: mariadb-startsh
|
|
- name: bootstrapdb
|
|
configMap:
|
|
name: bootstrap-db
|
|
- name: peer-finder
|
|
configMap:
|
|
name: mariadb-peer-finder
|
|
- name: charsets
|
|
configMap:
|
|
name: mariadb-charsets
|
|
- name: engine
|
|
configMap:
|
|
name: mariadb-engine
|
|
- name: log
|
|
configMap:
|
|
name: mariadb-log
|
|
- name: mycnf
|
|
configMap:
|
|
name: mariadb-mycnf
|
|
- name: networking
|
|
configMap:
|
|
name: mariadb-networking
|
|
- name: pid
|
|
configMap:
|
|
name: mariadb-pid
|
|
- name: tuning
|
|
configMap:
|
|
name: mariadb-tuning
|
|
- name: wsrep
|
|
configMap:
|
|
name: mariadb-wsrep
|
|
- name: replicas
|
|
configMap:
|
|
name: mariadb-replicas
|
|
- name: readiness
|
|
configMap:
|
|
name: mariadb-readiness
|
|
- name: mysql-data
|
|
persistentVolumeClaim:
|
|
matchLabels:
|
|
server-id: "{{$v}}"
|
|
claimName: mariadb-{{$v}}
|
|
{{ end }} |