mirror of
https://github.com/bitnami/charts.git
synced 2026-03-09 07:27:18 +08:00
* [bitnami/cloudnative-pg] test: ✅ Add imagePullSecrets to the cluster Signed-off-by: Javier J. Salmerón García <javier.salmeron@broadcom.com> * Update CHANGELOG.md Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com> --------- Signed-off-by: Javier J. Salmerón García <javier.salmeron@broadcom.com> Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com> Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
210 lines
11 KiB
YAML
210 lines
11 KiB
YAML
{{- /*
|
|
Copyright Broadcom, Inc. All Rights Reserved.
|
|
SPDX-License-Identifier: APACHE-2.0
|
|
*/}}
|
|
|
|
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ template "common.names.fullname" . }}
|
|
namespace: {{ include "common.names.namespace" . | quote }}
|
|
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
|
app.kubernetes.io/part-of: cloudnative-pg
|
|
app.kubernetes.io/component: operator
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- if not .Values.autoscaling.hpa.enabled }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
{{- end }}
|
|
{{- if .Values.updateStrategy }}
|
|
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
|
|
{{- end }}
|
|
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels) "context" . ) }}
|
|
selector:
|
|
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
|
|
app.kubernetes.io/part-of: cloudnative-pg
|
|
app.kubernetes.io/component: operator
|
|
template:
|
|
metadata:
|
|
{{- if or .Values.podAnnotations (include "cloudnative-pg.useConfigMap" .) (include "cloudnative-pg.useSecret" .) }}
|
|
annotations:
|
|
{{- if .Values.podAnnotations }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if (include "cloudnative-pg.useConfigMap" .) }}
|
|
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
{{- end }}
|
|
{{- if (include "cloudnative-pg.useSecret" .)}}
|
|
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
|
|
{{- end }}
|
|
{{- end }}
|
|
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
|
|
app.kubernetes.io/part-of: cloudnative-pg
|
|
app.kubernetes.io/component: operator
|
|
spec:
|
|
serviceAccountName: {{ template "cloudnative-pg.serviceAccountName" . }}
|
|
{{- include "cloudnative-pg.imagePullSecrets" . | nindent 6 }}
|
|
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
|
|
{{- if .Values.hostAliases }}
|
|
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.affinity }}
|
|
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }}
|
|
{{- else }}
|
|
affinity:
|
|
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" "operator" "customLabels" $podLabels "context" $) | nindent 10 }}
|
|
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" "operator" "customLabels" $podLabels "context" $) | nindent 10 }}
|
|
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if .Values.nodeSelector }}
|
|
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.tolerations }}
|
|
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.priorityClassName }}
|
|
priorityClassName: {{ .Values.priorityClassName | quote }}
|
|
{{- end }}
|
|
{{- if .Values.schedulerName }}
|
|
schedulerName: {{ .Values.schedulerName | quote }}
|
|
{{- end }}
|
|
{{- if .Values.topologySpreadConstraints }}
|
|
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.topologySpreadConstraints "context" .) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.podSecurityContext.enabled }}
|
|
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.podSecurityContext "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.terminationGracePeriodSeconds }}
|
|
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
|
{{- end }}
|
|
{{- if .Values.initContainers }}
|
|
initContainers:
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: cloudnative-pg
|
|
image: {{ template "cloudnative-pg.operator.image" . }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
{{- if .Values.containerSecurityContext.enabled }}
|
|
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.containerSecurityContext "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.command }}
|
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.args }}
|
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
|
|
{{- else }}
|
|
args:
|
|
- controller
|
|
- --leader-elect
|
|
- --max-concurrent-reconciles={{ .Values.maxConcurrentReconciles }}
|
|
{{- if (include "cloudnative-pg.useConfigMap" .) }}
|
|
- --config-map-name= {{ include "cloudnative-pg.configmapName" .}}
|
|
{{- end }}
|
|
{{- if (include "cloudnative-pg.useSecret" .) }}
|
|
- --secret-name= {{ include "cloudnative-pg.secretName" .}}
|
|
{{- end }}
|
|
- --webhook-port={{ .Values.containerPorts.webhook }}
|
|
- --metrics-bind-address=:{{ .Values.containerPorts.metrics }}
|
|
{{- if .Values.image.debug }}
|
|
- --log-level=debug
|
|
{{- end }}
|
|
{{- end }}
|
|
env:
|
|
- name: OPERATOR_IMAGE_NAME
|
|
value: {{ include "cloudnative-pg.operator.image" . | quote }}
|
|
- name: POSTGRES_IMAGE_NAME
|
|
value: {{ include "cloudnative-pg.postgresql.image" . }}
|
|
{{- if (include "cloudnative-pg.operator.imagePullSecret" .) }}
|
|
- name: PULL_SECRET_NAME
|
|
value: {{ include "cloudnative-pg.operator.imagePullSecret" . | quote }}
|
|
{{- end }}
|
|
{{- if not .Values.watchAllNamespaces }}
|
|
{{- $watchNamespaces := default (list (include "common.names.namespace" .)) .Values.watchNamespaces }}
|
|
- name: WATCH_NAMESPACE
|
|
value: {{ join "," $watchNamespaces | quote }}
|
|
{{- end }}
|
|
- name: OPERATOR_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
{{- if .Values.extraEnvVars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
envFrom:
|
|
{{- if .Values.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
|
|
{{- end }}
|
|
{{- if .Values.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
|
|
{{- end }}
|
|
{{- if .Values.resources }}
|
|
resources: {{- toYaml .Values.resources | nindent 12 }}
|
|
{{- else if ne .Values.resourcesPreset "none" }}
|
|
resources: {{- include "common.resources.preset" (dict "type" .Values.resourcesPreset) | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: http-metrics
|
|
containerPort: {{ .Values.containerPorts.metrics }}
|
|
- name: http-webhook
|
|
containerPort: {{ .Values.containerPorts.webhook }}
|
|
{{- if .Values.customLivenessProbe }}
|
|
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
|
|
{{- else if .Values.livenessProbe.enabled }}
|
|
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }}
|
|
tcpSocket:
|
|
{{- /* Not using http-webhook because it adds noise in the logs */}}
|
|
port: http-metrics
|
|
{{- end }}
|
|
{{- if .Values.customReadinessProbe }}
|
|
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
|
|
{{- else if .Values.readinessProbe.enabled }}
|
|
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }}
|
|
httpGet:
|
|
path: /readyz
|
|
port: http-webhook
|
|
scheme: HTTPS
|
|
{{- end }}
|
|
{{- if .Values.customStartupProbe }}
|
|
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
|
|
{{- else if .Values.startupProbe.enabled }}
|
|
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }}
|
|
httpGet:
|
|
path: /readyz
|
|
port: http-webhook
|
|
scheme: HTTPS
|
|
{{- end }}
|
|
{{- if .Values.lifecycleHooks }}
|
|
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
# Paths hardcoded in source code
|
|
# https://github.com/cloudnative-pg/cloudnative-pg/blob/main/internal/cmd/manager/controller/controller.go#L51
|
|
- name: empty-dir
|
|
mountPath: /controller
|
|
subPath: tmp-dir
|
|
- mountPath: /run/secrets/cnpg.io/webhook
|
|
name: webhook-certificates
|
|
{{- if .Values.extraVolumeMounts }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.sidecars }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: empty-dir
|
|
emptyDir: {}
|
|
# Hardcoded in source code
|
|
# https://github.com/cloudnative-pg/cloudnative-pg/blob/main/internal/cmd/manager/controller/controller.go#L51
|
|
- name: webhook-certificates
|
|
secret:
|
|
defaultMode: 420
|
|
optional: true
|
|
secretName: cnpg-webhook-cert
|
|
{{- if .Values.extraVolumes }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
|
|
{{- end }} |