![SPEARS, DUSTIN (ds443n)](/assets/img/avatar_default.png)
Move liveness/readiness params to values.yaml for compute-utility and mysqlclient-utility charts Change-Id: I2140bc5a0cef1c28e3d4bbc79f2b06de8ca22a12
212 lines
8.0 KiB
YAML
212 lines
8.0 KiB
YAML
{{/*
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/}}
|
|
|
|
{{- define "readinessProbeTemplate" }}
|
|
exec:
|
|
command:
|
|
- cat
|
|
- /tmp/done
|
|
{{- end }}
|
|
|
|
{{- define "livenessProbeTemplate" }}
|
|
exec:
|
|
command:
|
|
- utilscli
|
|
{{- end }}
|
|
|
|
{{- if .Values.manifests.deployment_utility }}
|
|
{{- $envAll := . }}
|
|
|
|
{{- $serviceAccountName := printf "%s" $envAll.Release.Name }}
|
|
{{ tuple $envAll "utility" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: {{ $serviceAccountName }}
|
|
rules:
|
|
- apiGroups:
|
|
- ""
|
|
resources:
|
|
- pods
|
|
- pods/exec
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- exec
|
|
- create
|
|
- apiGroups:
|
|
- ""
|
|
resources:
|
|
- secrets
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- apiGroups:
|
|
- "batch"
|
|
resources:
|
|
- cronjobs
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- apiGroups:
|
|
- "batch"
|
|
resources:
|
|
- jobs
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- create
|
|
- update
|
|
- delete
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: {{ $serviceAccountName }}
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: {{ $serviceAccountName }}
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: {{ $serviceAccountName }}
|
|
namespace: {{ $envAll.Release.Namespace }}
|
|
---
|
|
kind: Deployment
|
|
apiVersion: apps/v1
|
|
metadata:
|
|
name: {{ printf "%s" $envAll.Release.Name }}
|
|
labels:
|
|
{{ tuple $envAll "mysqlclient" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
|
spec:
|
|
replicas: {{ .Values.pod.replicas.utility }}
|
|
selector:
|
|
matchLabels:
|
|
{{ tuple $envAll "mysqlclient" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
|
|
template:
|
|
metadata:
|
|
name: {{ printf "%s" $envAll.Release.Name }}
|
|
annotations:
|
|
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
|
configmap-etc-hash: {{ tuple "configmap-etc-client.yaml" . | include "helm-toolkit.utils.hash" }}
|
|
{{ tuple . | include "helm-toolkit.snippets.release_uuid" }}
|
|
{{ dict "envAll" $envAll "podName" "mysqlclient-utility" "containerNames" (list "mysqlclient-utility") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
|
|
labels:
|
|
{{ tuple $envAll "mysqlclient" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
|
spec:
|
|
{{ dict "envAll" $envAll "application" "mysqlclient" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
|
|
serviceAccountName: {{ $serviceAccountName }}
|
|
affinity:
|
|
{{ tuple $envAll "mysqlclient" "utility" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
|
|
nodeSelector:
|
|
{{ .Values.labels.utility.node_selector_key }}: {{ .Values.labels.utility.node_selector_value }}
|
|
containers:
|
|
- name: mysqlclient-utility
|
|
{{ tuple $envAll "mysqlclient_utility" | include "helm-toolkit.snippets.image" | indent 10 }}
|
|
{{ tuple $envAll $envAll.Values.pod.resources.mysql_utility | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
|
{{ dict "envAll" $envAll "application" "mysqlclient" "container" "mysqlclient_utility" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
|
|
{{ dict "envAll" $envAll "component" "utility" "container" "mysqlclient-utility" "type" "readiness" "probeTemplate" (include "readinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
|
|
{{ dict "envAll" $envAll "component" "utility" "container" "mysqlclient-utility" "type" "liveness" "probeTemplate" (include "livenessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
|
|
command:
|
|
- /tmp/bootstrap.sh
|
|
env:
|
|
- name: BACKUP_RESTORE_NAMESPACE_LIST
|
|
value: {{ .Values.conf.mariadb_backup_restore.enabled_namespaces | quote }}
|
|
{{- if .Values.manifests.create_test_database }}
|
|
- name: TEST_DB_NAME
|
|
value: {{ .Values.conf.mariadb_backup_restore.test_database_name | quote }}
|
|
{{- if .Values.conf.mariadb_backup_restore.test_database_user }}
|
|
- name: TEST_DB_USER
|
|
value: {{ .Values.conf.mariadb_backup_restore.test_database_user | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
- name: BACKUP_RESTORE_SCOPE
|
|
value: "mariadb"
|
|
volumeMounts:
|
|
- name: mysqlclient-utility-bin-utilscli
|
|
mountPath: /tmp/bootstrap.sh
|
|
subPath: bootstrap.sh
|
|
readOnly: true
|
|
- name: mysqlclient-utility-bin
|
|
mountPath: /tmp/start.sh
|
|
subPath: start.sh
|
|
readOnly: true
|
|
- name: mysqlclient-utility-bin-utilscli
|
|
mountPath: /usr/local/bin/utilscli
|
|
subPath: utilscli
|
|
readOnly: true
|
|
- name: mysqlclient-utility-bin
|
|
mountPath: /usr/local/bin/mysqlclient-utility-rootwrap
|
|
subPath: mysqlclient-utility-rootwrap
|
|
readOnly: true
|
|
- name: mysqlclient-utility-bin-utilscli
|
|
mountPath: /usr/local/bin/dbutils
|
|
subPath: dbutils
|
|
readOnly: true
|
|
- name: mysqlclient-utility-bin-utilscli
|
|
mountPath: /tmp/mysqlutils.sh
|
|
subPath: mysqlutils.sh
|
|
readOnly: true
|
|
- name: mysqlclient-utility-bin-utilscli
|
|
mountPath: /tmp/mariadb-ondemand-job.sh
|
|
subPath: mariadb-ondemand-job.sh
|
|
readOnly: true
|
|
{{- if .Values.manifests.create_test_database }}
|
|
- name: mysqlclient-utility-bin-utilscli
|
|
mountPath: /tmp/create_test_database.sh
|
|
subPath: create_test_database.sh
|
|
readOnly: true
|
|
{{- end }}
|
|
- name: mysqlclient-utility-sudoers
|
|
mountPath: /etc/sudoers.d/utilscli-sudo
|
|
subPath: utilscli-sudo
|
|
readOnly: true
|
|
- name: mysqlclient-utility-etc
|
|
mountPath: /etc/mysqlclient-utility/rootwrap.d/mysqlclient-rootwrap-filter
|
|
subPath: mysqlclient-rootwrap-filter
|
|
readOnly: true
|
|
- name: mysqlclient-utility-etc
|
|
mountPath: /etc/mysqlclient-utility/rootwrap.conf
|
|
subPath: rootwrap.conf
|
|
readOnly: true
|
|
{{- if .Values.pod.mounts.mysqlclient.container.mysqlclient_utility.volumeMounts }}
|
|
{{ .Values.pod.mounts.mysqlclient.container.mysqlclient_utility.volumeMounts | toYaml | indent 12 }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: mysqlclient-utility-sudoers
|
|
configMap:
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "sudoers" }}
|
|
defaultMode: 0644
|
|
- name: mysqlclient-utility-bin
|
|
configMap:
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "bin" }}
|
|
defaultMode: 0555
|
|
- name: mysqlclient-utility-etc
|
|
configMap:
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "etc" }}
|
|
defaultMode: 0555
|
|
- name: mysqlclient-utility-bin-utilscli
|
|
configMap:
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "bin-utilscli" }}
|
|
defaultMode: 0755
|
|
{{- if .Values.pod.mounts.mysqlclient.container.mysqlclient_utility.volumes }}
|
|
{{ .Values.pod.mounts.mysqlclient.container.mysqlclient_utility.volumes | toYaml | indent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|