mirror of
https://github.com/wahyd4/charts.git
synced 2026-08-22 03:25:53 +10:00
Merge pull request #1559 from bitnami/postgresql-ha
[bitnami/postgresql-ha] Add new chart: postgresql-ha
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
@@ -0,0 +1,23 @@
|
||||
apiVersion: v1
|
||||
name: postgresql-ha
|
||||
version: 0.4.0
|
||||
appVersion: 11.5.0
|
||||
description: Chart for PostgreSQL with HA architecture (using Replication Manager (repmgr) and Pgpool).
|
||||
keywords:
|
||||
- postgresql
|
||||
- repmgr
|
||||
- pgpool
|
||||
- postgres
|
||||
- database
|
||||
- sql
|
||||
- replication
|
||||
- cluster
|
||||
- high availability
|
||||
home: https://www.postgresql.org/
|
||||
icon: https://bitnami.com/assets/stacks/postgresql/img/postgresql-stack-110x117.png
|
||||
sources:
|
||||
- https://github.com/bitnami/bitnami-docker-postgresql
|
||||
maintainers:
|
||||
- name: Bitnami
|
||||
email: containers@bitnami.com
|
||||
engine: gotpl
|
||||
@@ -0,0 +1,418 @@
|
||||
# PostgreSQL HA
|
||||
|
||||
This Helm chart has been developed based on [stable/postgresql](https://github.com/helm/charts/tree/master/stable/postgresql) chart but including some changes to guarantee high availability such as:
|
||||
|
||||
- A new deployment, service and ingress have been added to deploy [Pgpool-II](Pgpool-II) to act as proxy for PostgreSQL backend. It helps to reduce connection overhead, acts as a load balancer for PostgreSQL, and ensures database node failover.
|
||||
- Replacing `bitnami/postgresql` with `bitnami/postgresql-repmgr` which includes and configures [repmgr](https://repmgr.org/). Repmgr ensures standby nodes assume the primary role when the primary node is unhealthy.
|
||||
|
||||
## TL;DR:
|
||||
|
||||
```
|
||||
$ helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
$ helm install bitnami/postgresql-ha
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This [Helm](https://github.com/kubernetes/helm) chart installs [PostgreSQL](https://www.postgresql.org/) with HA architecture in a Kubernetes cluster. Welcome to [contribute](CONTRIBUTING.md) to Helm Chart for PostgreSQL HA.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes cluster 1.10+
|
||||
- Helm 2.8.0+
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
Install the PostgreSQL HA helm chart with a release name `my-release`:
|
||||
|
||||
```bash
|
||||
$ helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
$ helm install --name my-release bitnami/postgresql-ha
|
||||
```
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```bash
|
||||
$ helm delete --purge my-release
|
||||
```
|
||||
|
||||
Additionaly, if `persistence.resourcePolicy` is set to `keep`, you should manually delete the PVCs.
|
||||
|
||||
## Downloading the chart
|
||||
|
||||
Download PostgreSQL HA helm chart
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/bitnami/charts
|
||||
```
|
||||
|
||||
Change directory to PostgreSQL code
|
||||
|
||||
```bash
|
||||
$ cd charts/bitnami/postgresql-ha
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the PostgreSQL HA chart and the default values. They can be configured in `values.yaml` or set via `--set` flag during installation.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
||||
| **Global** | | |
|
||||
| `global.imageRegistry` | Global Docker image registry | `nil` |
|
||||
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `global.storageClass` | Global storage class for dynamic provisioning | `nil` |
|
||||
| `global.postgresql.existingSecret` | Name of existing secret to use for PostgreSQL passwords (overrides `postgresql.existingSecret`) | `nil` |
|
||||
| `global.postgresql.username` | PostgreSQL username (overrides `postgresql.username`) | `nil` |
|
||||
| `global.postgresql.password` | PostgreSQL password (overrides `postgresql.password`) | `nil` |
|
||||
| `global.postgresql.database` | PostgreSQL database (overrides `postgresql.database`) | `nil` |
|
||||
| `global.postgresql.repmgrUsername` | PostgreSQL repmgr username (overrides `postgresql.repmgrUsername`) | `nil` |
|
||||
| `global.postgresql.repmgrPassword` | PostgreSQL repmgr password (overrides `postgresql.repmgrpassword`) | `nil` |
|
||||
| `global.postgresql.repmgrDatabase` | PostgreSQL repmgr database (overrides `postgresql.repmgrDatabase`) | `nil` |
|
||||
| `global.ldap.existingSecret` | Name of existing secret to use for LDAP passwords (overrides `ldap.existingSecret`) | `nil` |
|
||||
| `global.ldap.bindpw` | LDAP bind password (overrides `ldap.bindpw`) | `nil` |
|
||||
| `global.pgpool.adminUsername` | Pgpool Admin username (overrides `pgpool.adminUsername`) | `nil` |
|
||||
| `global.pgpool.adminPassword` | Pgpool Admin password (overrides `pgpool.adminPassword`) | `nil` |
|
||||
| **General** | | |
|
||||
| `nameOverride` | String to partially override postgres-ha.fullname template with a string | `nil` |
|
||||
| `fullnameOverride` | String to fully override postgres-ha.fullname template with a string | `nil` |
|
||||
| **PostgreSQL with Repmgr** | | |
|
||||
| `postgresqlImage.registry` | Registry for PostgreSQL with Repmgr image | `docker.io` |
|
||||
| `postgresqlImage.repository` | Repository for PostgreSQL with Repmgr image | `bitnami/postgresql-repmgr` |
|
||||
| `postgresqlImage.tag` | Tag for PostgreSQL with Repmgr image | `{TAG_NAME}` |
|
||||
| `postgresqlImage.pullPolicy` | PostgreSQL with Repmgr image pull policy | `IfNotPresent` |
|
||||
| `postgresqlImage.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `postgresqlImage.debug` | Specify if debug logs should be enabled | `false` |
|
||||
| `postgresql.replicaCount` | The number of replicas to deploy | `2` |
|
||||
| `postgresql.updateStrategyType` | Statefulset update strategy policy | `RollingUpdate` |
|
||||
| `postgresql.antiAffinity` | Pod anti-affinity policy | `soft` |
|
||||
| `postgresql.nodeAffinity` | Node affinity policy | `{}` (The value is evaluated as a template) |
|
||||
| `postgresql.nodeSelector` | Node labels for pod assignment | `{}` (The value is evaluated as a template) |
|
||||
| `postgresql.tolerations` | Tolerations for pod assignment | `[]` (The value is evaluated as a template) |
|
||||
| `postgresql.securityContext.enabled` | Enable security context for PostgreSQL with Repmgr | `true` |
|
||||
| `postgresql.securityContext.fsGroup` | Group ID for the PostgreSQL with Repmgr filesystem | `1001` |
|
||||
| `postgresql.securityContext.runAsUser` | User ID for the PostgreSQL with Repmgr container | `1001` |
|
||||
| `postgresql.resources` | The [resources] to allocate for container | `{}` |
|
||||
| `postgresql.livenessProbe` | Liveness probe configuration for PostgreSQL with Repmgr | `Check values.yaml file` |
|
||||
| `postgresql.readinessProbe` | Readiness probe configuration for PostgreSQL with Repmgr | `Check values.yaml file` |
|
||||
| `postgresql.pdb.create` | If true, create a pod disruption budget for PostgreSQL with Repmgr pods | `false` |
|
||||
| `postgresql.pdb.minAvailable` | Minimum number / percentage of pods that should remain scheduled | `1` |
|
||||
| `postgresql.pdb.maxUnavailable` | Maximum number / percentage of pods that may be made unavailable | `nil` |
|
||||
| `postgresql.username` | PostgreSQL username | `postgres` |
|
||||
| `postgresql.password` | PostgreSQL password | `nil` |
|
||||
| `postgresql.database` | PostgreSQL database | `nil` |
|
||||
| `postgresql.pgHbaTrustAll` | Configures PostgreSQL HBA to trust every user | `false` |
|
||||
| `postgresql.repmgrUsername` | PostgreSQL repmgr username | `repmgr` |
|
||||
| `postgresql.repmgrPassword` | PostgreSQL repmgr password | `nil` |
|
||||
| `postgresql.repmgrDatabase` | PostgreSQL repmgr database | `repmgr` |
|
||||
| `postgresql.repmgrLogLevel` | Repmgr log level (DEBUG, INFO, NOTICE, WARNING, ERROR, ALERT, CRIT or EMERG) | `NOTICE` |
|
||||
| `postgresql.repmgrConnectTimeout` | Repmgr backend connection timeout (in seconds) | `5` |
|
||||
| `postgresql.repmgrReconnectAttempts` | Repmgr backend reconnection attempts | `3` |
|
||||
| `postgresql.repmgrReconnectInterval` | Repmgr backend reconnection interval (in seconds) | `5` |
|
||||
| `postgresql.repmgrConfiguration` | Repmgr Configuration | `nil` |
|
||||
| `postgresql.configuration` | PostgreSQL Configuration | `nil` |
|
||||
| `postgresql.pgHbaConfiguration` | Content of pg\_hba.conf | `nil (do not create pg_hba.conf)` |
|
||||
| `postgresql.configurationCM` | ConfigMap with the PostgreSQL configuration files (Note: Overrides `postgresql.repmgrConfiguration`, `postgresql.configuration` and `postgresql.pgHbaConfiguration`) | `nil` (The value is evaluated as a template) |
|
||||
| `postgresql.extendedConf` | Extended PostgreSQL Configuration (appended to main or default configuration) | `nil` |
|
||||
| `postgresql.extendedConfCM` | ConfigMap with the extended PostgreSQL configuration files (Note: Overrides `postgresql.extendedConf`) | `nil` (The value is evaluated as a template) |
|
||||
| `postgresql.initdbScripts` | Dictionary of initdb scripts | `nil` |
|
||||
| `postgresql.initdbScriptsCM` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`) | `nil` (The value is evaluated as a template) |
|
||||
| **Pgpool** | | |
|
||||
| `pgpoolImage.registry` | Registry for Pgpool | `docker.io` |
|
||||
| `pgpoolImage.repository` | Repository for Pgpool | `bitnami/pgpool` |
|
||||
| `pgpoolImage.tag` | Tag for Pgpool | `{TAG_NAME}` |
|
||||
| `pgpoolImage.pullPolicy` | Pgpool image pull policy | `IfNotPresent` |
|
||||
| `pgpoolImage.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `pgpoolImage.debug` | Specify if debug logs should be enabled | `false` |
|
||||
| `pgpool.replicaCount` | The number of replicas to deploy | `2` |
|
||||
| `pgpool.antiAffinity` | Pod anti-affinity policy | `soft` |
|
||||
| `pgpool.nodeAffinity` | Node affinity policy | `{}` (The value is evaluated as a template) |
|
||||
| `pgpool.nodeSelector` | Node labels for pod assignment | `{}` (The value is evaluated as a template) |
|
||||
| `pgpool.tolerations` | Tolerations for pod assignment | `[]` (The value is evaluated as a template) |
|
||||
| `pgpool.securityContext.enabled` | Enable security context for Pgpool | `true` |
|
||||
| `pgpool.securityContext.fsGroup` | Group ID for the Pgpool filesystem | `0` |
|
||||
| `pgpool.securityContext.runAsUser` | User ID for the Pgpool container | `0` |
|
||||
| `pgpool.resources` | The [resources] to allocate for container | `{}` |
|
||||
| `pgpool.livenessProbe` | Liveness probe configuration for Pgpool | `Check values.yaml file` |
|
||||
| `pgpool.readinessProbe` | Readiness probe configuration for Pgpool | `Check values.yaml file` |
|
||||
| `pgpool.pdb.create` | If true, create a pod disruption budget for Pgpool pods. | `false` |
|
||||
| `pgpool.pdb.minAvailable` | Minimum number / percentage of pods that should remain scheduled | `1` |
|
||||
| `pgpool.pdb.maxUnavailable` | Maximum number / percentage of pods that may be made unavailable | `nil` |
|
||||
| `pgpool.adminUsername` | Pgpool Admin username | `admin` |
|
||||
| `pgpool.adminPassword` | Pgpool Admin password | `nil` |
|
||||
| **LDAP** | | |
|
||||
| `ldap.enabled` | Enable LDAP support | `false` |
|
||||
| `ldap.existingSecret` | Name of existing secret to use for LDAP passwords | `nil` |
|
||||
| `ldap.uri` | LDAP URL beginning in the form `ldap[s]://<hostname>:<port>` | `nil` |
|
||||
| `ldap.base` | LDAP base DN | `nil` |
|
||||
| `ldap.binddn` | LDAP bind DN | `nil` |
|
||||
| `ldap.bindpw` | LDAP bind password | `nil` |
|
||||
| `ldap.bslookup` | LDAP base lookup | `nil` |
|
||||
| `ldap.scope` | LDAP search scope | `nil` |
|
||||
| `ldap.tlsReqcert` | LDAP TLS check on server certificates | `nil` |
|
||||
| `ldap.nssInitgroupsIgnoreusers` | LDAP ignored users | `root,nslcd` |
|
||||
| **Prometheus metrics** | | |
|
||||
| `metricsImage.registry` | Registry for PostgreSQL Prometheus exporter | `docker.io` |
|
||||
| `metricsImage.repository` | Repository for PostgreSQL Prometheus exporter | `bitnami/postgres-exporter` |
|
||||
| `metricsImage.tag` | Tag for PostgreSQL Prometheus exporter | `{TAG_NAME}` |
|
||||
| `metricsImage.pullPolicy` | PostgreSQL Prometheus exporter image pull policy | `IfNotPresent` |
|
||||
| `metricsImage.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `metricsImage.debug` | Specify if debug logs should be enabled | `false` |
|
||||
| `metrics.securityContext.enabled` | Enable security context for PostgreSQL Prometheus exporter | `true` |
|
||||
| `metrics.securityContext.runAsUser` | User ID for the PostgreSQL Prometheus exporter container | `1001` |
|
||||
| `metrics.resources` | The [resources] to allocate for container | `{}` |
|
||||
| `metrics.livenessProbe` | Liveness probe configuration for PostgreSQL Prometheus exporter | `Check values.yaml file` |
|
||||
| `metrics.readinessProbe` | Readiness probe configuration for PostgreSQL Prometheus exporter | `Check values.yaml file` |
|
||||
| `metrics.annotations` | Annotations for PostgreSQL Prometheus exporter service | `{prometheus.io/scrape: "true", prometheus.io/port: "9187"}` |
|
||||
| `metrics.serviceMonitor.enabled` | if `true`, creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` |
|
||||
| `metrics.serviceMonitor.namespace` | Optional namespace which Prometheus is running in | `nil` |
|
||||
| `metrics.serviceMonitor.interval` | How frequently to scrape metrics (use by default, falling back to Prometheus' default) | `nil` |
|
||||
| `metrics.serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{prometheus: "kube-prometheus"}` |
|
||||
| **Init Container to adapt volume permissions** | | |
|
||||
| `volumePermissionsImage.registry` | Registry for Bitnami Minideb | `docker.io` |
|
||||
| `volumePermissionsImage.repository` | Repository for Bitnami Minideb | `bitnami/minideb` |
|
||||
| `volumePermissionsImage.tag` | Tag for Bitnami Minideb | `latest` |
|
||||
| `volumePermissionsImage.pullPolicy` | Bitnami Minideb exporter image pull policy | `Always` |
|
||||
| `volumePermissionsImage.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `volumePermissions.enabled` | Enable init container to adapt volume permissions | `false` |
|
||||
| `volumePermissions.securityContext.enabled` | Enable security context for Bitnami Minideb | `true` |
|
||||
| `volumePermissions.securityContext.runAsUser` | User ID for the Bitnami Minideb container | `0` |
|
||||
| **Persistence** | | |
|
||||
| `persistence.enabled` | Enable data persistence | `true` |
|
||||
| `persistence.existingClaim` | Use a existing PVC which must be created manually before bound | `nil` |
|
||||
| `persistence.storageClass` | Specify the `storageClass` used to provision the volume | `nil` |
|
||||
| `persistence.mountPath` | Path to mount data volume at | `nil` |
|
||||
| `persistence.accessMode` | Access mode of data volume | `ReadWriteOnce` |
|
||||
| `persistence.size` | Size of data volume | `8Gi` |
|
||||
| `persistence.annotations` | Persistent Volume Claim annotations | `{}` |
|
||||
| **Expose** | | |
|
||||
| `service.type` | Kubernetes service type (`ClusterIP`, `NodePort` or `LoadBalancer`) | `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` |
|
||||
| `service.loadBalancerSourceRanges` | Address that are allowed when service is LoadBalancer | `[]` |
|
||||
| `service.clusterIP` | Static clusterIP or None for headless services | `nil` |
|
||||
| `ingress.enabled` | Enable ingress controller resource | `false` |
|
||||
| `ingress.certManager` | Add annotations for cert-manager | `false` |
|
||||
| `ingress.annotations` | Ingress annotations | `[]` |
|
||||
| `ingress.hosts[0].name` | Hostname for PostgreSQL service | `postgresql.local` |
|
||||
| `ingress.hosts[0].path` | Path within the url structure | `/` |
|
||||
| `ingress.tls[0].hosts[0]` | TLS hosts | `postgresql.local` |
|
||||
| `ingress.tls[0].secretName` | TLS Secret (certificates) | `postgresql.local-tls` |
|
||||
| `ingress.secrets[0].name` | TLS Secret Name | `nil` |
|
||||
| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` |
|
||||
| `ingress.secrets[0].key` | TLS Secret Key | `nil` |
|
||||
| `networkPolicy.enabled` | Enable NetworkPolicy | `false` |
|
||||
| `networkPolicy.allowExternal` | Don't require client label for connections | `true` |
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```console
|
||||
$ helm install --name my-release \
|
||||
--set postgresql.password=password \
|
||||
bitnami/postgresql-ha
|
||||
```
|
||||
|
||||
The above command sets the password for user `postgres` to `password`.
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
|
||||
|
||||
```console
|
||||
$ helm install --name my-release -f values.yaml bitnami/postgresql-ha
|
||||
```
|
||||
|
||||
### Change PostgreSQL version
|
||||
|
||||
To modify the PostgreSQL version used in this chart you can specify a [valid image tag](https://hub.docker.com/r/bitnami/postgresql/tags/) using the `--set image.tag` argument to `helm install`. For example,
|
||||
|
||||
```console
|
||||
$ helm install --name my-release --set image.tag=9.6.15-centos-7-r9 bitnami/postgresql-ha
|
||||
```
|
||||
|
||||
### Horizontal scaling
|
||||
|
||||
To horizontally scale this chart once it has been deployed:
|
||||
|
||||
```console
|
||||
$ helm upgrade my-release bitnami/postgresql-ha \
|
||||
--set postgresql.password=[POSTGRESQL_PASSWORD] \
|
||||
--set postgresql.repmgrPassword=[REPMGR_PASSWORD] \
|
||||
--set postgresql.replicaCount=5
|
||||
```
|
||||
|
||||
> Note: Scaling the statefulset with `kubectl scale ...` command is highly discouraged. Use `helm upgrade ...` for horizontal scaling so you ensure all the environment variables used to configure the PostgreSQL HA cluster are properly updated.
|
||||
|
||||
> Note: you need to substitute the placeholders _[POSTGRESQL_PASSWORD]_, and _[REPMGR_PASSWORD]_ with the values obtained from instructions in the installation notes.
|
||||
|
||||
### Configure the way how to expose PostgreSQL
|
||||
|
||||
- **Ingress**: The ingress controller must be installed in the Kubernetes cluster. Set `ingress.enabled=true` to expose PostgreSQL through Ingress.
|
||||
- **ClusterIP**: Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster. Set `service.type=ClusterIP` to choose this service type.
|
||||
- **NodePort**: Exposes the service on each Node's IP at a static port (the NodePort). You’ll be able to contact the NodePort service, from outside the cluster, by requesting `NodeIP:NodePort`. Set `service.type=NodePort` to choose this service type.
|
||||
- **LoadBalancer**: Exposes the service externally using a cloud provider's load balancer. Set `service.type=LoadBalancer` to choose this service type.
|
||||
|
||||
### Adjust permissions of persistent volume mountpoint
|
||||
|
||||
As the images run as non-root by default, it is necessary to adjust the ownership of the persistent volumes so that the containers can write data into it.
|
||||
|
||||
By default, the chart is configured to use Kubernetes Security Context to automatically change the ownership of the volume. However, this feature does not work in all Kubernetes distributions.
|
||||
As an alternative, this chart supports using an initContainer to change the ownership of the volume before mounting it in the final destination.
|
||||
|
||||
You can enable this initContainer by setting `volumePermissions.enabled` to `true`.
|
||||
|
||||
### LDAP
|
||||
|
||||
LDAP support can be enabled in the chart by specifying the `ldap.` parameters while creating a release. The following parameters should be configured to properly enable the LDAP support in the chart.
|
||||
|
||||
- **ldap.enabled**: Enable LDAP support. Defaults to `false`.
|
||||
- **ldap.uri**: LDAP URL beginning in the form `ldap[s]://<hostname>:<port>`. No defaults.
|
||||
- **ldap.base**: LDAP base DN. No defaults.
|
||||
- **ldap.binddn**: LDAP bind DN. No defaults.
|
||||
- **ldap.bindpw**: LDAP bind password. No defaults.
|
||||
- **ldap.bslookup**: LDAP base lookup. No defaults.
|
||||
- **ldap.nss_initgroups_ignoreusers**: LDAP ignored users. `root,nslcd`.
|
||||
- **ldap.scope**: LDAP search scope. No defaults.
|
||||
- **ldap.tls_reqcert**: LDAP TLS check on server certificates. No defaults.
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release bitnami/postgresql-ha \
|
||||
--set ldap.enabled="true" \
|
||||
--set ldap.uri="ldap://my_ldap_server" \
|
||||
--set ldap.base="dc=example\,dc=org" \
|
||||
--set ldap.binddn="cn=admin\,dc=example\,dc=org" \
|
||||
--set ldap.bindpw="admin" \
|
||||
--set ldap.bslookup="ou=group-ok\,dc=example\,dc=org" \
|
||||
--set ldap.nss_initgroups_ignoreusers="root\,nslcd" \
|
||||
--set ldap.scope="sub" \
|
||||
--set ldap.tls_reqcert="demand"
|
||||
```
|
||||
|
||||
Next, login to the PostgreSQL server using the `psql` client and add the PAM authenticated LDAP users.
|
||||
|
||||
> Note: Parameters including commas must be escaped as shown in the above example. More information at: https://github.com/helm/helm/blob/master/docs/using_helm.md#the-format-and-limitations-of---set
|
||||
|
||||
### Production configuration
|
||||
|
||||
This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`:
|
||||
|
||||
- Enable Newtworkpolicy blocking external access:
|
||||
|
||||
```diff
|
||||
- networkPolicy.enabled: false
|
||||
+ networkPolicy.enabled: true
|
||||
- networkPolicy.allowExternal: true
|
||||
+ networkPolicy.allowExternal: false
|
||||
```
|
||||
|
||||
- Start a side-car prometheus exporter:
|
||||
|
||||
```diff
|
||||
- metrics.enabled: false
|
||||
+ metrics.enabled: true
|
||||
```
|
||||
|
||||
### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/)
|
||||
|
||||
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
|
||||
|
||||
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
|
||||
|
||||
### repmgr.conf / postgresql.conf / pg_hba.conf files as configMap
|
||||
|
||||
This helm chart also supports to customize the whole configuration file.
|
||||
|
||||
Add your custom files to "files" in your working directory. Those files will be mounted as configMap to the containers and it will be used for configuring Repmgr and the PostgreSQL server.
|
||||
|
||||
Alternatively, you can specify the PostgreSQL and Repmgr configuration using the `postgresql.configuration`, `postgresql.pgHbaConfiguration`, and `postgresql.repmgrConfiguration` parameters.
|
||||
|
||||
In addition to these options, you can also set an external ConfigMap with all the configuration files. This is done by setting the `postgresql.configurationCM` 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 specify the extended configuration using the `postgresql.extendedConf` parameter.
|
||||
|
||||
In addition to these options, you can also set an external ConfigMap with all the extra configuration files. This is done by setting the `postgresql.extendedConfCM` parameter. Note that this will override the two previous options.
|
||||
|
||||
## Initialize a fresh instance
|
||||
|
||||
The [Bitnami PostgreSQL with Repmgr](https://github.com/bitnami/bitnami-docker-postgresql-repmgr) 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 `postgresql.initdbScriptsCM` parameter. Note that this will override the two previous options. If your initialization scripts contain sensitive information such as credentials or passwords, you can use the `initdbScriptsSecret` parameter.
|
||||
|
||||
The allowed extensions are `.sh`, `.sql` and `.sql.gz`.
|
||||
|
||||
## Persistence
|
||||
|
||||
The data is persisted by default using PVC templates in the PostgreSQL statefulset. You can disable the persistence setting the `persistence.enabled` parameter to `false`.
|
||||
A default `StorageClass` is needed in the Kubernetes cluster to dynamically provision the volumes. Specify another StorageClass in the `persistence.storageClass` or set `persistence.existingClaim` if you have already existing persistent volumes to use.
|
||||
|
||||
## Use of global variables
|
||||
|
||||
In more complex scenarios, we may have the following tree of dependencies
|
||||
|
||||
```
|
||||
+--------------+
|
||||
| |
|
||||
+------------+ Chart 1 +-----------+
|
||||
| | | |
|
||||
| --------+------+ |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
v v v
|
||||
+-------+------+ +--------+------+ +--------+------+
|
||||
| | | | | |
|
||||
|PostgreSQL HA | | Sub-chart 1 | | Sub-chart 2 |
|
||||
| | | | | |
|
||||
+--------------+ +---------------+ +---------------+
|
||||
```
|
||||
|
||||
The three charts below depend on the parent chart Chart 1. However, subcharts 1 and 2 may need to connect to PostgreSQL HA as well. In order to do so, subcharts 1 and 2 need to know the PostgreSQL HA credentials, so one option for deploying could be:
|
||||
|
||||
```bash
|
||||
$ helm install chart1 --set postgresql.password=testtest --set subchart1.postgresql.password=testtest --set subchart2.postgresql.password=testtest --set postgresql.database=db1 --set subchart1.postgresql.database=db1 --set subchart1.postgresql.database=db1
|
||||
```
|
||||
|
||||
If the number of dependent sub-charts increases, executing `helm install` can become increasingly difficult. An alternative would be to set the credentials using global variables as follows:
|
||||
|
||||
```bash
|
||||
$ helm install chart1 --set global.postgresql.password=testtest --set global.postgresql.database=db1
|
||||
```
|
||||
|
||||
This way, the credentials will be available in all of the subcharts.
|
||||
|
||||
## Upgrade
|
||||
|
||||
It's necessary to specify the existing passwords while performing a upgrade to ensure the secrets are not updated with invalid randomly generated passwords. Remember to specify the existing values of the `postgresql.password` and `postgresql.repmgrPassword` parameters when upgrading the chart:
|
||||
|
||||
```bash
|
||||
$ helm upgrade my-release bitnami/postgresql-ha \
|
||||
--set postgresql.password=[POSTGRESQL_PASSWORD] \
|
||||
--set postgresql.repmgrPassword=[REPMGR_PASSWORD]
|
||||
```
|
||||
|
||||
> Note: you need to substitute the placeholders _[POSTGRESQL_PASSWORD]_, and _[REPMGR_PASSWORD]_ with the values obtained from instructions in the installation notes.
|
||||
|
||||
## 0.4.0
|
||||
|
||||
In this version, the chart will use PostgreSQL-Repmgr container images with the Postgis extension included. The version used in Postgresql version 10, 11 and 12 is Postgis 2.5, and in Pôstgresql 9.6 is Postgis 2.3.
|
||||
Postgis has been compiled with the following dependencies:
|
||||
|
||||
- protobuf
|
||||
- protobuf-c
|
||||
- json-c
|
||||
- geos
|
||||
- proj
|
||||
- gdal
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Copy here your postgresql.conf and/or pg_hba.conf files to use it as a config map.
|
||||
@@ -0,0 +1,4 @@
|
||||
If you don't want to provide the whole configuration file and only specify certain parameters, you can copy here your extended `.conf` files.
|
||||
These files will be injected as a config maps and add/overwrite the default configuration using the `include_dir` directive that allows settings to be loaded from files other than the default `postgresql.conf`.
|
||||
|
||||
More info in the [bitnami-docker-postgresql-repmgr README](https://github.com/bitnami/bitnami-docker-postgresql#configuration-file).
|
||||
@@ -0,0 +1,3 @@
|
||||
You can copy here your custom `.sh`, `.sql` or `.sql.gz` file so they are executed during the first boot of the image.
|
||||
|
||||
More info in the [bitnami-docker-postgresql-repmgr](https://github.com/bitnami/bitnami-docker-postgresql-repmgr#initializing-a-new-instance) repository.
|
||||
@@ -0,0 +1,60 @@
|
||||
** Please be patient while the chart is being deployed **
|
||||
|
||||
PostgreSQL can be accessed through Pgpool via port {{ .Values.service.port }} on the following DNS name from within your cluster:
|
||||
|
||||
{{ include "postgresql-ha.pgpool" . }}.{{ .Release.Namespace }}.svc.cluster.local
|
||||
|
||||
Pgpool acts as a load balancer for PostgreSQL and forward read/write connections to the primary node while read-only connections are forwarded to standby nodes.
|
||||
|
||||
To get the password for {{ (include "postgresql-ha.postgresqlUsername" .) | quote }} run:
|
||||
|
||||
export POSTGRES_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "postgresql-ha.postgresqlSecretName" . }} -o jsonpath="{.data.postgresql-password}" | base64 --decode)
|
||||
|
||||
To get the password for {{ (include "postgresql-ha.postgresqlRepmgrUsername" .) | quote }} run:
|
||||
|
||||
export REPMGR_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "postgresql-ha.postgresqlSecretName" . }} -o jsonpath="{.data.repmgr-password}" | base64 --decode)
|
||||
|
||||
To connect to your database run the following command:
|
||||
|
||||
kubectl run {{ include "postgresql-ha.fullname" . }}-client --rm --tty -i --restart='Never' --namespace {{ .Release.Namespace }} --image bitnami/postgresql:10 --env="PGPASSWORD=$POSTGRES_PASSWORD" {{ if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}--labels="{{ include "postgresql-ha.fullname" . }}-client=true" {{- end }} \
|
||||
--command -- psql -h {{ include "postgresql-ha.pgpool" . }} -p {{ .Values.service.port }} -U {{ include "postgresql-ha.postgresqlUsername" . }}{{- if not (empty (include "postgresql-ha.postgresqlDatabase" .)) }} -d {{ include "postgresql-ha.postgresqlDatabase" . }}{{- end }}
|
||||
|
||||
{{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
|
||||
|
||||
Note: Since NetworkPolicy is enabled, only pods with label "{{ include "postgresql-ha.fullname" . }}-client=true" will be able to connect to this PostgreSQL cluster.
|
||||
|
||||
{{- end }}
|
||||
|
||||
To connect to your database from outside the cluster execute the following commands:
|
||||
|
||||
{{- if .Values.ingress.enabled }}
|
||||
|
||||
You should be able to access your new PostgreSQL server through:
|
||||
|
||||
{{- range .Values.ingress.hosts }}
|
||||
{{ if .tls }}https{{ else }}http{{ end }}://{{ .name }}
|
||||
{{- end }}
|
||||
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "postgresql-ha.pgpool" . }}
|
||||
PGPASSWORD="$POSTGRES_PASSWORD" psql -h $NODE_IP -p $NODE_PORT -U {{ include "postgresql-ha.postgresqlUsername" . }}{{- if not (empty (include "postgresql-ha.postgresqlDatabase" .)) }} -d {{ include "postgresql-ha.postgresqlDatabase" . }}{{- end }}
|
||||
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "postgresql-ha.pgpool" . }}
|
||||
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "postgresql-ha.pgpool" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
PGPASSWORD="$POSTGRES_PASSWORD" psql -h $SERVICE_IP -p {{ .Values.service.port }} -U {{ include "postgresql-ha.postgresqlUsername" . }}{{- if not (empty (include "postgresql-ha.postgresqlDatabase" .)) }} -d {{ include "postgresql-ha.postgresqlDatabase" . }}{{- end }}
|
||||
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
|
||||
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "postgresql-ha.pgpool" . }} {{ .Values.service.port }}:{{ .Values.service.port }} &
|
||||
psql -h 127.0.0.1 -p {{ .Values.service.port }} -U {{ include "postgresql-ha.postgresqlUsername" . }}{{- if not (empty (include "postgresql-ha.postgresqlDatabase" .)) }} -d {{ include "postgresql-ha.postgresqlDatabase" . }}{{- end }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- include "postgresql-ha.validateValues" . }}
|
||||
{{- include "postgresql-ha.checkRollingTags" . }}
|
||||
@@ -0,0 +1,694 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "postgresql-ha.labels" -}}
|
||||
app.kubernetes.io/name: {{ template "postgresql-ha.name" . }}
|
||||
helm.sh/chart: {{ template "postgresql-ha.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
|
||||
*/}}
|
||||
{{- define "postgresql-ha.matchLabels" -}}
|
||||
app.kubernetes.io/name: {{ template "postgresql-ha.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Fully qualified app name for PostgreSQL
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresql" -}}
|
||||
{{- printf "%s-postgresql" (include "postgresql-ha.fullname" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Fully qualified app name for Pgpool
|
||||
*/}}
|
||||
{{- define "postgresql-ha.pgpool" -}}
|
||||
{{- printf "%s-pgpool" (include "postgresql-ha.fullname" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Fully qualified app name for LDAP
|
||||
*/}}
|
||||
{{- define "postgresql-ha.ldap" -}}
|
||||
{{- printf "%s-ldap" (include "postgresql-ha.fullname" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper PostgreSQL image name
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlImage" -}}
|
||||
{{- $registryName := .Values.postgresqlImage.registry -}}
|
||||
{{- $repositoryName := .Values.postgresqlImage.repository -}}
|
||||
{{- $tag := .Values.postgresqlImage.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Pgpool image name
|
||||
*/}}
|
||||
{{- define "postgresql-ha.pgpoolImage" -}}
|
||||
{{- $registryName := .Values.pgpoolImage.registry -}}
|
||||
{{- $repositoryName := .Values.pgpoolImage.repository -}}
|
||||
{{- $tag := .Values.pgpoolImage.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper PostgreSQL Prometheus exporter image name
|
||||
*/}}
|
||||
{{- define "postgresql-ha.volumePermissionsImage" -}}
|
||||
{{- $registryName := .Values.volumePermissionsImage.registry -}}
|
||||
{{- $repositoryName := .Values.volumePermissionsImage.repository -}}
|
||||
{{- $tag := .Values.volumePermissionsImage.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper PostgreSQL Prometheus exporter image name
|
||||
*/}}
|
||||
{{- define "postgresql-ha.metricsImage" -}}
|
||||
{{- $registryName := .Values.metricsImage.registry -}}
|
||||
{{- $repositoryName := .Values.metricsImage.repository -}}
|
||||
{{- $tag := .Values.metricsImage.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names
|
||||
*/}}
|
||||
{{- define "postgresql-ha.imagePullSecrets" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
|
||||
Also, we can not use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.global.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end -}}
|
||||
{{- else if or .Values.postgresqlImage.pullSecrets .Values.pgpoolImage.pullSecrets .Values.volumePermissionsImage.pullSecrets .Values.metricsImage.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.postgresqlImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end -}}
|
||||
{{- range .Values.pgpoolImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end -}}
|
||||
{{- range .Values.volumePermissionsImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end -}}
|
||||
{{- range .Values.metricsImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else if or .Values.postgresqlImage.pullSecrets .Values.pgpoolImage.pullSecrets .Values.volumePermissionsImage.pullSecrets .Values.metricsImage.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.postgresqlImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end -}}
|
||||
{{- range .Values.pgpoolImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end -}}
|
||||
{{- range .Values.volumePermissionsImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end -}}
|
||||
{{- range .Values.metricsImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the PostgreSQL username
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlUsername" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.postgresql }}
|
||||
{{- if .Values.global.postgresql.username }}
|
||||
{{- .Values.global.postgresql.username -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.username -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.username -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.username -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the PostgreSQL password
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlPassword" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.postgresql }}
|
||||
{{- if .Values.global.postgresql.password }}
|
||||
{{- .Values.global.postgresql.password -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.postgresql.password (empty .Values.postgresql.password) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.postgresql.password (empty .Values.postgresql.password) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.postgresql.password (empty .Values.postgresql.password) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the Pgpool Admin username
|
||||
*/}}
|
||||
{{- define "postgresql-ha.pgpoolAdminUsername" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.pgpool }}
|
||||
{{- if .Values.global.pgpool.adminUsername }}
|
||||
{{- .Values.global.pgpool.adminUsername -}}
|
||||
{{- else -}}
|
||||
{{- .Values.pgpool.adminUsername -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.pgpool.adminUsername -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.pgpool.adminUsername -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the Pgpool Admin password
|
||||
*/}}
|
||||
{{- define "postgresql-ha.pgpoolAdminPassword" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.pgpool }}
|
||||
{{- if .Values.global.pgpool.adminPassword }}
|
||||
{{- .Values.global.pgpool.adminPassword -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.pgpool.adminPassword (empty .Values.pgpool.adminPassword) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.pgpool.adminPassword (empty .Values.pgpool.adminPassword) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.pgpool.adminPassword (empty .Values.pgpool.adminPassword) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the PostgreSQL database to create
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlDatabase" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.postgresql }}
|
||||
{{- if .Values.global.postgresql.database }}
|
||||
{{- .Values.global.postgresql.database -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.database -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.database -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.database -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the PostgreSQL repmgr username
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlRepmgrUsername" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.postgresql }}
|
||||
{{- if .Values.global.postgresql.repmgrUsername }}
|
||||
{{- .Values.global.postgresql.repmgrUsername -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.repmgrUsername -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.repmgrUsername -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.repmgrUsername -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the PostgreSQL repmgr password
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlRepmgrPassword" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.postgresql }}
|
||||
{{- if .Values.global.postgresql.repmgrPassword }}
|
||||
{{- .Values.global.postgresql.repmgrPassword -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.postgresql.repmgrPassword (empty .Values.postgresql.repmgrPassword) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.postgresql.repmgrPassword (empty .Values.postgresql.repmgrPassword) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.postgresql.repmgrPassword (empty .Values.postgresql.repmgrPassword) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the database to use for repmgr
|
||||
*/}}
|
||||
{{- define "postgresql-ha.repmgrDatabase" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.postgresql }}
|
||||
{{- if .Values.global.postgresql.repmgrDatabase }}
|
||||
{{- .Values.global.postgresql.repmgrDatabase -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.repmgrDatabase -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.repmgrDatabase -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresql.repmgrDatabase -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return true if a secret object should be created for PostgreSQL
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlCreateSecret" -}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.postgresql }}
|
||||
{{- if .Values.global.postgresql.existingSecret }}
|
||||
{{- else if (not .Values.postgresql.existingSecret) -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- else if (not .Values.postgresql.existingSecret) -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- else if (not .Values.postgresql.existingSecret) -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the PostgreSQL credentials secret.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlSecretName" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.postgresql }}
|
||||
{{- if .Values.global.postgresql.existingSecret }}
|
||||
{{- printf "%s" .Values.global.postgresql.existingSecret -}}
|
||||
{{- else if .Values.postgresql.existingSecret -}}
|
||||
{{- printf "%s" .Values.postgresql.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql-ha.postgresql" .) -}}
|
||||
{{- end -}}
|
||||
{{- else if .Values.postgresql.existingSecret -}}
|
||||
{{- printf "%s" .Values.postgresql.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql-ha.postgresql" .) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Values.postgresql.existingSecret -}}
|
||||
{{- printf "%s" .Values.postgresql.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql-ha.postgresql" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return true if a secret object should be created for Pgpool
|
||||
*/}}
|
||||
{{- define "postgresql-ha.pgpoolCreateSecret" -}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.pgpool }}
|
||||
{{- if .Values.global.pgpool.existingSecret }}
|
||||
{{- else if (not .Values.pgpool.existingSecret) -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- else if (not .Values.pgpool.existingSecret) -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- else if (not .Values.pgpool.existingSecret) -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the Pgpool credentials secret.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.pgpoolSecretName" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.pgpool }}
|
||||
{{- if .Values.global.pgpool.existingSecret }}
|
||||
{{- printf "%s" .Values.global.pgpool.existingSecret -}}
|
||||
{{- else if .Values.pgpool.existingSecret -}}
|
||||
{{- printf "%s" .Values.pgpool.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql-ha.pgpool" .) -}}
|
||||
{{- end -}}
|
||||
{{- else if .Values.pgpool.existingSecret -}}
|
||||
{{- printf "%s" .Values.pgpool.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql-ha.pgpool" .) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Values.pgpool.existingSecret -}}
|
||||
{{- printf "%s" .Values.pgpool.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql-ha.pgpool" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the PostgreSQL configuration configmap.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlConfigurationCM" -}}
|
||||
{{- if .Values.postgresql.configurationCM -}}
|
||||
{{- printf "%s" (tpl .Values.postgresql.configurationCM $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-configuration" (include "postgresql-ha.postgresql" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the PostgreSQL extended configuration configmap.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlExtendedConfCM" -}}
|
||||
{{- if .Values.postgresql.extendedConfCM -}}
|
||||
{{- printf "%s" (tpl .Values.postgresql.extendedConfCM $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-extended-configuration" (include "postgresql-ha.postgresql" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the PostgreSQL initdb scripts configmap.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.postgresqlInitdbScriptsCM" -}}
|
||||
{{- if .Values.postgresql.initdbScriptsCM -}}
|
||||
{{- printf "%s" (tpl .Values.postgresql.initdbScriptsCM $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-initdb-scripts" (include "postgresql-ha.postgresql" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the LDAP bind password
|
||||
*/}}
|
||||
{{- define "postgresql-ha.ldapPassword" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.ldap }}
|
||||
{{- if .Values.global.ldap.bindpw }}
|
||||
{{- .Values.global.ldap.bindpw -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.ldap.bindpw (empty .Values.ldap.bindpw) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.ldap.bindpw (empty .Values.ldap.bindpw) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- ternary (randAlphaNum 10) .Values.ldap.bindpw (empty .Values.ldap.bindpw) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Return the LDAP credentials secret.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.ldapSecretName" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.ldap }}
|
||||
{{- if .Values.global.ldap.existingSecret }}
|
||||
{{- printf "%s" .Values.global.ldap.existingSecret -}}
|
||||
{{- else if .Values.ldap.existingSecret -}}
|
||||
{{- printf "%s" .Values.ldap.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql-ha.ldap" .) -}}
|
||||
{{- end -}}
|
||||
{{- else if .Values.ldap.existingSecret -}}
|
||||
{{- printf "%s" .Values.ldap.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql-ha.ldap" .) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Values.ldap.existingSecret -}}
|
||||
{{- printf "%s" .Values.ldap.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql-ha.ldap" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Storage Class
|
||||
*/}}
|
||||
{{- define "postgresql-ha.storageClass" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
|
||||
*/}}
|
||||
{{- if .Values.global -}}
|
||||
{{- if .Values.global.storageClass -}}
|
||||
{{- if (eq "-" .Values.global.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" .Values.global.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Values.persistence.storageClass -}}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" .Values.persistence.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Values.persistence.storageClass -}}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" .Values.persistence.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Check if there are rolling tags in the images */}}
|
||||
{{- define "postgresql-ha.checkRollingTags" -}}
|
||||
{{- if and (contains "bitnami/" .Values.postgresqlImage.repository) (not (.Values.postgresqlImage.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||
WARNING: Rolling tag detected ({{ .Values.postgresqlImage.repository }}:{{ .Values.postgresqlImage.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
|
||||
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/
|
||||
{{- end }}
|
||||
{{- if and (contains "bitnami/" .Values.pgpoolImage.repository) (not (.Values.pgpoolImage.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||
WARNING: Rolling tag detected ({{ .Values.pgpoolImage.repository }}:{{ .Values.pgpoolImage.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
|
||||
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/
|
||||
{{- end }}
|
||||
{{- if and (contains "bitnami/" .Values.metricsImage.repository) (not (.Values.metricsImage.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||
WARNING: Rolling tag detected ({{ .Values.metricsImage.repository }}:{{ .Values.metricsImage.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
|
||||
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for networkPolicy
|
||||
*/}}
|
||||
{{- define "postgresql-ha.networkPolicy.apiVersion" -}}
|
||||
{{- if semverCompare ">=1.4-0, <1.7-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
"extensions/v1beta1"
|
||||
{{- else if semverCompare "^1.7-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
"networking.k8s.io/v1"
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Compile all warnings into a single message, and call fail.
|
||||
*/}}
|
||||
{{- define "postgresql-ha.validateValues" -}}
|
||||
{{- $messages := list -}}
|
||||
{{- $messages := append $messages (include "postgresql-ha.validateValues.ldap" .) -}}
|
||||
{{- $messages := append $messages (include "postgresql-ha.validateValues.ldapPgHba" .) -}}
|
||||
{{- $messages := without $messages "" -}}
|
||||
{{- $message := join "\n" $messages -}}
|
||||
|
||||
{{- if $message -}}
|
||||
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Validate values of PostgreSQL HA - must provide mandatory LDAP paremeters when LDAP is enabled */}}
|
||||
{{- define "postgresql-ha.validateValues.ldap" -}}
|
||||
{{- if and .Values.ldap.enabled (or (empty .Values.ldap.uri) (empty .Values.ldap.base) (empty .Values.ldap.binddn) (empty .Values.ldap.bindpw)) -}}
|
||||
postgresql-ha: LDAP
|
||||
Invalid LDAP configuration. When enabling LDAP support, the parameters "ldap.uri",
|
||||
"ldap.base", "ldap.binddn", and "ldap.bindpw" are mandatory. Please provide them:
|
||||
|
||||
$ helm install --name {{ .Release.Name }} bitnami/postgresql-ha \
|
||||
--set ldap.enabled=true \
|
||||
--set ldap.uri="ldap://my_ldap_server" \
|
||||
--set ldap.base="dc=example\,dc=org" \
|
||||
--set ldap.binddn="cn=admin\,dc=example\,dc=org" \
|
||||
--set ldap.bindpw="admin"
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Validate values of PostgreSQL HA - PostgreSQL HBA configuration must trust every user when LDAP is enabled */}}
|
||||
{{- define "postgresql-ha.validateValues.ldapPgHba" -}}
|
||||
{{- if and .Values.ldap.enabled (not .Values.postgresql.pgHbaTrustAll) }}
|
||||
postgresql-ha: LDAP & pg_hba.conf
|
||||
PostgreSQL HBA configuration must trust every user when LDAP is enabled.
|
||||
Please configure HBA to trust every user (--set postgresql.pgHbaTrustAll=true)
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,10 @@
|
||||
{{- if .Values.ldap.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.ldap" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
bind-password: {{ (include "postgresql-ha.ldapPassword" .) | b64enc | quote }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,27 @@
|
||||
{{- if .Values.networkPolicy.enabled }}
|
||||
kind: NetworkPolicy
|
||||
apiVersion: {{ template "postgresql-ha.networkPolicy.apiVersion" . }}
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.fullname" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
ingress:
|
||||
# Allow inbound connections
|
||||
- ports:
|
||||
- port: 5432
|
||||
{{- if not .Values.networkPolicy.allowExternal }}
|
||||
from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
{{ template "postgresql-ha.fullname" . }}-client: "true"
|
||||
- podSelector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 12 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
{{- end }}
|
||||
# Allow prometheus scrapes
|
||||
- ports:
|
||||
- port: 9187
|
||||
{{- end }}
|
||||
@@ -0,0 +1,210 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.pgpool" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
spec:
|
||||
replicas: {{ .Values.pgpool.replicaCount }}
|
||||
selector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
template:
|
||||
metadata:
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
spec:
|
||||
{{- include "postgresql-ha.imagePullSecrets" . | indent 6 }}
|
||||
affinity:
|
||||
{{- if eq .Values.pgpool.antiAffinity "hard" }}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- topologyKey: "kubernetes.io/hostname"
|
||||
labelSelector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 18 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
{{- else if eq .Values.pgpool.antiAffinity "soft" }}
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 1
|
||||
podAffinityTerm:
|
||||
topologyKey: kubernetes.io/hostname
|
||||
labelSelector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 18 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
{{- end }}
|
||||
{{- if .Values.pgpool.nodeAffinity }}
|
||||
nodeAffinity: {{ toYaml .Values.pgpool.nodeAffinity | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.pgpool.nodeSelector }}
|
||||
nodeSelector: {{ tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.pgpool.tolerations }}
|
||||
tolerations: {{ tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.pgpool.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.pgpool.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: pgpool
|
||||
image: {{ include "postgresql-ha.pgpoolImage" . }}
|
||||
imagePullPolicy: {{ .Values.pgpoolImage.pullPolicy | quote }}
|
||||
{{- if .Values.pgpool.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.pgpool.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
# Auxiliar vars to populate environment variables
|
||||
{{- $postgresqlReplicaCount := int .Values.postgresql.replicaCount }}
|
||||
{{- $postgresqlFullname := include "postgresql-ha.postgresql" . }}
|
||||
{{- $postgresqlHeadlessServiceName := printf "%s-headless" (include "postgresql-ha.postgresql" .) }}
|
||||
{{- $releaseName := .Release.Namespace }}
|
||||
env:
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" .Values.pgpoolImage.debug | quote }}
|
||||
- name: PGPOOL_BACKEND_NODES
|
||||
value: {{range $e, $i := until $postgresqlReplicaCount }}{{ $i }}:{{ $postgresqlFullname }}-{{ $i }}.{{ $postgresqlHeadlessServiceName }}.{{ $releaseName }}.svc.cluster.local:5432,{{ end }}
|
||||
- name: PGPOOL_SR_CHECK_USER
|
||||
value: {{ (include "postgresql-ha.postgresqlRepmgrUsername" .) | quote }}
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: PGPOOL_SR_CHECK_PASSWORD_FILE
|
||||
value: "/opt/bitnami/pgpool/secrets/pgpool-sr-check-password"
|
||||
{{- else }}
|
||||
- name: PGPOOL_SR_CHECK_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "postgresql-ha.postgresqlSecretName" . }}
|
||||
key: repmgr-password
|
||||
{{- end }}
|
||||
- name: PGPOOL_ENABLE_LDAP
|
||||
value: {{ ternary "yes" "no" .Values.ldap.enabled | quote }}
|
||||
{{- if .Values.ldap.enabled }}
|
||||
- name: PGPOOL_LDAP_URI
|
||||
value: {{ .Values.ldap.uri | quote }}
|
||||
- name: PGPOOL_LDAP_BASE
|
||||
value: {{ .Values.ldap.base | quote }}
|
||||
- name: PGPOOL_LDAP_BIND_DN
|
||||
value: {{ .Values.ldap.binddn | quote }}
|
||||
- name: PGPOOL_LDAP_BIND_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "postgresql-ha.ldapSecretName" . }}
|
||||
key: bind-password
|
||||
{{- if .Values.ldap.bslookup }}
|
||||
- name: PGPOOL_LDAP_BASE_LOOKUP
|
||||
value: {{ .Values.ldap.bslookup | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.ldap.scope }}
|
||||
- name: PGPOOL_LDAP_SCOPE
|
||||
value: {{ .Values.ldap.scope | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.ldap.tlsReqcert }}
|
||||
- name: PGPOOL_LDAP_TLS_REQCERT
|
||||
value: {{ .Values.ldap.tlsReqcert | quote }}
|
||||
{{- end }}
|
||||
- name: PGPOOL_LDAP_NSS_INITGROUPS_IGNOREUSERS
|
||||
value: {{ .Values.ldap.nssInitgroupsIgnoreusers | quote }}
|
||||
{{- end }}
|
||||
- name: PGPOOL_POSTGRES_USERNAME
|
||||
value: {{ (include "postgresql-ha.postgresqlUsername" .) | quote }}
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: PGPOOL_POSTGRES_PASSWORD_FILE
|
||||
value: "/opt/bitnami/pgpool/secrets/pgpool-password"
|
||||
{{- else }}
|
||||
- name: PGPOOL_POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "postgresql-ha.postgresqlSecretName" . }}
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
- name: PGPOOL_ADMIN_USERNAME
|
||||
value: {{ (include "postgresql-ha.pgpoolAdminUsername" .) | quote }}
|
||||
{{- if .Values.pgpool.usePasswordFile }}
|
||||
- name: PGPOOL_ADMIN_PASSWORD_FILE
|
||||
value: "/opt/bitnami/pgpool/secrets/admin-password"
|
||||
{{- else }}
|
||||
- name: PGPOOL_ADMIN_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "postgresql-ha.pgpoolSecretName" . }}
|
||||
key: admin-password
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: postgresql
|
||||
containerPort: 5432
|
||||
protocol: TCP
|
||||
{{- if and .Values.pgpool.livenessProbe.enabled (not .Values.ldap.enabled) }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- bash
|
||||
- -ec
|
||||
- |
|
||||
if nodes=$(PGPASSWORD=${PGPOOL_POSTGRES_PASSWORD} psql -U {{ (include "postgresql-ha.postgresqlUsername" .) | quote }} {{- if not (empty (include "postgresql-ha.postgresqlDatabase" .)) }} -d {{ (include "postgresql-ha.postgresqlDatabase" .) | quote }}{{- end }} -h 127.0.0.1 -tA -c "show pool_nodes;" | grep "up" | wc -l); then
|
||||
if [[ $nodes -eq {{ $postgresqlReplicaCount }} ]]; then
|
||||
true
|
||||
else
|
||||
false
|
||||
fi
|
||||
else
|
||||
false
|
||||
fi
|
||||
initialDelaySeconds: {{ .Values.pgpool.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.pgpool.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.pgpool.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.pgpool.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.pgpool.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if and .Values.pgpool.readinessProbe.enabled (not .Values.ldap.enabled) }}
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- bash
|
||||
- -ec
|
||||
- |
|
||||
if nodes=$(PGPASSWORD=${PGPOOL_POSTGRES_PASSWORD} psql -U {{ (include "postgresql-ha.postgresqlUsername" .) | quote }} {{- if not (empty (include "postgresql-ha.postgresqlDatabase" .)) }} -d {{ (include "postgresql-ha.postgresqlDatabase" .) | quote }}{{- end }} -h 127.0.0.1 -tA -c "show pool_nodes;" | wc -l); then
|
||||
if [[ $nodes -eq {{ $postgresqlReplicaCount }} ]]; then
|
||||
true
|
||||
else
|
||||
false
|
||||
fi
|
||||
else
|
||||
false
|
||||
fi
|
||||
initialDelaySeconds: {{ .Values.pgpool.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.pgpool.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.pgpool.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.pgpool.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.pgpool.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.pgpool.resources }}
|
||||
resources: {{- toYaml .Values.pgpool.resources | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
mountPath: /opt/bitnami/pgpool/secrets/
|
||||
{{- end }}
|
||||
{{- if .Values.pgpool.usePasswordFile }}
|
||||
- name: pgpool-password
|
||||
mountPath: /opt/bitnami/pgpool/secrets/
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
secret:
|
||||
secretName: {{ include "postgresql-ha.postgresqlSecretName" . }}
|
||||
items:
|
||||
- key: postgresql-password
|
||||
path: pgpool-password
|
||||
- key: repmgr-password
|
||||
path: pgpool-sr-check-password
|
||||
{{- end }}
|
||||
{{- if .Values.pgpool.usePasswordFile }}
|
||||
- name: pgpool-password
|
||||
secret:
|
||||
secretName: {{ include "postgresql-ha.pgpoolSecretName" . }}
|
||||
items:
|
||||
- key: admin-password
|
||||
path: admin-password
|
||||
{{- end }}
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $serviceName := include "postgresql-ha.pgpool" . }}
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.fullname" }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- if .Values.ingress.certManager }}
|
||||
kubernetes.io/tls-acme: "true"
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.ingress.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .name }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ default "/" .path }}
|
||||
backend:
|
||||
serviceName: {{ $serviceName | quote }}
|
||||
servicePort: postgresql
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{ toYaml .Values.ingress.tls | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if .Values.pgpool.pdb.create }}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.pgpool" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
spec:
|
||||
{{- if .Values.pgpool.pdb.minAvailable }}
|
||||
minAvailable: {{ .Values.pgpool.pdb.minAvailable }}
|
||||
{{- end }}
|
||||
{{- if .Values.pgpool.pdb.maxUnavailable }}
|
||||
maxUnavailable: {{ .Values.pgpool.pdb.maxUnavailable }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
{{- end }}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if (include "postgresql-ha.pgpoolCreateSecret" .) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.pgpool" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
type: Opaque
|
||||
data:
|
||||
admin-password: {{ (include "postgresql-ha.pgpoolAdminPassword" .) | b64enc | quote }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,33 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.pgpool" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
{{- 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 }}
|
||||
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ with .Values.service.loadBalancerSourceRanges }}
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.service.type "ClusterIP") .Values.service.clusterIP }}
|
||||
clusterIP: {{ .Values.service.clusterIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: postgresql
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: postgresql
|
||||
protocol: TCP
|
||||
{{- if .Values.service.nodePort }}
|
||||
nodePort: {{ .Values.service.nodePort }}
|
||||
{{- end }}
|
||||
selector: {{ include "postgresql-ha.matchLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: pgpool
|
||||
@@ -0,0 +1,29 @@
|
||||
{{- if and (or (.Files.Glob "files/repmgr.conf") (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresql.repmgrConfiguration .Values.postgresql.configuration .Values.postgresql.pgHbaConfiguration) (not .Values.postgresql.configurationCM) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ printf "%s-configuration" (include "postgresql-ha.postgresql" .) }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
data:
|
||||
{{- if (.Files.Glob "files/repmgr.conf") }}
|
||||
{{ (.Files.Glob "files/repmgr.conf").AsConfig | indent 2 }}
|
||||
{{- else if .Values.postgresql.repmgrConfiguration }}
|
||||
repmgr.conf: |
|
||||
{{ .Values.postgresql.repmgrConfiguration | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if (.Files.Glob "files/postgresql.conf") }}
|
||||
{{ (.Files.Glob "files/postgresql.conf").AsConfig | indent 2 }}
|
||||
{{- else if .Values.postgresql.configuration }}
|
||||
postgresql.conf: |
|
||||
{{- range $key, $value := default dict .Values.postgresql.configuration }}
|
||||
{{ $key | snakecase }}={{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if (.Files.Glob "files/pg_hba.conf") }}
|
||||
{{ (.Files.Glob "files/pg_hba.conf").AsConfig | indent 2 }}
|
||||
{{- else if .Values.postgresql.pgHbaConfiguration }}
|
||||
pg_hba.conf: |
|
||||
{{ .Values.postgresql.pgHbaConfiguration | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if and (.Files.Glob "files/conf.d/*.conf") .Values.postgresql.extendedConf (not .Values.postgresql.extendedConfCM) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ printf "%s-extended-configuration" (include "postgresql-ha.postgresql" .) }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
data:
|
||||
{{- with .Files.Glob "files/conf.d/*.conf" }}
|
||||
{{ .AsConfig | indent 2 }}
|
||||
{{- end }}
|
||||
{{ with .Values.postgresql.extendedConf }}
|
||||
override.conf: |
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key | snakecase }}={{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- if and (or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.postgresql.initdbScripts) (not .Values.postgresql.initdbScriptsCM) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ printf "%s-initdb-scripts" (include "postgresql-ha.postgresql" .) }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
{{- with .Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz" }}
|
||||
binaryData:
|
||||
{{- range $path, $bytes := . }}
|
||||
{{ base $path }}: {{ $.Files.Get $path | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- with .Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql}" }}
|
||||
{{ .AsConfig | indent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.postgresql.initdbScripts }}
|
||||
{{ toYaml . | indent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.metrics.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.postgresql" . }}-metrics
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
annotations: {{ toYaml .Values.metrics.annotations | nindent 4 }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: metrics
|
||||
port: 9187
|
||||
targetPort: metrics
|
||||
selector: {{ include "postgresql-ha.matchLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if .Values.postgresql.pdb.create }}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.postgresql" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
spec:
|
||||
{{- if .Values.postgresql.pdb.minAvailable }}
|
||||
minAvailable: {{ .Values.postgresql.pdb.minAvailable }}
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.pdb.maxUnavailable }}
|
||||
maxUnavailable: {{ .Values.postgresql.pdb.maxUnavailable }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
{{- end }}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{- if (include "postgresql-ha.postgresqlCreateSecret" .) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.postgresql" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
type: Opaque
|
||||
data:
|
||||
postgresql-password: {{ (include "postgresql-ha.postgresqlPassword" .) | b64enc | quote }}
|
||||
repmgr-password: {{ (include "postgresql-ha.postgresqlRepmgrPassword" .) | b64enc | quote }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.postgresql" . }}-headless
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: postgresql
|
||||
port: 5432
|
||||
targetPort: postgresql
|
||||
protocol: TCP
|
||||
selector: {{ include "postgresql-ha.matchLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.postgresql" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: postgresql
|
||||
port: 5432
|
||||
targetPort: postgresql
|
||||
protocol: TCP
|
||||
selector: {{ include "postgresql-ha.matchLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
@@ -0,0 +1,29 @@
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.postgresql" . }}
|
||||
{{- if .Values.metrics.serviceMonitor.namespace }}
|
||||
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
|
||||
{{- end }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
{{- range $key, $value := .Values.metrics.serviceMonitor.selector }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
endpoints:
|
||||
- port: metrics
|
||||
{{- if .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ .Values.metrics.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,321 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "postgresql-ha.postgresql" . }}
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
spec:
|
||||
serviceName: {{ include "postgresql-ha.postgresql" . }}-headless
|
||||
replicas: {{ .Values.postgresql.replicaCount }}
|
||||
updateStrategy:
|
||||
type: {{ .Values.postgresql.updateStrategyType }}
|
||||
{{- if (eq "Recreate" .Values.postgresql.updateStrategyType) }}
|
||||
rollingUpdate: null
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
template:
|
||||
metadata:
|
||||
labels: {{ include "postgresql-ha.labels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
spec:
|
||||
{{- include "postgresql-ha.imagePullSecrets" . | indent 6 }}
|
||||
affinity:
|
||||
{{- if eq .Values.postgresql.antiAffinity "hard" }}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- topologyKey: "kubernetes.io/hostname"
|
||||
labelSelector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 18 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
{{- else if eq .Values.postgresql.antiAffinity "soft" }}
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 1
|
||||
podAffinityTerm:
|
||||
topologyKey: kubernetes.io/hostname
|
||||
labelSelector:
|
||||
matchLabels: {{ include "postgresql-ha.matchLabels" . | nindent 18 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.nodeAffinity }}
|
||||
nodeAffinity: {{ toYaml .Values.postgresql.nodeAffinity | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.postgresql.nodeSelector }}
|
||||
nodeSelector: {{ tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.postgresql.tolerations }}
|
||||
tolerations: {{ tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.postgresql.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
|
||||
initContainers:
|
||||
- name: init-chmod-data
|
||||
image: {{ include "postgresql-ha.volumePermissionsImage" . }}
|
||||
imagePullPolicy: {{ .Values.volumePermissionsImage.pullPolicy | quote }}
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
mkdir -p {{ .Values.persistence.mountPath }}/data
|
||||
chmod 700 {{ .Values.persistence.mountPath }}/data
|
||||
find {{ .Values.persistence.mountPath }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | \
|
||||
xargs chown -R {{ .Values.postgresql.securityContext.runAsUser }}:{{ .Values.postgresql.securityContext.fsGroup }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.volumePermissions.securityContext.runAsUser }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: {{ .Values.persistence.mountPath }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: postgresql
|
||||
image: {{ include "postgresql-ha.postgresqlImage" . }}
|
||||
imagePullPolicy: {{ .Values.postgresqlImage.pullPolicy | quote }}
|
||||
{{- if .Values.postgresql.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.postgresql.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
# Auxiliar vars to populate environment variables
|
||||
{{- $postgresqlReplicaCount := int .Values.postgresql.replicaCount }}
|
||||
{{- $postgresqlFullname := include "postgresql-ha.postgresql" . }}
|
||||
{{- $postgresqlHeadlessServiceName := printf "%s-headless" (include "postgresql-ha.postgresql" .) }}
|
||||
{{- $releaseName := .Release.Namespace }}
|
||||
env:
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" .Values.postgresqlImage.debug | quote }}
|
||||
# PostgreSQL configuration
|
||||
- name: POSTGRESQL_VOLUME_DIR
|
||||
value: {{ .Values.persistence.mountPath | quote }}
|
||||
- name: PGDATA
|
||||
value: {{ printf "%s/%s" .Values.persistence.mountPath "data" | quote }}
|
||||
- name: POSTGRES_USERNAME
|
||||
value: {{ (include "postgresql-ha.postgresqlUsername" .) | quote }}
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: POSTGRES_PASSWORD_FILE
|
||||
value: "/opt/bitnami/postgresql/secrets/postgresql-password"
|
||||
{{- else }}
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "postgresql-ha.postgresqlSecretName" . }}
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
{{- if not (empty (include "postgresql-ha.postgresqlDatabase" .)) }}
|
||||
- name: POSTGRES_DB
|
||||
value: {{ (include "postgresql-ha.postgresqlDatabase" .) | quote }}
|
||||
{{- end }}
|
||||
# Repmgr configuration
|
||||
- name: MY_POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: REPMGR_PGHBA_TRUST_ALL
|
||||
value: {{ ternary "yes" "no" .Values.postgresql.pgHbaTrustAll | quote }}
|
||||
- name: REPMGR_MOUNTED_CONF_DIR
|
||||
value: "/bitnami/repmgr/conf"
|
||||
- name: REPMGR_PARTNER_NODES
|
||||
value: {{range $e, $i := until $postgresqlReplicaCount }}{{ $postgresqlFullname }}-{{ $i }}.{{ $postgresqlHeadlessServiceName }}.{{ $releaseName }}.svc.cluster.local,{{ end }}
|
||||
- name: REPMGR_PRIMARY_HOST
|
||||
value: {{ printf "%s-0.%s.%s.svc.cluster.local" $postgresqlFullname $postgresqlHeadlessServiceName .Release.Namespace | quote }}
|
||||
- name: REPMGR_NODE_NAME
|
||||
value: "$(MY_POD_NAME)"
|
||||
- name: REPMGR_NODE_NETWORK_NAME
|
||||
value: "$(MY_POD_NAME).{{ $postgresqlHeadlessServiceName }}.{{ .Release.Namespace }}.svc.cluster.local"
|
||||
- name: REPMGR_LOG_LEVEL
|
||||
value: {{ .Values.postgresql.repmgrLogLevel | quote }}
|
||||
- name: REPMGR_CONNECT_TIMEOUT
|
||||
value: {{ .Values.postgresql.repmgrConnectTimeout | quote }}
|
||||
- name: REPMGR_RECONNECT_ATTEMPTS
|
||||
value: {{ .Values.postgresql.repmgrReconnectAttempts | quote }}
|
||||
- name: REPMGR_RECONNECT_INTERVAL
|
||||
value: {{ .Values.postgresql.repmgrReconnectInterval | quote }}
|
||||
- name: REPMGR_USERNAME
|
||||
value: {{ (include "postgresql-ha.postgresqlRepmgrUsername" .) | quote }}
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: REPMGR_PASSWORD_FILE
|
||||
value: "/opt/bitnami/repmgr/secrets/repmgr-password"
|
||||
{{- else }}
|
||||
- name: REPMGR_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "postgresql-ha.postgresqlSecretName" . }}
|
||||
key: repmgr-password
|
||||
{{- end }}
|
||||
{{- if (include "postgresql-ha.repmgrDatabase" .) }}
|
||||
- name: REPMGR_DATABASE
|
||||
value: {{ (include "postgresql-ha.repmgrDatabase" .) | quote }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: postgresql
|
||||
containerPort: 5432
|
||||
protocol: TCP
|
||||
{{- if .Values.postgresql.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
{{- if not (empty (include "postgresql-ha.postgresqlDatabase" .)) }}
|
||||
- exec pg_isready -U {{ include "postgresql-ha.postgresqlUsername" . | quote }} -d {{ (include "postgresql-ha.postgresqlDatabase" .) | quote }} -h 127.0.0.1
|
||||
{{- else }}
|
||||
- exec pg_isready -U {{ include "postgresql-ha.postgresqlUsername" . | quote }} -h 127.0.0.1
|
||||
{{- end }}
|
||||
initialDelaySeconds: {{ .Values.postgresql.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.postgresql.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.postgresql.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.postgresql.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.postgresql.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
{{- if not (empty (include "postgresql-ha.postgresqlDatabase" .)) }}
|
||||
- exec pg_isready -U {{ include "postgresql-ha.postgresqlUsername" . | quote }} -d {{ (include "postgresql-ha.postgresqlDatabase" .) | quote }} -h 127.0.0.1
|
||||
{{- else }}
|
||||
- exec pg_isready -U {{ include "postgresql-ha.postgresqlUsername" . | quote }} -h 127.0.0.1
|
||||
{{- end }}
|
||||
initialDelaySeconds: {{ .Values.postgresql.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.postgresql.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.postgresql.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.postgresql.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.postgresql.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.resources }}
|
||||
resources: {{- toYaml .Values.postgresql.resources | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if or (.Files.Glob "files/repmgr.conf") (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresql.repmgrConfiguration .Values.postgresql.configuration .Values.postgresql.pgHbaConfiguration .Values.postgresql.configurationCM }}
|
||||
- name: postgresql-config
|
||||
mountPath: /bitnami/repmgr/conf
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresql.extendedConf .Values.postgresql.extendedConfCM }}
|
||||
- name: postgresql-extended-config
|
||||
mountPath: /bitnami/repmgr/conf/conf.d/
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.postgresql.initdbScriptsCM .Values.postgresql.initdbScripts }}
|
||||
- name: custom-init-scripts
|
||||
mountPath: /docker-entrypoint-initdb.d/
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
mountPath: /opt/bitnami/postgresql/secrets/
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.enabled }}
|
||||
- name: data
|
||||
mountPath: {{ .Values.persistence.mountPath }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ include "postgresql-ha.metricsImage" . }}
|
||||
imagePullPolicy: {{ .Values.metricsImage.pullPolicy | quote }}
|
||||
{{- if .Values.metrics.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.metrics.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: DATA_SOURCE_URI
|
||||
value: {{ printf "127.0.0.1:5432/%s?sslmode=disable" (include "postgresql-ha.postgresqlDatabase" .) | quote }}
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: DATA_SOURCE_PASS_FILE
|
||||
value: "/opt/bitnami/postgresql/secrets/postgresql-password"
|
||||
{{- else }}
|
||||
- name: DATA_SOURCE_PASS
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "postgresql-ha.postgresqlSecretName" . }}
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
- name: DATA_SOURCE_USER
|
||||
value: {{ (include "postgresql-ha.postgresqlUsername" .) | quote }}
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: 9187
|
||||
protocol: TCP
|
||||
{{- if .Values.metrics.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.resources }}
|
||||
resources: {{- toYaml .Values.metrics.resources | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
mountPath: /opt/bitnami/postgresql/secrets/
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if or (.Files.Glob "files/repmgr.conf") (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresql.repmgrConfiguration .Values.postgresql.configuration .Values.postgresql.pgHbaConfiguration .Values.postgresql.configurationCM }}
|
||||
- name: postgresql-config
|
||||
configMap:
|
||||
name: {{ include "postgresql-ha.postgresqlConfigurationCM" . }}
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresql.extendedConf .Values.postgresql.extendedConfCM }}
|
||||
- name: postgresql-extended-config
|
||||
configMap:
|
||||
name: {{ template "postgresql-ha.postgresqlExtendedConfCM" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
secret:
|
||||
secretName: {{ include "postgresql-ha.postgresqlSecretName" . }}
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.postgresql.initdbScriptsCM .Values.postgresql.initdbScripts }}
|
||||
- name: custom-init-scripts
|
||||
configMap:
|
||||
name: {{ template "postgresql-ha.postgresqlInitdbScriptsCM" . }}
|
||||
{{- end }}
|
||||
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
{{- with .Values.persistence.existingClaim }}
|
||||
claimName: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- else if not .Values.persistence.enabled }}
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
{{- else if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
{{- with .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{ include "postgresql-ha.storageClass" . | indent 6 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,523 @@
|
||||
## Global Docker image parameters
|
||||
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
|
||||
## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass
|
||||
##
|
||||
# global:
|
||||
# imageRegistry: myRegistryName
|
||||
# imagePullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
# storageClass: myStorageClass
|
||||
# postgresql:
|
||||
# username: customuser
|
||||
# password: custompassword
|
||||
# database: customdatabase
|
||||
# repmgrUsername: repmgruser
|
||||
# repmgrPassword: repmgrpassword
|
||||
# repmgrDatabase: repmgrdatabase
|
||||
# existingSecret: myExistingSecret
|
||||
# ldap:
|
||||
# bindpw: bindpassword
|
||||
# existingSecret: myExistingSecret
|
||||
# pgpool:
|
||||
# adminUsername: adminuser
|
||||
# adminPassword: adminpassword
|
||||
# existingSecret: myExistingSecret
|
||||
|
||||
## Bitnami PostgreSQL image
|
||||
## ref: https://hub.docker.com/r/bitnami/postgresql/tags/
|
||||
##
|
||||
postgresqlImage:
|
||||
registry: docker.io
|
||||
repository: bitnami/postgresql-repmgr
|
||||
tag: 11.5.0-debian-9-r23
|
||||
## 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
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Set to true if you would like to see extra information on logs
|
||||
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||
##
|
||||
debug: false
|
||||
|
||||
## Bitnami Pgpool image
|
||||
## ref: https://hub.docker.com/r/bitnami/pgpool/tags/
|
||||
##
|
||||
pgpoolImage:
|
||||
registry: docker.io
|
||||
repository: bitnami/pgpool
|
||||
tag: 4.1.0-debian-9-r2
|
||||
## 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
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Set to true if you would like to see extra information on logs
|
||||
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||
##
|
||||
debug: false
|
||||
|
||||
## Bitnami Minideb image
|
||||
## ref: https://hub.docker.com/r/bitnami/pgpool/tags/
|
||||
##
|
||||
volumePermissionsImage:
|
||||
registry: docker.io
|
||||
repository: bitnami/minideb
|
||||
tag: latest
|
||||
## 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
|
||||
##
|
||||
pullPolicy: Always
|
||||
## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Bitnami PostgreSQL Prometheus exporter image
|
||||
## ref: https://hub.docker.com/r/bitnami/pgpool/tags/
|
||||
##
|
||||
metricsImage:
|
||||
registry: docker.io
|
||||
repository: bitnami/postgres-exporter
|
||||
tag: 0.7.0-debian-9-r3
|
||||
## 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
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Set to true if you would like to see extra information on logs
|
||||
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||
##
|
||||
debug: false
|
||||
|
||||
## String to partially override postgresql-ha.fullname template (will maintain the release name)
|
||||
##
|
||||
# nameOverride:
|
||||
|
||||
## String to fully override postgresql-ha.fullname template
|
||||
##
|
||||
# fullnameOverride:
|
||||
|
||||
## PostgreSQL parameters
|
||||
##
|
||||
postgresql:
|
||||
## Number of replicas to deploy
|
||||
##
|
||||
replicaCount: 2
|
||||
|
||||
## Update strategy for PostgreSQL statefulset
|
||||
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
|
||||
##
|
||||
updateStrategyType: RollingUpdate
|
||||
|
||||
## Pod AntiAffinity
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
##
|
||||
antiAffinity: soft
|
||||
|
||||
## Node Affinity. The value is evaluated as a template.
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature
|
||||
##
|
||||
nodeAffinity: {}
|
||||
|
||||
## Node labels for pod assignment. Evaluated as a template.
|
||||
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||
##
|
||||
nodeSelector: {}
|
||||
|
||||
## Tolerations for pod assignment. Evaluated as a template.
|
||||
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
|
||||
##
|
||||
tolerations: {}
|
||||
|
||||
## K8s Security Context
|
||||
## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: true
|
||||
fsGroup: 1001
|
||||
runAsUser: 1001
|
||||
|
||||
## PostgreSQL pods' resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources: {}
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 6
|
||||
|
||||
## Pod disruption budget configuration
|
||||
##
|
||||
pdb:
|
||||
## Specifies whether a Pod disruption budget should be created
|
||||
##
|
||||
create: false
|
||||
minAvailable: 1
|
||||
# maxUnavailable: 1
|
||||
|
||||
## Pgpool configuration parameters
|
||||
##
|
||||
adminUsername: admin
|
||||
# adminPassword:
|
||||
|
||||
## PostgreSQL configuration parameters
|
||||
##
|
||||
username: postgres
|
||||
# password:
|
||||
# database:
|
||||
|
||||
##
|
||||
pgHbaTrustAll: false
|
||||
|
||||
## Repmgr configuration parameters
|
||||
##
|
||||
repmgrUsername: repmgr
|
||||
# repmgrPassword:
|
||||
repmgrDatabase: repmgr
|
||||
repmgrLogLevel: NOTICE
|
||||
repmgrConnectTimeout: 5
|
||||
repmgrReconnectAttempts: 3
|
||||
repmgrReconnectInterval: 5
|
||||
|
||||
## Repmgr configuration
|
||||
## Specify content for repmgr.conf
|
||||
## Default: do not create repmgr.conf
|
||||
## Alternatively, you can put your repmgr.conf under the files/ directory
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql-repmgr#configuration-file
|
||||
##
|
||||
# repmgrConfiguration: |-
|
||||
|
||||
## PostgreSQL configuration
|
||||
## Specify runtime configuration parameters as a dict, using camelCase, e.g.
|
||||
## {"sharedBuffers": "500MB"}
|
||||
## Alternatively, you can put your postgresql.conf under the files/ directory
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql-repmgr#configuration-file
|
||||
##
|
||||
# configuration:
|
||||
|
||||
## PostgreSQL client authentication configuration
|
||||
## Specify content for pg_hba.conf
|
||||
## Default: do not create pg_hba.conf
|
||||
## Alternatively, you can put your pg_hba.conf under the files/ directory
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql-repmgr#configuration-file
|
||||
##
|
||||
# pgHbaConfiguration: |-
|
||||
# local all all trust
|
||||
# host all all localhost trust
|
||||
# host mydatabase mysuser 192.168.0.0/24 md5
|
||||
|
||||
## ConfigMap with PostgreSQL configuration
|
||||
## NOTE: This will override repmgrConfiguration, configuration and pgHbaConfiguration
|
||||
##
|
||||
# configurationCM:
|
||||
|
||||
## PostgreSQL extended configuration
|
||||
## As above, but _appended_ to the main configuration
|
||||
## Alternatively, you can put your *.conf under the files/conf.d/ directory
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql-repmgr#allow-settings-to-be-loaded-from-files-other-than-the-default-postgresqlconf
|
||||
##
|
||||
# extendedConf:
|
||||
|
||||
## ConfigMap with PostgreSQL extended configuration
|
||||
## NOTE: This will override extendedConf
|
||||
##
|
||||
# extendedConfCM:
|
||||
|
||||
## initdb scripts
|
||||
## Specify dictionary of scripts to be run at first boot
|
||||
## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory
|
||||
##
|
||||
# initdbScripts:
|
||||
# my_init_script.sh: |
|
||||
# #!/bin/sh
|
||||
# echo "Do something."
|
||||
|
||||
## ConfigMap with scripts to be run at first boot
|
||||
## NOTE: This will override initdbScripts
|
||||
##
|
||||
# initdbScriptsCM:
|
||||
|
||||
## Pgpool parameters
|
||||
##
|
||||
pgpool:
|
||||
## Number of replicas to deploy
|
||||
##
|
||||
replicaCount: 1
|
||||
|
||||
## Pod AntiAffinity
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
##
|
||||
antiAffinity: soft
|
||||
|
||||
## Node Affinity. The value is evaluated as a template.
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature
|
||||
##
|
||||
nodeAffinity: {}
|
||||
|
||||
## Node labels for pod assignment. Evaluated as a template.
|
||||
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||
##
|
||||
nodeSelector: {}
|
||||
|
||||
## Tolerations for pod assignment. Evaluated as a template.
|
||||
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
|
||||
##
|
||||
tolerations: {}
|
||||
|
||||
## K8s Security Context
|
||||
## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: true
|
||||
fsGroup: 0
|
||||
runAsUser: 0
|
||||
|
||||
## Pgpool pods' resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources: {}
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
|
||||
## Pod disruption budget configuration
|
||||
##
|
||||
pdb:
|
||||
## Specifies whether a Pod disruption budget should be created
|
||||
##
|
||||
create: false
|
||||
minAvailable: 1
|
||||
# maxUnavailable: 1
|
||||
|
||||
## LDAP parameters
|
||||
##
|
||||
ldap:
|
||||
enabled: false
|
||||
## Retrieve LDAP bindpw from existing secret
|
||||
##
|
||||
# existingSecret: myExistingSecret
|
||||
uri:
|
||||
base:
|
||||
binddn:
|
||||
bindpw:
|
||||
bslookup:
|
||||
scope:
|
||||
tlsReqcert:
|
||||
nssInitgroupsIgnoreusers: root,nslcd
|
||||
|
||||
## Init Container paramaters
|
||||
##
|
||||
volumePermissions:
|
||||
enabled: false
|
||||
## K8s Security Context
|
||||
## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
|
||||
## PostgreSQL Prometheus exporter parameters
|
||||
##
|
||||
metrics:
|
||||
enabled: true
|
||||
## K8s Security Context
|
||||
## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: true
|
||||
runAsUser: 1001
|
||||
|
||||
## Prometheus exporter pods' resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources: {}
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 6
|
||||
|
||||
## Annotations for Prometheus expoerter
|
||||
##
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9187"
|
||||
|
||||
## Enable this if you're using Prometheus Operator
|
||||
##
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
## Specify a namespace if needed
|
||||
# namespace: monitoring
|
||||
# fallback to the prometheus default unless specified
|
||||
# interval: 10s
|
||||
# scrapeTimeout: 10s
|
||||
## Defaults to what's used if you follow CoreOS [Prometheus Install Instructions](https://github.com/helm/charts/tree/master/stable/prometheus-operator#tldr)
|
||||
## [Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator-1)
|
||||
## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters)
|
||||
selector:
|
||||
prometheus: kube-prometheus
|
||||
|
||||
## Persistence paramaters
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
## A manually managed Persistent Volume and Claim
|
||||
## If defined, PVC must be created manually before volume will be bound
|
||||
## The value is evaluated as a template
|
||||
##
|
||||
# existingClaim:
|
||||
## Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner.
|
||||
##
|
||||
# storageClass: "-"
|
||||
## The path the volume will be mounted at, useful when using different
|
||||
## PostgreSQL images.
|
||||
##
|
||||
mountPath: /bitnami/postgresql
|
||||
## Persistent Volume Access Mode
|
||||
##
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
## Persistent Volume Claim size
|
||||
##
|
||||
size: 8Gi
|
||||
## Persistent Volume Claim annotations
|
||||
##
|
||||
annotations: {}
|
||||
|
||||
## PgPool service paramaters
|
||||
##
|
||||
service:
|
||||
## Service type
|
||||
##
|
||||
type: ClusterIP
|
||||
## Service Port
|
||||
##
|
||||
port: 5432
|
||||
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||
##
|
||||
# nodePort:
|
||||
## Set the LoadBalancer service type to internal only.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||
##
|
||||
# loadBalancerIP:
|
||||
## Load Balancer sources
|
||||
## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
|
||||
##
|
||||
# loadBalancerSourceRanges:
|
||||
# - 10.10.10.0/24
|
||||
## Set the Cluster IP to use
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
|
||||
##
|
||||
# clusterIP: None
|
||||
## Provide any additional annotations which may be required
|
||||
##
|
||||
annotations: {}
|
||||
|
||||
## Ingress paramaters
|
||||
##
|
||||
ingress:
|
||||
## Set to true to enable ingress record generation
|
||||
enabled: false
|
||||
|
||||
## Set this to true in order to add the corresponding annotations for cert-manager
|
||||
certManager: false
|
||||
|
||||
## Ingress annotations done as key:value pairs
|
||||
## For a full list of possible ingress annotations, please see
|
||||
## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md
|
||||
##
|
||||
## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set
|
||||
## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set
|
||||
annotations:
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
|
||||
## The list of hostnames to be covered with this ingress record.
|
||||
## Most likely this will be just one host, but in the event more hosts are needed, this is an array
|
||||
hosts:
|
||||
- name: postgresql.local
|
||||
path: /
|
||||
|
||||
## The tls configuration for the ingress
|
||||
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
|
||||
tls:
|
||||
- hosts:
|
||||
- postgresql.local
|
||||
secretName: postgresql.local-tls
|
||||
|
||||
secrets:
|
||||
## If you're providing your own certificates, please use this to add the certificates as secrets
|
||||
## key and certificate should start with -----BEGIN CERTIFICATE----- or
|
||||
## -----BEGIN RSA PRIVATE KEY-----
|
||||
##
|
||||
## name should line up with a tlsSecret set further up
|
||||
## If you're using cert-manager, this is unneeded, as it will create the secret for you if it is not set
|
||||
##
|
||||
## It is also possible to create and manage the certificates outside of this helm chart
|
||||
## Please see README.md for more information
|
||||
# - name: airflow.local-tls
|
||||
# key:
|
||||
# certificate:
|
||||
|
||||
## NetworkPolicy paramaters
|
||||
##
|
||||
networkPolicy:
|
||||
enabled: true
|
||||
|
||||
## The Policy model to apply. When set to false, only pods with the correct
|
||||
## client labels will have network access to the port PostgreSQL is listening
|
||||
## on. When true, PostgreSQL will accept connections from any source
|
||||
## (with the correct destination port).
|
||||
##
|
||||
allowExternal: false
|
||||
@@ -0,0 +1,524 @@
|
||||
## Global Docker image parameters
|
||||
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
|
||||
## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass
|
||||
##
|
||||
# global:
|
||||
# imageRegistry: myRegistryName
|
||||
# imagePullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
# storageClass: myStorageClass
|
||||
# postgresql:
|
||||
# username: customuser
|
||||
# password: custompassword
|
||||
# database: customdatabase
|
||||
# repmgrUsername: repmgruser
|
||||
# repmgrPassword: repmgrpassword
|
||||
# repmgrDatabase: repmgrdatabase
|
||||
# existingSecret: myExistingSecret
|
||||
# ldap:
|
||||
# bindpw: bindpassword
|
||||
# existingSecret: myExistingSecret
|
||||
# pgpool:
|
||||
# adminUsername: adminuser
|
||||
# adminPassword: adminpassword
|
||||
# existingSecret: myExistingSecret
|
||||
|
||||
## Bitnami PostgreSQL image
|
||||
## ref: https://hub.docker.com/r/bitnami/postgresql/tags/
|
||||
##
|
||||
postgresqlImage:
|
||||
registry: docker.io
|
||||
repository: bitnami/postgresql-repmgr
|
||||
tag: 11.5.0-debian-9-r23
|
||||
## 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
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Set to true if you would like to see extra information on logs
|
||||
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||
##
|
||||
debug: false
|
||||
|
||||
## Bitnami Pgpool image
|
||||
## ref: https://hub.docker.com/r/bitnami/pgpool/tags/
|
||||
##
|
||||
pgpoolImage:
|
||||
registry: docker.io
|
||||
repository: bitnami/pgpool
|
||||
tag: 4.1.0-debian-9-r2
|
||||
## 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
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Set to true if you would like to see extra information on logs
|
||||
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||
##
|
||||
debug: false
|
||||
|
||||
## Bitnami Minideb image
|
||||
## ref: https://hub.docker.com/r/bitnami/pgpool/tags/
|
||||
##
|
||||
volumePermissionsImage:
|
||||
registry: docker.io
|
||||
repository: bitnami/minideb
|
||||
tag: latest
|
||||
## 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
|
||||
##
|
||||
pullPolicy: Always
|
||||
## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Bitnami PostgreSQL Prometheus exporter image
|
||||
## ref: https://hub.docker.com/r/bitnami/pgpool/tags/
|
||||
##
|
||||
metricsImage:
|
||||
registry: docker.io
|
||||
repository: bitnami/postgres-exporter
|
||||
tag: 0.7.0-debian-9-r3
|
||||
## 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
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Set to true if you would like to see extra information on logs
|
||||
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||
##
|
||||
debug: false
|
||||
|
||||
## String to partially override postgresql-ha.fullname template (will maintain the release name)
|
||||
##
|
||||
# nameOverride:
|
||||
|
||||
## String to fully override postgresql-ha.fullname template
|
||||
##
|
||||
# fullnameOverride:
|
||||
|
||||
## PostgreSQL parameters
|
||||
##
|
||||
postgresql:
|
||||
## Number of replicas to deploy
|
||||
##
|
||||
replicaCount: 2
|
||||
|
||||
## Update strategy for PostgreSQL statefulset
|
||||
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
|
||||
##
|
||||
updateStrategyType: RollingUpdate
|
||||
|
||||
## Pod AntiAffinity
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
##
|
||||
antiAffinity: soft
|
||||
|
||||
## Node Affinity. The value is evaluated as a template.
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature
|
||||
##
|
||||
nodeAffinity: {}
|
||||
|
||||
## Node labels for pod assignment. Evaluated as a template.
|
||||
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||
##
|
||||
nodeSelector: {}
|
||||
|
||||
## Tolerations for pod assignment. Evaluated as a template.
|
||||
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
|
||||
##
|
||||
tolerations: {}
|
||||
|
||||
## K8s Security Context
|
||||
## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: true
|
||||
fsGroup: 1001
|
||||
runAsUser: 1001
|
||||
|
||||
## PostgreSQL pods' resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources: {}
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 6
|
||||
|
||||
## Pod disruption budget configuration
|
||||
##
|
||||
pdb:
|
||||
## Specifies whether a Pod disruption budget should be created
|
||||
##
|
||||
create: false
|
||||
minAvailable: 1
|
||||
# maxUnavailable: 1
|
||||
|
||||
## PostgreSQL configuration parameters
|
||||
##
|
||||
username: postgres
|
||||
# password:
|
||||
# database:
|
||||
|
||||
## Configures pg_hba.conf to trust every user
|
||||
##
|
||||
pgHbaTrustAll: false
|
||||
|
||||
## Repmgr configuration parameters
|
||||
##
|
||||
repmgrUsername: repmgr
|
||||
# repmgrPassword:
|
||||
repmgrDatabase: repmgr
|
||||
repmgrLogLevel: NOTICE
|
||||
repmgrConnectTimeout: 5
|
||||
repmgrReconnectAttempts: 3
|
||||
repmgrReconnectInterval: 5
|
||||
|
||||
## Repmgr configuration
|
||||
## Specify content for repmgr.conf
|
||||
## Default: do not create repmgr.conf
|
||||
## Alternatively, you can put your repmgr.conf under the files/ directory
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql-repmgr#configuration-file
|
||||
##
|
||||
# repmgrConfiguration: |-
|
||||
|
||||
## PostgreSQL configuration
|
||||
## Specify runtime configuration parameters as a dict, using camelCase, e.g.
|
||||
## {"sharedBuffers": "500MB"}
|
||||
## Alternatively, you can put your postgresql.conf under the files/ directory
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql-repmgr#configuration-file
|
||||
##
|
||||
# configuration:
|
||||
|
||||
## PostgreSQL client authentication configuration
|
||||
## Specify content for pg_hba.conf
|
||||
## Default: do not create pg_hba.conf
|
||||
## Alternatively, you can put your pg_hba.conf under the files/ directory
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql-repmgr#configuration-file
|
||||
##
|
||||
# pgHbaConfiguration: |-
|
||||
# local all all trust
|
||||
# host all all localhost trust
|
||||
# host mydatabase mysuser 192.168.0.0/24 md5
|
||||
|
||||
## ConfigMap with PostgreSQL configuration
|
||||
## NOTE: This will override repmgrConfiguration, configuration and pgHbaConfiguration
|
||||
##
|
||||
# configurationCM:
|
||||
|
||||
## PostgreSQL extended configuration
|
||||
## As above, but _appended_ to the main configuration
|
||||
## Alternatively, you can put your *.conf under the files/conf.d/ directory
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql-repmgr#allow-settings-to-be-loaded-from-files-other-than-the-default-postgresqlconf
|
||||
##
|
||||
# extendedConf:
|
||||
|
||||
## ConfigMap with PostgreSQL extended configuration
|
||||
## NOTE: This will override extendedConf
|
||||
##
|
||||
# extendedConfCM:
|
||||
|
||||
## initdb scripts
|
||||
## Specify dictionary of scripts to be run at first boot
|
||||
## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory
|
||||
##
|
||||
# initdbScripts:
|
||||
# my_init_script.sh: |
|
||||
# #!/bin/sh
|
||||
# echo "Do something."
|
||||
|
||||
## ConfigMap with scripts to be run at first boot
|
||||
## NOTE: This will override initdbScripts
|
||||
##
|
||||
# initdbScriptsCM:
|
||||
|
||||
## Pgpool parameters
|
||||
##
|
||||
pgpool:
|
||||
## Number of replicas to deploy
|
||||
##
|
||||
replicaCount: 1
|
||||
|
||||
## Pod AntiAffinity
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
##
|
||||
antiAffinity: soft
|
||||
|
||||
## Node Affinity. The value is evaluated as a template.
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature
|
||||
##
|
||||
nodeAffinity: {}
|
||||
|
||||
## Node labels for pod assignment. Evaluated as a template.
|
||||
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||
##
|
||||
nodeSelector: {}
|
||||
|
||||
## Tolerations for pod assignment. Evaluated as a template.
|
||||
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
|
||||
##
|
||||
tolerations: {}
|
||||
|
||||
## K8s Security Context
|
||||
## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: true
|
||||
fsGroup: 0
|
||||
runAsUser: 0
|
||||
|
||||
## Pgpool pods' resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources: {}
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
|
||||
## Pod disruption budget configuration
|
||||
##
|
||||
pdb:
|
||||
## Specifies whether a Pod disruption budget should be created
|
||||
##
|
||||
create: false
|
||||
minAvailable: 1
|
||||
# maxUnavailable: 1
|
||||
|
||||
## Pgpool configuration parameters
|
||||
##
|
||||
adminUsername: admin
|
||||
# adminPassword:
|
||||
|
||||
## LDAP parameters
|
||||
##
|
||||
ldap:
|
||||
enabled: false
|
||||
## Retrieve LDAP bindpw from existing secret
|
||||
##
|
||||
# existingSecret: myExistingSecret
|
||||
uri:
|
||||
base:
|
||||
binddn:
|
||||
bindpw:
|
||||
bslookup:
|
||||
scope:
|
||||
tlsReqcert:
|
||||
nssInitgroupsIgnoreusers: root,nslcd
|
||||
|
||||
## Init Container paramaters
|
||||
##
|
||||
volumePermissions:
|
||||
enabled: false
|
||||
## K8s Security Context
|
||||
## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
|
||||
## PostgreSQL Prometheus exporter parameters
|
||||
##
|
||||
metrics:
|
||||
enabled: false
|
||||
## K8s Security Context
|
||||
## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: true
|
||||
runAsUser: 1001
|
||||
|
||||
## Prometheus exporter pods' resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources: {}
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 6
|
||||
|
||||
## Annotations for Prometheus exporter
|
||||
##
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9187"
|
||||
|
||||
## Enable this if you're using Prometheus Operator
|
||||
##
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
## Specify a namespace if needed
|
||||
# namespace: monitoring
|
||||
# fallback to the prometheus default unless specified
|
||||
# interval: 10s
|
||||
# scrapeTimeout: 10s
|
||||
## Defaults to what's used if you follow CoreOS [Prometheus Install Instructions](https://github.com/helm/charts/tree/master/stable/prometheus-operator#tldr)
|
||||
## [Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator-1)
|
||||
## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters)
|
||||
selector:
|
||||
prometheus: kube-prometheus
|
||||
|
||||
## Persistence paramaters
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
## A manually managed Persistent Volume and Claim
|
||||
## If defined, PVC must be created manually before volume will be bound
|
||||
## The value is evaluated as a template
|
||||
##
|
||||
# existingClaim:
|
||||
## Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner.
|
||||
##
|
||||
# storageClass: "-"
|
||||
## The path the volume will be mounted at, useful when using different
|
||||
## PostgreSQL images.
|
||||
##
|
||||
mountPath: /bitnami/postgresql
|
||||
## Persistent Volume Access Mode
|
||||
##
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
## Persistent Volume Claim size
|
||||
##
|
||||
size: 8Gi
|
||||
## Persistent Volume Claim annotations
|
||||
##
|
||||
annotations: {}
|
||||
|
||||
## PgPool service paramaters
|
||||
##
|
||||
service:
|
||||
## Service type
|
||||
##
|
||||
type: ClusterIP
|
||||
## Service Port
|
||||
##
|
||||
port: 5432
|
||||
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||
##
|
||||
# nodePort:
|
||||
## Set the LoadBalancer service type to internal only.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||
##
|
||||
# loadBalancerIP:
|
||||
## Load Balancer sources
|
||||
## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
|
||||
##
|
||||
# loadBalancerSourceRanges:
|
||||
# - 10.10.10.0/24
|
||||
## Set the Cluster IP to use
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
|
||||
##
|
||||
# clusterIP: None
|
||||
## Provide any additional annotations which may be required
|
||||
##
|
||||
annotations: {}
|
||||
|
||||
## Ingress paramaters
|
||||
##
|
||||
ingress:
|
||||
## Set to true to enable ingress record generation
|
||||
enabled: false
|
||||
|
||||
## Set this to true in order to add the corresponding annotations for cert-manager
|
||||
certManager: false
|
||||
|
||||
## Ingress annotations done as key:value pairs
|
||||
## For a full list of possible ingress annotations, please see
|
||||
## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md
|
||||
##
|
||||
## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set
|
||||
## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set
|
||||
annotations:
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
|
||||
## The list of hostnames to be covered with this ingress record.
|
||||
## Most likely this will be just one host, but in the event more hosts are needed, this is an array
|
||||
hosts:
|
||||
- name: postgresql.local
|
||||
path: /
|
||||
|
||||
## The tls configuration for the ingress
|
||||
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
|
||||
tls:
|
||||
- hosts:
|
||||
- postgresql.local
|
||||
secretName: postgresql.local-tls
|
||||
|
||||
secrets:
|
||||
## If you're providing your own certificates, please use this to add the certificates as secrets
|
||||
## key and certificate should start with -----BEGIN CERTIFICATE----- or
|
||||
## -----BEGIN RSA PRIVATE KEY-----
|
||||
##
|
||||
## name should line up with a tlsSecret set further up
|
||||
## If you're using cert-manager, this is unneeded, as it will create the secret for you if it is not set
|
||||
##
|
||||
## It is also possible to create and manage the certificates outside of this helm chart
|
||||
## Please see README.md for more information
|
||||
# - name: airflow.local-tls
|
||||
# key:
|
||||
# certificate:
|
||||
|
||||
## NetworkPolicy paramaters
|
||||
##
|
||||
networkPolicy:
|
||||
enabled: false
|
||||
|
||||
## The Policy model to apply. When set to false, only pods with the correct
|
||||
## client labels will have network access to the port PostgreSQL is listening
|
||||
## on. When true, PostgreSQL will accept connections from any source
|
||||
## (with the correct destination port).
|
||||
##
|
||||
allowExternal: true
|
||||
Reference in New Issue
Block a user