rancher-partner-charts/charts/percona/pxc-db/templates/cluster.yaml

515 lines
17 KiB
YAML

apiVersion: pxc.percona.com/v1
kind: PerconaXtraDBCluster
metadata:
name: {{ include "pxc-database.fullname" . }}
labels:
{{ include "pxc-database.labels" . | indent 4 }}
finalizers:
{{ .Values.finalizers | toYaml | indent 4 }}
spec:
crVersion: {{ .Chart.AppVersion }}
{{- if .Values.ignoreAnnotations }}
ignoreAnnotations:
{{ .Values.ignoreAnnotations | toYaml | indent 4 }}
{{- end }}
{{- if .Values.ignoreLabels }}
ignoreLabels:
{{ .Values.ignoreLabels | toYaml | indent 4 }}
{{- end }}
{{- if hasKey .Values.pxc "clusterSecretName" }}
secretsName: {{ .Values.pxc.clusterSecretName }}
{{- else }}
secretsName: {{ include "pxc-database.fullname" . }}-secrets
{{- 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.secrets "vault" }}
vaultSecretName: {{ .Values.secrets.vault }}
{{- else }}
vaultSecretName: {{ include "pxc-database.fullname" . }}-vault
{{- end }}
{{- if hasKey .Values.secrets "logCollector" }}
logCollectorSecretName: {{ .Values.secrets.logCollector }}
{{- else }}
logCollectorSecretName: {{ include "pxc-database.fullname" . }}-log-collector
{{- end }}
{{- if .Values.initImage }}
initImage: {{ .Values.initImage }}
{{- else }}
initImage: {{ include "pxc-db.operator-image" . }}
{{- end }}
{{- 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 }}
{{- $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 }}
sidecarVolumes:
{{ $pxc.sidecarVolumes | toYaml | indent 6 }}
sidecarPVCs:
{{ $pxc.sidecarPVCs | 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" . }}
{{- 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.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ $haproxy.loadBalancerSourceRanges | toYaml | indent 6 }}
{{- end }}
{{- if $haproxy.loadBalancerIP }}
loadBalancerIP: {{ $haproxy.loadBalancerIP }}
{{- end }}
{{- if $haproxy.serviceType }}
serviceType: {{ $haproxy.serviceType }}
{{- end }}
replicasServiceEnabled: {{ $haproxy.replicasServiceEnabled }}
{{- if $haproxy.replicasLoadBalancerSourceRanges }}
replicasLoadBalancerSourceRanges:
{{ $haproxy.replicasLoadBalancerSourceRanges | toYaml | indent 6 }}
{{- end }}
{{- if $haproxy.replicasLoadBalancerIP }}
replicasLoadBalancerIP: {{ $haproxy.replicasLoadBalancerIP }}
{{- end }}
{{- if $haproxy.replicasServiceType }}
replicasServiceType: {{ $haproxy.replicasServiceType }}
{{- end }}
{{- if $haproxy.replicasExternalTrafficPolicy }}
replicasExternalTrafficPolicy: {{ $haproxy.replicasExternalTrafficPolicy }}
{{- end }}
{{- if $haproxy.replicasServiceAnnotations }}
replicasServiceAnnotations:
{{ $haproxy.replicasServiceAnnotations | toYaml | indent 6 }}
{{- end }}
{{- if $haproxy.replicasServiceLabels }}
replicasServiceLabels:
{{ $haproxy.replicasServiceLabels | toYaml | indent 6 }}
{{- end }}
{{- if $haproxy.serviceLabels }}
serviceLabels:
{{ $haproxy.serviceLabels | toYaml | indent 6 }}
{{- end }}
{{- if $haproxy.serviceAnnotations }}
serviceAnnotations:
{{ $haproxy.serviceAnnotations | toYaml | indent 6 }}
{{- end }}
{{- if $haproxy.serviceLabels }}
serviceLabels:
{{ $haproxy.serviceLabels | 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 }}
sidecarVolumes:
{{ $haproxy.sidecarVolumes | toYaml | indent 6 }}
sidecarPVCs:
{{ $haproxy.sidecarPVCs | 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.loadBalancerIP }}
loadBalancerIP: {{ $proxysql.loadBalancerIP }}
{{- end }}
{{- if $proxysql.serviceType }}
serviceType: {{ $proxysql.serviceType }}
{{- end }}
{{- if $proxysql.serviceAnnotations }}
serviceAnnotations:
{{ $proxysql.serviceAnnotations | toYaml | indent 6 }}
{{- end }}
{{- if $proxysql.serviceLabels }}
serviceLabels:
{{ $proxysql.serviceLabels | 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 }}
sidecarVolumes:
{{ $proxysql.sidecarVolumes | toYaml | indent 6 }}
sidecarPVCs:
{{ $proxysql.sidecarPVCs | 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:
{{- if $backup.allowParallel }}
allowParallel: {{ $backup.allowParallel }}
{{- end }}
image: {{ $backup.image.repository }}:{{ $backup.image.tag }}
{{- if $backup.backoffLimit }}
backoffLimit: {{ $backup.backoffLimit }}
{{- end }}
{{- 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 }}