From b4412b05e5d0d9441c0ab5fc192538f4e7033443 Mon Sep 17 00:00:00 2001 From: bitnami-bot Date: Fri, 21 Dec 2018 10:36:39 +0000 Subject: [PATCH] Synchronize upstreamed folder to c1a851a2c --- upstreamed/ghost/Chart.yaml | 7 +- upstreamed/ghost/requirements.lock | 4 +- upstreamed/ghost/values.yaml | 2 +- upstreamed/postgresql/Chart.yaml | 2 +- upstreamed/postgresql/README.md | 158 +++++++++--------- upstreamed/postgresql/templates/NOTES.txt | 6 +- upstreamed/postgresql/templates/_helpers.tpl | 38 ++++- .../postgresql/templates/configmap.yaml | 2 +- .../templates/extended-config-configmap.yaml | 2 +- .../templates/initialization-configmap.yaml | 2 +- .../templates/statefulset-slaves.yaml | 28 ++-- .../postgresql/templates/statefulset.yaml | 28 ++-- upstreamed/postgresql/templates/svc-read.yaml | 31 ++++ upstreamed/postgresql/values-production.yaml | 11 ++ upstreamed/postgresql/values.yaml | 11 ++ 15 files changed, 207 insertions(+), 125 deletions(-) create mode 100644 upstreamed/postgresql/templates/svc-read.yaml diff --git a/upstreamed/ghost/Chart.yaml b/upstreamed/ghost/Chart.yaml index 93b4ef7cf9..729801ba25 100644 --- a/upstreamed/ghost/Chart.yaml +++ b/upstreamed/ghost/Chart.yaml @@ -1,8 +1,7 @@ name: ghost -version: 6.1.7 -appVersion: 2.9.0 -description: A simple, powerful publishing platform that allows you to share your - stories with the world +version: 6.1.8 +appVersion: 2.9.1 +description: A simple, powerful publishing platform that allows you to share your stories with the world keywords: - ghost - blog diff --git a/upstreamed/ghost/requirements.lock b/upstreamed/ghost/requirements.lock index ceb7cda65d..b34f20d17a 100644 --- a/upstreamed/ghost/requirements.lock +++ b/upstreamed/ghost/requirements.lock @@ -1,6 +1,6 @@ dependencies: - name: mariadb repository: https://kubernetes-charts.storage.googleapis.com/ - version: 5.2.4 + version: 5.2.5 digest: sha256:b3053e73f5c114f55a794eccea2606cc9fe8a669eaab1716246994bbdd37a473 -generated: 2018-12-13T16:23:55.916081733Z +generated: 2018-12-20T14:09:15.272113665Z diff --git a/upstreamed/ghost/values.yaml b/upstreamed/ghost/values.yaml index 706bfa7a31..3e5fa1472d 100644 --- a/upstreamed/ghost/values.yaml +++ b/upstreamed/ghost/values.yaml @@ -10,7 +10,7 @@ image: registry: docker.io repository: bitnami/ghost - tag: 2.9.0 + tag: 2.9.1 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images diff --git a/upstreamed/postgresql/Chart.yaml b/upstreamed/postgresql/Chart.yaml index cc88732644..0ad9aa0e8b 100644 --- a/upstreamed/postgresql/Chart.yaml +++ b/upstreamed/postgresql/Chart.yaml @@ -1,5 +1,5 @@ name: postgresql -version: 3.4.0 +version: 3.6.0 appVersion: 10.6.0 description: Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance. keywords: diff --git a/upstreamed/postgresql/README.md b/upstreamed/postgresql/README.md index c72ba1945b..cc55f81491 100644 --- a/upstreamed/postgresql/README.md +++ b/upstreamed/postgresql/README.md @@ -45,81 +45,83 @@ The command removes all the Kubernetes components associated with the chart and The following tables lists the configurable parameters of the PostgreSQL chart and their default values. -| Parameter | Description | Default | -|-----------------------------------------------|---------------------------------------------------------|--------------------------------------------------------- | -| `global.imageRegistry` | Global Docker Image registry | `nil` | -| `image.registry` | PostgreSQL Image registry | `docker.io` | -| `image.repository` | PostgreSQL Image name | `bitnami/postgresql` | -| `image.tag` | PostgreSQL Image tag | `{VERSION}` | -| `image.pullPolicy` | PostgreSQL Image pull policy | `Always` | -| `image.pullSecrets` | Specify Image pull secrets | `nil` (does not add image pull secrets to deployed pods) | -| `image.debug` | Specify if debug values should be set | `false` | -| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` | -| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` | -| `volumePermissions.image.tag` | Init container volume-permissions image tag | `latest` | -| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` | -| `volumePermissions.enabled` | Enable init container | `true` | -| `volumePermissions.securityContext.runAsUser` | User ID for the init container | `0` | -| `usePasswordFile` | Have the secrets mounted as a file instead of env vars | `false` | -| `replication.enabled` | Would you like to enable replication | `false` | -| `replication.user` | Replication user | `repl_user` | -| `replication.password` | Replication user password | `repl_password` | -| `replication.slaveReplicas` | Number of slaves replicas | `1` | -| `existingSecret` | Name of existing secret to use for PostgreSQL passwords | `nil` | -| `postgresqlUsername` | PostgreSQL admin user | `postgres` | -| `postgresqlPassword` | PostgreSQL admin password | _random 10 character alphanumeric string_ | -| `postgresqlDatabase` | PostgreSQL database | `nil` | -| `postgresqlConfiguration` | Runtime Config Parameters | `nil` | -| `pgHbaConfiguration` | Content of pg\_hba.conf | `nil (do not create pg_hba.conf)` | -| `initdbScripts` | List of initdb scripts | `nil` | -| `service.type` | Kubernetes Service type | `ClusterIP` | -| `service.port` | PostgreSQL port | `5432` | -| `service.nodePort` | Kubernetes Service nodePort | `nil` | -| `service.annotations` | Annotations for PostgreSQL service | {} | -| `service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` | -| `persistence.enabled` | Enable persistence using PVC | `true` | -| `persistence.existingClaim` | Provide an existing `PersistentVolumeClaim` | `nil` | -| `persistence.mountPath` | Path to mount the volume at | `/bitnami/postgresql` | -| `persistence.storageClass` | PVC Storage Class for PostgreSQL volume | `nil` | -| `persistence.accessMode` | PVC Access Mode for PostgreSQL volume | `ReadWriteOnce` | -| `persistence.size` | PVC Storage Request for PostgreSQL volume | `8Gi` | -| `persistence.annotations` | Annotations for the PVC | `{}` | -| `master.nodeSelector` | Node labels for pod assignment (master nodes) | `{}` | -| `master.affinity` | Affinity labels for pod assignment (master nodes) | `{}` | -| `master.tolerations` | Toleration labels for pod assignment (master nodes) | `[]` | -| `slave.nodeSelector` | Node labels for pod assignment (slave nodes) | `{}` | -| `slave.affinity` | Affinity labels for pod assignment (slave nodes) | `{}` | -| `slave.tolerations` | Toleration labels for pod assignment (slave nodes) | `[]` | -| `terminationGracePeriodSeconds` | Seconds the pod needs to terminate gracefully | `nil` | -| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `250m` | -| `securityContext.enabled` | Enable security context | `true` | -| `securityContext.fsGroup` | Group ID for the container | `1001` | -| `securityContext.runAsUser` | User ID for the container | `1001` | -| `livenessProbe.enabled` | Would you like a livessProbed to be enabled | `true` | -| `networkPolicy.enabled` | Enable NetworkPolicy | `false` | -| `networkPolicy.allowExternal` | Don't require client label for connections | `true` | -| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 30 | -| `livenessProbe.periodSeconds` | How often to perform the probe | 10 | -| `livenessProbe.timeoutSeconds` | When the probe times out | 5 | -| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded | `6` | -| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | `1` | -| `readinessProbe.enabled` | would you like a readinessProbe to be enabled | `true` | -| `readinessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 5 | -| `readinessProbe.periodSeconds` | How often to perform the probe | 10 | -| `readinessProbe.timeoutSeconds` | When the probe times out | 5 | -| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded | `6` | -| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | `1` | -| `metrics.enabled` | Start a prometheus exporter | `false` | -| `metrics.service.type` | Kubernetes Service type | `ClusterIP` | -| `metrics.service.annotations` | Additional annotations for metrics exporter pod | `{}` | -| `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` | -| `metrics.image.registry` | PostgreSQL Image registry | `docker.io` | -| `metrics.image.repository` | PostgreSQL Image name | `wrouesnel/postgres_exporter` | -| `metrics.image.tag` | PostgreSQL Image tag | `{VERSION}` | -| `metrics.image.pullPolicy` | PostgreSQL Image pull policy | `IfNotPresent` | -| `metrics.image.pullSecrets` | Specify Image pull secrets | `nil` (does not add image pull secrets to deployed pods) | -| `extraEnv` | Any extra environment variables you would like to pass on to the pod | `{}` | -| `updateStrategy` | Update strategy policy | `{type: "onDelete"}` | +| Parameter | Description | Default | +|-----------------------------------------------|------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------| +| `global.imageRegistry` | Global Docker Image registry | `nil` | +| `image.registry` | PostgreSQL Image registry | `docker.io` | +| `image.repository` | PostgreSQL Image name | `bitnami/postgresql` | +| `image.tag` | PostgreSQL Image tag | `{VERSION}` | +| `image.pullPolicy` | PostgreSQL Image pull policy | `Always` | +| `image.pullSecrets` | Specify Image pull secrets | `nil` (does not add image pull secrets to deployed pods) | +| `image.debug` | Specify if debug values should be set | `false` | +| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` | +| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` | +| `volumePermissions.image.tag` | Init container volume-permissions image tag | `latest` | +| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` | +| `volumePermissions.securityContext.runAsUser` | User ID for the init container | `0` | +| `usePasswordFile` | Have the secrets mounted as a file instead of env vars | `false` | +| `replication.enabled` | Would you like to enable replication | `false` | +| `replication.user` | Replication user | `repl_user` | +| `replication.password` | Replication user password | `repl_password` | +| `replication.slaveReplicas` | Number of slaves replicas | `1` | +| `existingSecret` | Name of existing secret to use for PostgreSQL passwords | `nil` | +| `postgresqlUsername` | PostgreSQL admin user | `postgres` | +| `postgresqlPassword` | PostgreSQL admin password | _random 10 character alphanumeric string_ | +| `postgresqlDatabase` | PostgreSQL database | `nil` | +| `postgresqlConfiguration` | Runtime Config Parameters | `nil` | +| `pgHbaConfiguration` | Content of pg\_hba.conf | `nil (do not create pg_hba.conf)` | +| `configurationConfigMap` | ConfigMap with the PostgreSQL configuration files (Note: Overrides `postgresqlConfiguration` and `pgHbaConfiguration`) | `nil` | +| `extendedConfConfigMap` | ConfigMap with the extended PostgreSQL configuration files | `nil` | +| `initdbScripts` | List of initdb scripts | `nil` | +| `initdbScriptsConfigMap` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`) | `nil` | +| `service.type` | Kubernetes Service type | `ClusterIP` | +| `service.port` | PostgreSQL port | `5432` | +| `service.nodePort` | Kubernetes Service nodePort | `nil` | +| `service.annotations` | Annotations for PostgreSQL service | {} | +| `service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` | +| `persistence.enabled` | Enable persistence using PVC | `true` | +| `persistence.existingClaim` | Provide an existing `PersistentVolumeClaim` | `nil` | +| `persistence.mountPath` | Path to mount the volume at | `/bitnami/postgresql` | +| `persistence.storageClass` | PVC Storage Class for PostgreSQL volume | `nil` | +| `persistence.accessMode` | PVC Access Mode for PostgreSQL volume | `ReadWriteOnce` | +| `persistence.size` | PVC Storage Request for PostgreSQL volume | `8Gi` | +| `persistence.annotations` | Annotations for the PVC | `{}` | +| `master.nodeSelector` | Node labels for pod assignment (postgresql master) | `{}` | +| `master.affinity` | Affinity labels for pod assignment (postgresql master) | `{}` | +| `master.tolerations` | Toleration labels for pod assignment (postgresql master) | `[]` | +| `slave.nodeSelector` | Node labels for pod assignment (postgresql slave) | `{}` | +| `slave.affinity` | Affinity labels for pod assignment (postgresql slave) | `{}` | +| `slave.tolerations` | Toleration labels for pod assignment (postgresql slave) | `[]` | +| `terminationGracePeriodSeconds` | Seconds the pod needs to terminate gracefully | `nil` | +| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `250m` | +| `securityContext.enabled` | Enable security context | `true` | +| `securityContext.fsGroup` | Group ID for the container | `1001` | +| `securityContext.runAsUser` | User ID for the container | `1001` | +| `livenessProbe.enabled` | Would you like a livessProbed to be enabled | `true` | +| `networkPolicy.enabled` | Enable NetworkPolicy | `false` | +| `networkPolicy.allowExternal` | Don't require client label for connections | `true` | +| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 30 | +| `livenessProbe.periodSeconds` | How often to perform the probe | 10 | +| `livenessProbe.timeoutSeconds` | When the probe times out | 5 | +| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 | +| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 | +| `readinessProbe.enabled` | would you like a readinessProbe to be enabled | `true` | +| `readinessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 5 | +| `readinessProbe.periodSeconds` | How often to perform the probe | 10 | +| `readinessProbe.timeoutSeconds` | When the probe times out | 5 | +| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 | +| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 | +| `metrics.enabled` | Start a prometheus exporter | `false` | +| `metrics.service.type` | Kubernetes Service type | `ClusterIP` | +| `metrics.service.annotations` | Additional annotations for metrics exporter pod | `{}` | +| `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` | +| `metrics.image.registry` | PostgreSQL Image registry | `docker.io` | +| `metrics.image.repository` | PostgreSQL Image name | `wrouesnel/postgres_exporter` | +| `metrics.image.tag` | PostgreSQL Image tag | `{VERSION}` | +| `metrics.image.pullPolicy` | PostgreSQL Image pull policy | `IfNotPresent` | +| `metrics.image.pullSecrets` | Specify Image pull secrets | `nil` (does not add image pull secrets to deployed pods) | +| `extraEnv` | Any extra environment variables you would like to pass on to the pod | `{}` | +| `updateStrategy` | Update strategy policy | `{type: "onDelete"}` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, @@ -147,17 +149,23 @@ Add your custom file to "files/postgresql.conf" in your working directory. This Alternatively, you can specify PostgreSQL configuration parameters using the `postgresqlConfiguration` parameter as a dict, using camelCase, e.g. {"sharedBuffers": "500MB"}. +In addition to these options, you can also set an external ConfigMap with all the configuration files. This is done by setting the `configurationConfigMap` parameter. Note that this will override the two previous options. + ### Allow settings to be loaded from files other than the default `postgresql.conf` If you don't want to provide the whole PostgreSQL configuration file and only specify certain parameters, you can add your extended `.conf` files to "files/conf.d/" in your working directory. Those files will be mounted as configMap to the containers adding/overwriting the default configuration using the `include_dir` directive that allows settings to be loaded from files other than the default `postgresql.conf`. +Alternatively, you can also set an external ConfigMap with all the extra configuration files. This is done by setting the `extendedConfConfigMap` parameter. Note that this will override the previous option. + ## Initialize a fresh instance The [Bitnami PostgreSQL](https://github.com/bitnami/bitnami-docker-postgresql) image allows you to use your custom scripts to initialize a fresh instance. In order to execute the scripts, they must be located inside the chart folder `files/docker-entrypoint-initdb.d` so they can be consumed as a ConfigMap. Alternatively, you can specify custom scripts using the `initdbScripts` parameter as dict. +In addition to these options, you can also set an external ConfigMap with all the initialization scripts. This is done by setting the `initdbScriptsConfigMap` parameter. Note that this will override the two previous options. + The allowed extensions are `.sh`, `.sql` and `.sql.gz`. ## Production and horizontal scaling diff --git a/upstreamed/postgresql/templates/NOTES.txt b/upstreamed/postgresql/templates/NOTES.txt index 329f5eaf1e..41c2210491 100644 --- a/upstreamed/postgresql/templates/NOTES.txt +++ b/upstreamed/postgresql/templates/NOTES.txt @@ -19,8 +19,10 @@ PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster: - {{ template "postgresql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local - + {{ template "postgresql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local - Read/Write connection +{{- if .Values.replication.enabled }} + {{ template "postgresql.fullname" . }}-read.{{ .Release.Namespace }}.svc.cluster.local - Read only connection +{{- end }} To get the password for "{{ .Values.postgresqlUsername }}" run: export POSTGRESQL_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{ else }}{{ template "postgresql.fullname" . }}{{ end }} -o jsonpath="{.data.postgresql-password}" | base64 --decode) diff --git a/upstreamed/postgresql/templates/_helpers.tpl b/upstreamed/postgresql/templates/_helpers.tpl index ef27a0582f..e07e820580 100644 --- a/upstreamed/postgresql/templates/_helpers.tpl +++ b/upstreamed/postgresql/templates/_helpers.tpl @@ -111,10 +111,42 @@ Return the proper PostgreSQL metrics image name Get the password secret. */}} {{- define "postgresql.secretName" -}} -{{- $secretName := include "postgresql.fullname" . -}} {{- if .Values.existingSecret -}} -{{ $secretName := .Values.existingSecret -}} +{{- printf "%s" .Values.existingSecret -}} {{- else -}} -{{- printf "%s" $secretName -}} +{{- printf "%s" (include "postgresql.fullname" .) -}} +{{- end -}} +{{- end -}} + +{{/* +Get the configuration ConfigMap name. +*/}} +{{- define "postgresql.configurationCM" -}} +{{- if .Values.configurationConfigMap -}} +{{- printf "%s" .Values.configurationConfigMap -}} +{{- else -}} +{{- printf "%s-configuration" (include "postgresql.fullname" .) -}} +{{- end -}} +{{- end -}} + +{{/* +Get the extended configuration ConfigMap name. +*/}} +{{- define "postgresql.extendedConfigurationCM" -}} +{{- if .Values.extendedConfConfigMap -}} +{{- printf "%s" .Values.extendedConfConfigMap -}} +{{- else -}} +{{- printf "%s-extended-configuration" (include "postgresql.fullname" .) -}} +{{- end -}} +{{- end -}} + +{{/* +Get the initialization scripts ConfigMap name. +*/}} +{{- define "postgresql.initdbScriptsCM" -}} +{{- if .Values.initdbScriptsConfigMap -}} +{{- printf "%s" .Values.initdbScriptsConfigMap -}} +{{- else -}} +{{- printf "%s-init-scripts" (include "postgresql.fullname" .) -}} {{- end -}} {{- end -}} diff --git a/upstreamed/postgresql/templates/configmap.yaml b/upstreamed/postgresql/templates/configmap.yaml index 7c18c01c55..d2178c077e 100644 --- a/upstreamed/postgresql/templates/configmap.yaml +++ b/upstreamed/postgresql/templates/configmap.yaml @@ -1,4 +1,4 @@ -{{ if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration}} +{{ if and (or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration) (not .Values.configurationConfigMap) }} apiVersion: v1 kind: ConfigMap metadata: diff --git a/upstreamed/postgresql/templates/extended-config-configmap.yaml b/upstreamed/postgresql/templates/extended-config-configmap.yaml index 5c232a0c75..8b92b3ce37 100644 --- a/upstreamed/postgresql/templates/extended-config-configmap.yaml +++ b/upstreamed/postgresql/templates/extended-config-configmap.yaml @@ -1,4 +1,4 @@ -{{- if (.Files.Glob "files/conf.d/*.conf") }} +{{- if and (.Files.Glob "files/conf.d/*.conf") (not .Values.extendedConfConfigMap)}} apiVersion: v1 kind: ConfigMap metadata: diff --git a/upstreamed/postgresql/templates/initialization-configmap.yaml b/upstreamed/postgresql/templates/initialization-configmap.yaml index b54e6c3317..9565de7fff 100644 --- a/upstreamed/postgresql/templates/initialization-configmap.yaml +++ b/upstreamed/postgresql/templates/initialization-configmap.yaml @@ -1,4 +1,4 @@ -{{- if (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") }} +{{- if and (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") (not .Values.initdbScriptsConfigMap) }} apiVersion: v1 kind: ConfigMap metadata: diff --git a/upstreamed/postgresql/templates/statefulset-slaves.yaml b/upstreamed/postgresql/templates/statefulset-slaves.yaml index 77e0154207..c862c17ec3 100644 --- a/upstreamed/postgresql/templates/statefulset-slaves.yaml +++ b/upstreamed/postgresql/templates/statefulset-slaves.yaml @@ -142,19 +142,13 @@ spec: - name: data mountPath: /bitnami/postgresql {{ end }} - {{ if or (.Files.Glob "files/postgresql.conf") .Values.postgresqlConfiguration }} - - name: postgresql-config - mountPath: /opt/bitnami/postgresql/conf/postgresql.conf - subPath: postgresql.conf - {{ end }} - {{ if or (.Files.Glob "files/pg_hba.conf") .Values.pgHbaConfiguration }} - - name: postgresql-config - mountPath: /opt/bitnami/postgresql/conf/pg_hba.conf - subPath: pg_hba.conf - {{ end }} - {{- if (.Files.Glob "files/conf.d/*.conf") }} + {{- if or (.Files.Glob "files/conf.d/*.conf") .Values.extendedConfConfigMap }} - name: postgresql-extended-config - mountPath: /opt/bitnami/postgresql/conf/conf.d/ + mountPath: /bitnami/postgresql/conf/conf.d/ + {{- end }} + {{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap }} + - name: postgresql-config + mountPath: /bitnami/postgresql/conf {{- end }} volumes: {{- if .Values.usePasswordFile }} @@ -162,15 +156,15 @@ spec: secret: secretName: {{ template "postgresql.secretName" . }} {{ end }} - {{ if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration }} + {{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap}} - name: postgresql-config configMap: - name: {{ template "postgresql.fullname" . }}-configuration - {{ end }} - {{- if (.Files.Glob "files/conf.d/*.conf") }} + name: {{ template "postgresql.configurationCM" . }} + {{- end }} + {{- if or (.Files.Glob "files/conf.d/*.conf") .Values.extendedConfConfigMap }} - name: postgresql-extended-config configMap: - name: {{ template "postgresql.fullname" . }}-extended-configuration + name: {{ template "postgresql.extendedConfigurationCM" . }} {{- end }} updateStrategy: type: {{ .Values.updateStrategy.type }} diff --git a/upstreamed/postgresql/templates/statefulset.yaml b/upstreamed/postgresql/templates/statefulset.yaml index d7291f083e..3c7ac84298 100644 --- a/upstreamed/postgresql/templates/statefulset.yaml +++ b/upstreamed/postgresql/templates/statefulset.yaml @@ -155,13 +155,13 @@ spec: failureThreshold: {{ .Values.readinessProbe.failureThreshold }} {{- end }} volumeMounts: - {{- if (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") }} + {{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap }} - name: custom-init-scripts mountPath: /docker-entrypoint-initdb.d {{- end }} - {{- if (.Files.Glob "files/conf.d/*.conf") }} + {{- if or (.Files.Glob "files/conf.d/*.conf") .Values.extendedConfConfigMap }} - name: postgresql-extended-config - mountPath: /opt/bitnami/postgresql/conf/conf.d/ + mountPath: /bitnami/postgresql/conf/conf.d/ {{- end }} {{- if .Values.usePasswordFile }} - name: postgresql-password @@ -171,15 +171,9 @@ spec: - name: data mountPath: {{ .Values.persistence.mountPath }} {{- end }} - {{- if or (.Files.Glob "files/postgresql.conf") .Values.postgresqlConfiguration }} + {{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap }} - name: postgresql-config - mountPath: /opt/bitnami/postgresql/conf/postgresql.conf - subPath: postgresql.conf - {{- end }} - {{- if or (.Files.Glob "files/pg_hba.conf") .Values.pgHbaConfiguration }} - - name: postgresql-config - mountPath: /opt/bitnami/postgresql/conf/pg_hba.conf - subPath: pg_hba.conf + mountPath: /bitnami/postgresql/conf {{- end }} {{- if .Values.metrics.enabled }} - name: metrics @@ -235,25 +229,25 @@ spec: {{ toYaml .Values.metrics.resources | indent 10 }} {{- end }} volumes: - {{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration }} + {{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap}} - name: postgresql-config configMap: - name: {{ template "postgresql.fullname" . }}-configuration + name: {{ template "postgresql.configurationCM" . }} {{- end }} - {{- if (.Files.Glob "files/conf.d/*.conf") }} + {{- if or (.Files.Glob "files/conf.d/*.conf") .Values.extendedConfConfigMap }} - name: postgresql-extended-config configMap: - name: {{ template "postgresql.fullname" . }}-extended-configuration + name: {{ template "postgresql.extendedConfigurationCM" . }} {{- end }} {{- if .Values.usePasswordFile }} - name: postgresql-password secret: secretName: {{ template "postgresql.secretName" . }} {{- end }} - {{- if (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") }} + {{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap }} - name: custom-init-scripts configMap: - name: {{ template "postgresql.fullname" . }}-init-scripts + name: {{ template "postgresql.initdbScriptsCM" . }} {{- end }} {{- if and .Values.persistence.enabled .Values.persistence.existingClaim }} - name: data diff --git a/upstreamed/postgresql/templates/svc-read.yaml b/upstreamed/postgresql/templates/svc-read.yaml new file mode 100644 index 0000000000..6b2de778ab --- /dev/null +++ b/upstreamed/postgresql/templates/svc-read.yaml @@ -0,0 +1,31 @@ +{{- if .Values.replication.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "postgresql.fullname" . }}-read + labels: + app: {{ template "postgresql.name" . }} + chart: {{ template "postgresql.chart" . }} + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +{{- with .Values.service.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: + type: {{ .Values.service.type }} + {{- if and .Values.service.loadBalancerIP (eq .Values.service.type "LoadBalancer") }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - name: postgresql + port: {{ .Values.service.port }} + targetPort: postgresql + {{- if .Values.service.nodePort }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + selector: + app: {{ template "postgresql.name" . }} + release: {{ .Release.Name | quote }} + role: slave +{{- end }} diff --git a/upstreamed/postgresql/values-production.yaml b/upstreamed/postgresql/values-production.yaml index 6ec8cb4226..4868be2d9b 100644 --- a/upstreamed/postgresql/values-production.yaml +++ b/upstreamed/postgresql/values-production.yaml @@ -99,6 +99,13 @@ postgresqlUsername: postgres # host all all localhost trust # host mydatabase mysuser 192.168.0.0/24 md5 +## ConfigMap with PostgreSQL configuration +## NOTE: This will override postgresqlConfiguration and pgHbaConfiguration +# configurationConfigMap: + +## ConfigMap with PostgreSQL extended configuration +# extendedConfConfigMap: + ## initdb scripts ## Specify dictionnary of scripts to be run at first boot ## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory @@ -108,6 +115,10 @@ postgresqlUsername: postgres # #!/bin/sh # echo "Do something." +## ConfigMap with scripts to be run at first boot +## NOTE: This will override initdbScripts +# initdbScriptsConfigMap: + ## PostgreSQL service configuration service: ## PosgresSQL service type diff --git a/upstreamed/postgresql/values.yaml b/upstreamed/postgresql/values.yaml index aaba4d6e8a..3666d232c0 100644 --- a/upstreamed/postgresql/values.yaml +++ b/upstreamed/postgresql/values.yaml @@ -99,6 +99,13 @@ postgresqlUsername: postgres # host all all localhost trust # host mydatabase mysuser 192.168.0.0/24 md5 +## ConfigMap with PostgreSQL configuration +## NOTE: This will override postgresqlConfiguration and pgHbaConfiguration +# configurationConfigMap: + +## ConfigMap with PostgreSQL extended configuration +# extendedConfConfigMap: + ## initdb scripts ## Specify dictionnary of scripts to be run at first boot ## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory @@ -107,6 +114,10 @@ postgresqlUsername: postgres # my_init_script.sh:| # #!/bin/sh # echo "Do something." +# +## ConfigMap with scripts to be run at first boot +## NOTE: This will override initdbScripts +# initdbScriptsConfigMap: ## Optional duration in seconds the pod needs to terminate gracefully. ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods