apiVersion: pxc.percona.com/v{{ .Chart.AppVersion | replace "." "-" }}
kind: PerconaXtraDBCluster
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"pxc.percona.com/v{{ .Chart.AppVersion | replace "." "-" }}","kind":"PerconaXtraDBCluster"}
name: {{ include "pxc-database.fullname" . }}
labels:
{{ include "pxc-database.labels" . | indent 4 }}
finalizers:
{{ .Values.finalizers | toYaml | indent 4 }}
spec:
crVersion: {{ .Chart.AppVersion }}
{{- if hasKey .Values.pxc "clusterSecretName" }}
secretsName: {{ .Values.pxc.clusterSecretName }}
{{- else }}
secretsName: {{ include "pxc-database.fullname" . }}
{{- end }}
{{- if not .Values.pxc.disableTLS }}
{{- if hasKey .Values.secrets.tls "cluster" }}
sslSecretName: {{ .Values.secrets.tls.cluster }}
{{- else }}
sslSecretName: {{ include "pxc-database.fullname" . }}-ssl
{{- end }}
{{- if hasKey .Values.secrets.tls "internal" }}
sslInternalSecretName: {{ .Values.secrets.tls.internal }}
{{- else }}
sslInternalSecretName: {{ include "pxc-database.fullname" . }}-ssl-internal
{{- end }}
{{- end }}
{{- if hasKey .Values.pxc "vaultSecretName" }}
vaultSecretName: {{ .Values.pxc.vaultSecretName }}
{{- else }}
vaultSecretName: {{ include "pxc-database.fullname" . }}-vault
{{- end }}
{{- if hasKey .Values.pxc "logCollectorSecretName" }}
logCollectorSecretName: {{ .Values.pxc.logCollectorSecretName }}
{{- else }}
logCollectorSecretName: {{ include "pxc-database.fullname" . }}-log-collector
{{- end }}
initImage: {{ .Values.initImage }}
{{- if or .Values.allowUnsafeConfigurations .Values.pxc.disableTLS }}
allowUnsafeConfigurations: true
{{- end }}
enableCRValidationWebhook: {{ .Values.enableCRValidationWebhook }}
pause: {{ .Values.pause }}
updateStrategy: {{ .Values.updateStrategy }}
{{- if hasKey .Values.upgradeOptions "versionServiceEndpoint" }}
upgradeOptions:
versionServiceEndpoint: {{ .Values.upgradeOptions.versionServiceEndpoint }}
apply: {{ .Values.upgradeOptions.apply }}
schedule: {{ .Values.upgradeOptions.schedule }}
{{- end }}
{{- if .Values.tls }}
tls:
{{- if hasKey .Values.tls "SANs" }}
SANs:
{{ .Values.tls.SANs | toYaml | indent 6 }}
{{- end }}
{{- if hasKey .Values.tls "issuerConf" }}
issuerConf:
name: {{ .Values.tls.issuerConf.name }}
kind: {{ .Values.tls.issuerConf.kind }}
group: {{ .Values.tls.issuerConf.group }}
{{- end }}
{{- end }}
cluster.yaml - 02
cluster.yaml - 02 START
### pxc values 값 정의
### .Values.haproxy 의 enabled 값이 아니고, Values.proxysql 의 값이 enabled 일때 haproxy 값 기본값 "enabled" key 값이 false 값으로 정의 - haproxy 구성안됨
### .Values.haproxy 값이 $haproxy 변수값으로 할당
### .Values.haproxy 의 enabled 값이 아니고, Values.proxysql 의 값이 enabled 이 아닐경우, haproxy 의 "enabled" key 값의 "values" 값이 true - haproxy 구성됨
### include "pxc-db.haproxy-image" 값으로 haproxy 의 container image 값 정의
### Values.proxysql.enabled 값이 아닐경우 proxysql 의 "enabled" key 값의 valuse 값이 "false" 값으로 세팅 - proxysql 구성 안됨
### Values.proxysql.enabled 값일 경우 proxysql 의 "enabled" key 값의 valuse 값이 "true" 값으로 세팅 - proxysql 구성됨
### include "pxc-db.proxysql-image" 값으로 proxysql의 container image 값 정의
### Values.logcollector 의 enabled 값이 아닐경우 Values.logcollector 의 값이 enabled 일때 logcollector 값 기본값 "enabled" key 값이 false 값으로 정의 - logcollector 구성안됨
### Values.logcollector.enabled 값일 경우 logcollector 의 "enabled" key 값의 valuse 값이 "true" 값으로 세팅 - logcollector 구성됨
### Values.pmm 의 enabled 값이 아닐경우 Values.pmm 의 값이 enabled 일때 pmm 값 기본값 "enabled" key 값이 false 값으로 정의 - pmm 구성안됨
### Values.pmm.enabled 값일 경우 pmm 의 "enabled" key 값의 valuse 값이 "true" 값으로 세팅 - pmm 구성됨
### .Values.backup 값이 $backup 변수값으로 할당
### $backup.enabled 값이 있을경우 backup 구성됨
### backup 의 이미지가 include "pxc-db.backup-image" 값으로 정의
### backup 의 stroage 값이 pxc-database.storages 값으로 정의
{{- $pxc := .Values.pxc }}
pxc:
size: {{ $pxc.size }}
image: "{{ $pxc.image.repository }}:{{ $pxc.image.tag }}"
autoRecovery: {{ $pxc.autoRecovery }}
{{- if $pxc.schedulerName }}
schedulerName: {{ $pxc.schedulerName }}
{{- end }}
readinessDelaySec: {{ $pxc.readinessDelaySec }}
livenessDelaySec: {{ $pxc.livenessDelaySec }}
{{- if $pxc.configuration }}
configuration: |
{{ tpl $pxc.configuration $ | nindent 6 }}
{{- end }}
{{- if $pxc.imagePullPolicy }}
imagePullPolicy: {{ $pxc.imagePullPolicy }}
{{- end }}
{{- if $pxc.imagePullSecrets }}
imagePullSecrets:
{{ $pxc.imagePullSecrets | toYaml | indent 6 }}
{{- end }}
{{- if $pxc.priorityClassName }}
priorityClassName: {{ $pxc.priorityClassName }}
{{- end }}
annotations:
{{ $pxc.annotations | toYaml | indent 6 }}
labels:
{{ $pxc.labels | toYaml | indent 6 }}
{{- if $pxc.expose }}
expose:
{{ tpl ($pxc.expose | toYaml) $ | indent 6 }}
{{- end }}
{{- if $pxc.replicationChannels }}
replicationChannels:
{{ tpl ($pxc.replicationChannels | toYaml) $ | indent 6 }}
{{- end }}
{{- if $pxc.runtimeClassName }}
runtimeClassName: {{ $pxc.runtimeClassName }}
{{- end }}
{{- if $pxc.envVarsSecret }}
envVarsSecret: {{ $pxc.envVarsSecret }}
{{- end }}
resources:
requests:
{{ tpl ($pxc.resources.requests | toYaml) $ | indent 8 }}
limits:
{{ tpl ($pxc.resources.limits | toYaml) $ | indent 8 }}
sidecars:
{{ $pxc.sidecars | toYaml | indent 6 }}
sidecarResources:
requests:
{{ tpl ($pxc.sidecarResources.requests | toYaml) $ | indent 8 }}
limits:
{{ tpl ($pxc.sidecarResources.limits | toYaml) $ | indent 8 }}
nodeSelector:
{{ $pxc.nodeSelector | toYaml | indent 6 }}
affinity:
{{ $pxc.affinity | toYaml | indent 6 }}
tolerations:
{{ $pxc.tolerations | toYaml | indent 6 }}
podDisruptionBudget:
{{ $pxc.podDisruptionBudget | toYaml | indent 6 }}
volumeSpec:
{{- if not $pxc.persistence.enabled }}
emptyDir: {}
{{- else }}
{{- if hasKey $pxc.persistence "hostPath" }}
hostPath:
path: {{ $pxc.persistence.hostPath }}
type: Directory
{{- else }}
persistentVolumeClaim:
{{- if $pxc.persistence.storageClass }}
{{- if (eq "-" $pxc.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ $pxc.persistence.storageClass }}"
{{- end }}
{{- end }}
accessModes: [{{ $pxc.persistence.accessMode | quote }}]
resources:
requests:
storage: {{ $pxc.persistence.size | quote }}
{{- end }}
{{- end }}
gracePeriod: {{ $pxc.gracePeriod }}
readinessProbes:
{{ tpl ($pxc.readinessProbes | toYaml) $ | indent 6 }}
livenessProbes:
{{ tpl ($pxc.livenessProbes | toYaml) $ | indent 6 }}
{{- if $pxc.containerSecurityContext }}
containerSecurityContext:
{{ tpl ($pxc.containerSecurityContext | toYaml) $ | indent 6 }}
{{- end }}
{{- if $pxc.podSecurityContext }}
podSecurityContext:
{{ tpl ($pxc.podSecurityContext | toYaml) $ | indent 6 }}
{{- end }}
{{- if $pxc.serviceAccountName }}
serviceAccountName: {{ $pxc.serviceAccountName }}
{{- end }}
{{- if or (not .Values.haproxy.enabled) .Values.proxysql.enabled }}
haproxy:
enabled: false
{{- else }}
{{- $haproxy := .Values.haproxy }}
haproxy:
enabled: true
size: {{ $haproxy.size }}
image: {{ include "pxc-db.haproxy-image" . }}
replicasServiceEnabled: {{ $haproxy.replicasServiceEnabled }}
{{- if $haproxy.imagePullPolicy }}
imagePullPolicy: {{ $haproxy.imagePullPolicy }}
{{- end }}
{{- if $haproxy.imagePullSecrets }}
imagePullSecrets:
{{ $haproxy.imagePullSecrets | toYaml | indent 6 }}
{{- end }}
{{- if $haproxy.schedulerName }}
schedulerName: {{ $haproxy.schedulerName }}
{{- end }}
{{- if $haproxy.configuration }}
configuration: |
{{ tpl $haproxy.configuration $ | nindent 6 }}
{{- end }}
{{- if $haproxy.priorityClassName }}
priorityClassName: {{ $haproxy.priorityClassName }}
{{- end }}
{{- if $haproxy.externalTrafficPolicy }}
externalTrafficPolicy: {{ $haproxy.externalTrafficPolicy }}
{{- end }}
{{- if $haproxy.replicasExternalTrafficPolicy }}
replicasExternalTrafficPolicy: {{ $haproxy.replicasExternalTrafficPolicy }}
{{- end }}
{{- if $haproxy.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ $haproxy.loadBalancerSourceRanges | toYaml | indent 6 }}
{{- end }}
{{- if $haproxy.serviceType }}
serviceType: {{ $haproxy.serviceType }}
{{- end }}
{{- if $haproxy.replicasServiceType }}
replicasServiceType: {{ $haproxy.replicasServiceType }}
{{- end }}
{{- if $haproxy.serviceAnnotations }}
serviceAnnotations:
{{ $haproxy.serviceAnnotations | toYaml | indent 6 }}
{{- end }}
annotations:
{{ $haproxy.annotations | toYaml | indent 6 }}
labels:
{{ $haproxy.labels | toYaml | indent 6 }}
{{- if $haproxy.runtimeClassName }}
runtimeClassName: {{ $haproxy.runtimeClassName }}
{{- end }}
{{- if $haproxy.envVarsSecret }}
envVarsSecret: {{ $haproxy.envVarsSecret }}
{{- end }}
resources:
requests:
{{ $haproxy.resources.requests | toYaml | indent 8 }}
limits:
{{ $haproxy.resources.limits | toYaml | indent 8 }}
sidecars:
{{ $haproxy.sidecars | toYaml | indent 6 }}
sidecarResources:
requests:
{{ tpl ($haproxy.sidecarResources.requests | toYaml) $ | indent 8 }}
limits:
{{ tpl ($haproxy.sidecarResources.limits | toYaml) $ | indent 8 }}
{{- if $haproxy.serviceAccountName }}
serviceAccountName: {{ $haproxy.serviceAccountName }}
{{- end }}
nodeSelector:
{{ $haproxy.nodeSelector | toYaml | indent 6 }}
affinity:
{{ $haproxy.affinity | toYaml | indent 6 }}
tolerations:
{{ $haproxy.tolerations | toYaml | indent 6 }}
podDisruptionBudget:
{{ $haproxy.podDisruptionBudget | toYaml | indent 6 }}
volumeSpec:
emptyDir: {}
gracePeriod: {{ $haproxy.gracePeriod }}
{{- if $haproxy.readinessDelaySec }}
readinessDelaySec: {{ $haproxy.readinessDelaySec }}
{{- end }}
{{- if $haproxy.livenessDelaySec }}
livenessDelaySec: {{ $pxc.livenessDelaySec }}
{{- end }}
readinessProbes:
{{ tpl ($haproxy.readinessProbes | toYaml) $ | indent 6 }}
livenessProbes:
{{ tpl ($haproxy.livenessProbes | toYaml) $ | indent 6 }}
{{- if $haproxy.containerSecurityContext }}
containerSecurityContext:
{{ tpl ($haproxy.containerSecurityContext | toYaml) $ | indent 6 }}
{{- end }}
{{- if $haproxy.podSecurityContext }}
podSecurityContext:
{{ tpl ($haproxy.podSecurityContext | toYaml) $ | indent 6 }}
{{- end }}
{{- end }}
{{- if not .Values.proxysql.enabled }}
proxysql:
enabled: false
{{- else }}
{{- $proxysql := .Values.proxysql }}
proxysql:
enabled: true
size: {{ $proxysql.size }}
image: {{ include "pxc-db.proxysql-image" . }}
{{- if $proxysql.imagePullPolicy }}
imagePullPolicy: {{ $proxysql.imagePullPolicy }}
{{- end }}
{{- if $proxysql.imagePullSecrets }}
imagePullSecrets:
{{- $proxysql.imagePullSecrets | toYaml | indent 6 }}
{{- end }}
{{- if $proxysql.schedulerName }}
schedulerName: {{ $proxysql.schedulerName }}
{{- end }}
{{- if $proxysql.configuration }}
configuration: |
{{ tpl $proxysql.configuration $ | nindent 6 }}
{{- end }}
{{- if $proxysql.priorityClassName }}
priorityClassName: {{ $proxysql.priorityClassName }}
{{- end }}
{{- if $proxysql.externalTrafficPolicy }}
externalTrafficPolicy: {{ $proxysql.externalTrafficPolicy }}
{{- end }}
{{- if $proxysql.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ $proxysql.loadBalancerSourceRanges | toYaml | indent 6 }}
{{- end }}
{{- if $proxysql.serviceType }}
serviceType: {{ $proxysql.serviceType }}
{{- end }}
{{- if $proxysql.serviceAnnotations }}
serviceAnnotations:
{{ $proxysql.serviceAnnotations | toYaml | indent 6 }}
{{- end }}
annotations:
{{ $proxysql.annotations | toYaml | indent 6 }}
labels:
{{ $proxysql.labels | toYaml | indent 6 }}
{{- if $proxysql.runtimeClassName }}
runtimeClassName: {{ $proxysql.runtimeClassName }}
{{- end }}
{{- if $proxysql.envVarsSecret }}
envVarsSecret: {{ $proxysql.envVarsSecret }}
{{- end }}
resources:
requests:
{{ $proxysql.resources.requests | toYaml | indent 8 }}
limits:
{{ $proxysql.resources.limits | toYaml | indent 8 }}
sidecars:
{{ $proxysql.sidecars | toYaml | indent 6 }}
sidecarResources:
requests:
{{ tpl ($proxysql.sidecarResources.requests | toYaml) $ | indent 8 }}
limits:
{{ tpl ($proxysql.sidecarResources.limits | toYaml) $ | indent 8 }}
{{- if $proxysql.serviceAccountName }}
serviceAccountName: {{ $proxysql.serviceAccountName }}
{{- end }}
nodeSelector:
{{ $proxysql.nodeSelector | toYaml | indent 6 }}
affinity:
{{ $proxysql.affinity | toYaml | indent 6 }}
tolerations:
{{ $proxysql.tolerations | toYaml | indent 6 }}
podDisruptionBudget:
{{ $proxysql.podDisruptionBudget | toYaml | indent 6 }}
volumeSpec:
{{- if not $proxysql.persistence.enabled }}
emptyDir: {}
{{- else }}
{{- if hasKey $proxysql.persistence "hostPath" }}
hostPath:
path: {{ $proxysql.persistence.hostPath }}
type: Directory
{{- else }}
persistentVolumeClaim:
{{- if $proxysql.persistence.storageClass }}
{{- if (eq "-" $proxysql.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ $proxysql.persistence.storageClass }}"
{{- end }}
{{- end }}
accessModes: [{{ $proxysql.persistence.accessMode | quote }}]
resources:
requests:
storage: {{ $proxysql.persistence.size | quote }}
{{- end }}
{{- end }}
gracePeriod: {{ $proxysql.gracePeriod }}
{{- if $proxysql.containerSecurityContext }}
containerSecurityContext:
{{ tpl ($proxysql.containerSecurityContext | toYaml) $ | indent 6 }}
{{- end }}
{{- if $proxysql.podSecurityContext }}
podSecurityContext:
{{ tpl ($proxysql.podSecurityContext | toYaml) $ | indent 6 }}
{{- end }}
{{- end }}
logcollector:
{{- if not .Values.logcollector.enabled }}
enabled: false
{{- else }}
{{- $logcollector := .Values.logcollector }}
enabled: true
image: {{ include "pxc-db.logcollector-image" . }}
{{- if $logcollector.imagePullPolicy }}
imagePullPolicy: {{ $logcollector.imagePullPolicy }}
{{- end }}
{{- if $logcollector.imagePullSecrets }}
imagePullSecrets:
{{- $logcollector.imagePullSecrets | toYaml | nindent 6 }}
{{- end }}
{{- if $logcollector.configuration }}
configuration: |
{{ tpl $logcollector.configuration $ | nindent 6 }}
{{- end }}
resources:
requests:
{{ tpl ($logcollector.resources.requests | toYaml) $ | indent 8 }}
limits:
{{ tpl ($logcollector.resources.limits | toYaml) $ | indent 8 }}
{{- end }}
pmm:
{{- if not .Values.pmm.enabled }}
enabled: false
{{- else }}
{{- $pmm := .Values.pmm }}
enabled: true
image: {{ $pmm.image.repository }}:{{ $pmm.image.tag }}
{{- if $pmm.imagePullPolicy }}
imagePullPolicy: {{ $pmm.imagePullPolicy }}
{{- end }}
{{- if $pmm.imagePullSecrets }}
imagePullSecrets:
{{- $pmm.imagePullSecrets | toYaml | nindent 6 }}
{{- end }}
serverHost: {{ $pmm.serverHost }}
serverUser: {{ $pmm.serverUser }}
resources:
requests:
{{ tpl ($pmm.resources.requests | toYaml) $ | indent 8 }}
limits:
{{ tpl ($pmm.resources.limits | toYaml) $ | indent 8 }}
{{- end }}
{{- $backup := .Values.backup }}
{{- if $backup.enabled }}
backup:
image: {{ include "pxc-db.backup-image" . }}
{{- if $backup.serviceAccountName }}
serviceAccountName: {{ $backup.serviceAccountName }}
{{- end }}
{{- if $backup.imagePullPolicy }}
imagePullPolicy: {{ $backup.imagePullPolicy }}
{{- end }}
{{- if $backup.imagePullSecrets }}
imagePullSecrets:
{{ $backup.imagePullSecrets | toYaml | indent 6 }}
{{- end }}
pitr:
{{- if not $backup.pitr.enabled }}
enabled: false
{{- else }}
enabled: true
storageName: {{ $backup.pitr.storageName }}
timeBetweenUploads: {{ $backup.pitr.timeBetweenUploads }}
resources:
requests:
{{ tpl ($backup.pitr.resources.requests | toYaml) $ | indent 10 }}
limits:
{{ tpl ($backup.pitr.resources.limits | toYaml) $ | indent 10 }}
{{- end }}
storages:
{{ include "pxc-database.storages" . | indent 6 }}
schedule:
{{ $backup.schedule | toYaml | indent 6 }}
{{- end }}
cluster.yaml - 02 END