unpack obscpio files
This commit is contained in:
64
metal3-chart/charts/mariadb/templates/_helpers.tpl
Normal file
64
metal3-chart/charts/mariadb/templates/_helpers.tpl
Normal file
@@ -0,0 +1,64 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "mariadb.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 "mariadb.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 "mariadb.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "mariadb.labels" -}}
|
||||
helm.sh/chart: {{ include "mariadb.chart" . }}
|
||||
{{ include "mariadb.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "mariadb.selectorLabels" -}}
|
||||
app.kubernetes.io/component: mariadb
|
||||
app.kubernetes.io/name: {{ include "mariadb.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "mariadb.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "mariadb.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
8
metal3-chart/charts/mariadb/templates/configmap.yaml
Normal file
8
metal3-chart/charts/mariadb/templates/configmap.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: mariadb-cm
|
||||
labels:
|
||||
{{- include "mariadb.labels" . | nindent 4 }}
|
||||
data:
|
||||
RESTART_CONTAINER_CERTIFICATE_UPDATED: "false"
|
85
metal3-chart/charts/mariadb/templates/deployment.yaml
Normal file
85
metal3-chart/charts/mariadb/templates/deployment.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "mariadb.fullname" . }}
|
||||
labels:
|
||||
{{- include "mariadb.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{.Values.replicaCount}}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "mariadb.selectorLabels" . | nindent 6 }}
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "mariadb.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- $volmounts := toYaml .Values.volumeMounts | trim | nindent 12 }}
|
||||
{{- $volumes := toYaml .Values.volumes | trim | nindent 8 }}
|
||||
serviceAccountName: {{ include "mariadb.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: mariadb
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
env:
|
||||
- name: MARIADB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: password
|
||||
name: ironic-mariadb
|
||||
- name: RESTART_CONTAINER_CERTIFICATE_UPDATED
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: mariadb-cm
|
||||
key: RESTART_CONTAINER_CERTIFICATE_UPDATED
|
||||
lifecycle:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- mysqladmin shutdown -uironic -p$(printenv MARIADB_PASSWORD)
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- mysqladmin status -uironic -p$(printenv MARIADB_PASSWORD)
|
||||
failureThreshold: 10
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 10
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
name: mariadb
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- mysqladmin status -uironic -p$(printenv MARIADB_PASSWORD)
|
||||
failureThreshold: 10
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 10
|
||||
volumeMounts:
|
||||
{{- $volmounts }}
|
||||
{{- with .Values.global.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- $volumes }}
|
24
metal3-chart/charts/mariadb/templates/pvc.yaml
Normal file
24
metal3-chart/charts/mariadb/templates/pvc.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: mariadb-volume-claim
|
||||
{{- if .Values.persistence.keep }}
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- if .Values.persistence.accessMode }}
|
||||
- {{ .Values.persistence.accessMode }}
|
||||
{{- else if eq (int .Values.replicaCount) 1 }}
|
||||
- ReadWriteOnce
|
||||
{{- else }}
|
||||
- ReadWriteMany
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
storageClassName: {{ .Values.persistence.storageClass }}
|
||||
{{- end }}
|
||||
volumeMode: Filesystem
|
21
metal3-chart/charts/mariadb/templates/secret.yaml
Normal file
21
metal3-chart/charts/mariadb/templates/secret.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
{{- $secret_name := "ironic-mariadb" -}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ $secret_name }}
|
||||
labels:
|
||||
{{- include "mariadb.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
# Check if the secret is deployed and has a password
|
||||
{{- $old_sec := lookup "v1" "Secret" .Release.Namespace $secret_name }}
|
||||
{{- if and $old_sec (index $old_sec.data "password") }}
|
||||
password: {{ index $old_sec.data "password" }}
|
||||
{{- else if .Values.password }}
|
||||
# If not, check if a password is provided in values.yaml
|
||||
password: {{ .Values.password | toString | b64enc }}
|
||||
{{- else }}
|
||||
# If no secret and no password in values.yaml, generate a new password
|
||||
password: {{ randAlphaNum 20 | b64enc }}
|
||||
{{- end }}
|
13
metal3-chart/charts/mariadb/templates/service-account.yaml
Normal file
13
metal3-chart/charts/mariadb/templates/service-account.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "mariadb.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "mariadb.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
14
metal3-chart/charts/mariadb/templates/service.yaml
Normal file
14
metal3-chart/charts/mariadb/templates/service.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.global.databaseServiceName }}
|
||||
labels:
|
||||
{{- include "mariadb.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
{{- include "mariadb.selectorLabels" . | nindent 4 }}
|
||||
ports:
|
||||
{{- with .Values.service.ports }}
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
Reference in New Issue
Block a user