.. _Kserve setup guide: https://kserve.github.io/website/0.10/admin/kubernetes_deployment/
.. _K8ssandra setup guide: https://docs.k8ssandra.io/install/
.. _Mariadb-Operator setup guide: https://github.com/mariadb-operator/mariadb-operator
+.. _Postgres-Operator setup guide: https://github.com/CrunchyData/postgres-operator
.. _oom_base_optional_addons:
Mariadb-Operator Installation
-----------------------------
-Mariadb-Operator is used to ease the installation and lifecycle management
+Mariadb-Operator is used to ease the installation and lifecycle management of
MariaDB Galera and Replication clusters, including monitoring and backup
For setup the Mariadb-Operator is used, see `Mariadb-Operator setup guide`_
--set metrics.enabled=true --set webhook.certificate.certManager=true
--version=<recommended-version>
+Postgres-Operator Installation
+------------------------------
+
+Postgres-Operator is used to ease the installation and lifecycle management of
+Postgres DB clusters, including monitoring and backup
+
+For setup the Postgres-Operator is used, see `Postgres-Operator setup guide`_
Kserve Installation
-------------------
{{- define "common.postgres.secret.primaryPasswordSecretName" -}}
{{- include "common.postgres.secret._secretName" (set . "uidTemplate" "common.postgres.secret.primaryPasswordUID") }}
{{- end -}}
+
+{{/*
+ Create postgres cluster via postgres crunchydata-operator
+*/}}
+{{- define "common.postgresOpInstance" -}}
+{{- $dot := default . .dot -}}
+{{- $global := $dot.Values.global -}}
+{{- $dbinst := include "common.name" $dot -}}
+---
+apiVersion: postgres-operator.crunchydata.com/v1beta1
+kind: PostgresCluster
+metadata:
+ name: {{ $dbinst }}
+ labels:
+ app: {{ $dbinst }}
+ version: "5.5"
+spec:
+ metadata:
+ labels:
+ app: {{ $dbinst }}
+ version: "5.5"
+ {{- if .Values.postgresOperator.imagePostgres }}
+ image: {{ .Values.postgresOperator.imagePostgres | quote }}
+ {{- end }}
+ imagePullSecrets:
+ - name: {{ include "common.namespace" . }}-docker-registry-key
+ postgresVersion: {{ $dot.Values.postgresOperator.postgresVersion }}
+ instances:
+ - name: {{ default "instance1" .Values.postgresOperator.instanceName | quote }}
+ replicas: {{ default 2 .Values.postgresOperator.instanceReplicas }}
+ dataVolumeClaimSpec:
+ {{- if .Values.instanceStorageClassName }}
+ storageClassName: {{ .Values.postgresOperator.instanceStorageClassName | quote }}
+ {{- end }}
+ accessModes:
+ - "ReadWriteOnce"
+ resources:
+ requests:
+ storage: {{ default "1Gi" .Values.postgresOperator.instanceSize | quote }}
+ {{- if or .Values.instanceMemory .Values.postgresOperator.instanceCPU }}
+ resources:
+ limits:
+ cpu: {{ default "" .Values.postgresOperator.instanceCPU | quote }}
+ memory: {{ default "" .Values.postgresOperator.instanceMemory | quote }}
+ {{- end }}
+ affinity:
+ podAntiAffinity:
+ preferredDuringSchedulingIgnoredDuringExecution:
+ - weight: 1
+ podAffinityTerm:
+ topologyKey: kubernetes.io/hostname
+ labelSelector:
+ matchLabels:
+ postgres-operator.crunchydata.com/cluster: {{ $dbinst }}
+ postgres-operator.crunchydata.com/instance-set: {{ default "instance1" .Values.postgresOperator.instanceName | quote }}
+ proxy:
+ pgBouncer:
+ metadata:
+ labels:
+ app: {{ $dbinst }}
+ version: "5.5"
+ {{- if .Values.postgresOperator.imagePgBouncer }}
+ image: {{ .Values.postgresOperator.imagePgBouncer | quote }}
+ {{- end }}
+ replicas: {{ default 2 .Values.postgresOperator.bouncerReplicas }}
+ affinity:
+ podAntiAffinity:
+ preferredDuringSchedulingIgnoredDuringExecution:
+ - weight: 1
+ podAffinityTerm:
+ topologyKey: kubernetes.io/hostname
+ labelSelector:
+ matchLabels:
+ postgres-operator.crunchydata.com/cluster: {{ $dbinst }}
+ postgres-operator.crunchydata.com/role: pgbouncer
+ {{- if .Values.postgresOperator.monitoring }}
+ monitoring:
+ pgmonitor:
+ exporter:
+ image: {{ default "" .Values.postgresOperator.imageExporter | quote }}
+ {{- if .Values.postgresOperator.monitoringConfig }}
+{{ toYaml .Values.monitoringConfig | indent 8 }}
+ {{- end }}
+ {{- end }}
+ users:
+ - name: postgres
+{{- end -}}
apiVersion: v2
description: Chart for Postgres init job
name: postgres-init
-version: 13.0.0
+version: 13.0.1
dependencies:
- name: repositoryGenerator
version: ~13.x-0
repository: 'file://../repositoryGenerator'
+ - name: readinessCheck
+ version: ~13.x-0
+ repository: '@local'
- name: serviceAccount
version: ~13.x-0
repository: '@local'
\ No newline at end of file
release: {{ include "common.release" . }}
name: {{ include "common.name" . }}
spec:
- initContainers:
- - name: {{ include "common.name" . }}-readiness
- command:
- - /app/ready.py
- args:
- - --container-name
- - {{ .Values.global.postgres.container.name }}
- env:
- - name: NAMESPACE
- valueFrom:
- fieldRef:
- apiVersion: v1
- fieldPath: metadata.namespace
- image: {{ include "repositoryGenerator.image.readiness" . }}
- imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+ initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
containers:
- command:
- sh
roles:
- read
+readinessCheck:
+ wait_for:
+ - '{{ .Values.global.postgres.container.name }}'
+
wait_for_job_container:
containers:
- '{{ include "common.name" . }}-update-config'
\ No newline at end of file
apiVersion: v2
description: ONAP Postgres Server
name: postgres
-version: 13.0.0
+version: 13.1.0
dependencies:
- name: common
# limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
apiVersion: v1
kind: ConfigMap
metadata:
heritage: {{ .Release.Service }}
data:
{{ tpl (.Files.Glob "configs/*").AsConfig . | indent 2 }}
-
+{{- end }}
# # See the License for the specific language governing permissions and
# # limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
{{ include "common.postgres.deployment" (dict "dot" . "pgMode" "primary") }}
+{{- end }}
\ No newline at end of file
# # See the License for the specific language governing permissions and
# # limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
{{ include "common.postgres.deployment" (dict "dot" . "pgMode" "replica") }}
+{{- end }}
\ No newline at end of file
# limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
{{- if default false .Values.metrics.enabled }}
apiVersion: v1
kind: Service
selector:
name: {{ .Values.container.name.primary }}
release: {{ include "common.release" . }}
+{{- end }}
{{- end }}
\ No newline at end of file
# limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
{{- if default false .Values.metrics.enabled }}
apiVersion: v1
kind: Service
selector:
name: {{ .Values.container.name.replica }}
release: {{ include "common.release" . }}
+{{- end }}
{{- end }}
\ No newline at end of file
--- /dev/null
+{{/*
+# Copyright © 2023 Deutsche Telekom AG
+#
+# 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.
+*/}}
+
+{{- if .Values.global.postgres.useOperator }}
+{{ include "common.postgresOpInstance" . }}
+{{- end }}
\ No newline at end of file
# # See the License for the specific language governing permissions and
# # limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
{{- if include "common.needPV" . -}}
kind: PersistentVolume
path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ include "common.release" . }}/{{ .Values.persistence.mountSubPath }}/primary
{{- end -}}
{{- end -}}
+{{- end }}
\ No newline at end of file
# # See the License for the specific language governing permissions and
# # limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
{{- if include "common.needPV" . -}}
kind: PersistentVolume
persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
hostPath:
path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ include "common.release" . }}/{{ .Values.persistence.mountSubPath }}/replica
-{{- end -}}
-{{- end -}}
+{{- end }}
+{{- end }}
+{{- end }}
# limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
{{- else }}
storageClassName: {{ include "common.storageClass" . }}
{{- end }}
-{{- end -}}
+{{- end }}
+{{- end }}
# limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
{{- else }}
storageClassName: {{ include "common.storageClass" . }}
{{- end }}
-{{- end -}}
+{{- end }}
+{{- end }}
\ No newline at end of file
# # See the License for the specific language governing permissions and
# # limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
apiVersion: v1
kind: Service
metadata:
selector:
app: {{ include "common.name" . }}
release: {{ include "common.release" . }}
+{{- end }}
# # See the License for the specific language governing permissions and
# # limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
apiVersion: v1
kind: Service
metadata:
selector:
name: "{{.Values.container.name.primary}}"
release: {{ include "common.release" . }}
+{{- end }}
# # See the License for the specific language governing permissions and
# # limitations under the License.
*/}}
+{{- if not .Values.global.postgres.useOperator }}
apiVersion: v1
kind: Service
metadata:
selector:
name: "{{.Values.container.name.replica}}"
release: {{ include "common.release" . }}
+{{- end }}
\ No newline at end of file
# See the License for the specific language governing permissions and
# limitations under the License.
*/}}
-
+{{- if not .Values.global.postgres.useOperator }}
{{- if .Values.metrics.serviceMonitor.enabled }}
{{ include "common.serviceMonitor" . }}
{{- end }}
+{{- end }}
\ No newline at end of file
global:
nodePortPrefix: 302
persistence: {}
+ postgres:
+ # flag to enable the DB creation via mariadb-operator
+ useOperator: false
#################################################################
# Secrets metaconfig
externalSecret: '{{ tpl (default "" .Values.config.pgPrimaryPasswordExternalSecret) . }}'
password: '{{ .Values.config.pgPrimaryPassword }}'
+#################################################################
+# Postgres Operator configuration defaults.
+# Example: https://github.com/CrunchyData/postgres-operator-examples/tree/main/helm/postgres
+#################################################################
+postgresOperator:
+ postgresVersion: 16
+ # Possibility to override images
+ #imagePostgres:
+ #imagePgBouncer:
+ #imageExporter:
+ #imagePgBackRest:
+ instanceName: instance1
+ instanceReplicas: 2
+ #instanceStorageClassName:
+ instanceSize: 1Gi
+ #instanceCPU:
+ #instanceMemory:
+ bouncerReplicas: 2
+ monitoring: true
+ #monitoringConfig: {}
+
#################################################################
# Application configuration defaults.
#################################################################