single db chart
This commit is contained in:
parent
61835a76f0
commit
fe4147dda2
133 changed files with 14930 additions and 0 deletions
9
scripts/helm/helm/README.md
Normal file
9
scripts/helm/helm/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
- Initialize databases
|
||||||
|
- we've to pass the --wait flag, else the db installation won't be complete. and it'll break the db init.
|
||||||
|
- collate all dbs required
|
||||||
|
- How to distinguish b/w enterprise and community
|
||||||
|
- Or fist only community then enterprise
|
||||||
|
- install db migration
|
||||||
|
- have to have another helm chart with low hook value for higher prioriry
|
||||||
|
- install app
|
||||||
|
- customize values.yaml file
|
||||||
23
scripts/helm/helm/databases/.helmignore
Normal file
23
scripts/helm/helm/databases/.helmignore
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# 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
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
||||||
24
scripts/helm/helm/databases/Chart.yaml
Normal file
24
scripts/helm/helm/databases/Chart.yaml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
apiVersion: v2
|
||||||
|
name: databases
|
||||||
|
description: A Helm chart for Kubernetes
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: application
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
# This is the version number of the application being deployed. This version number should be
|
||||||
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
|
# It is recommended to use it with quotes.
|
||||||
|
appVersion: "1.16.0"
|
||||||
21
scripts/helm/helm/databases/charts/minio/.helmignore
Executable file
21
scripts/helm/helm/databases/charts/minio/.helmignore
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# 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
|
||||||
24
scripts/helm/helm/databases/charts/minio/Chart.yaml
Executable file
24
scripts/helm/helm/databases/charts/minio/Chart.yaml
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
annotations:
|
||||||
|
category: Infrastructure
|
||||||
|
apiVersion: v1
|
||||||
|
appVersion: 2020.10.9
|
||||||
|
description: MinIO is an object storage server, compatible with Amazon S3 cloud storage
|
||||||
|
service, mainly used for storing unstructured data (such as photos, videos, log
|
||||||
|
files, etc.)
|
||||||
|
engine: gotpl
|
||||||
|
home: https://github.com/bitnami/charts/tree/master/bitnami/minio
|
||||||
|
icon: https://bitnami.com/assets/stacks/minio/img/minio-stack-220x234.png
|
||||||
|
keywords:
|
||||||
|
- minio
|
||||||
|
- storage
|
||||||
|
- object-storage
|
||||||
|
- s3
|
||||||
|
- cluster
|
||||||
|
maintainers:
|
||||||
|
- email: containers@bitnami.com
|
||||||
|
name: Bitnami
|
||||||
|
name: minio
|
||||||
|
sources:
|
||||||
|
- https://github.com/bitnami/bitnami-docker-minio
|
||||||
|
- https://min.io
|
||||||
|
version: 3.7.14
|
||||||
259
scripts/helm/helm/databases/charts/minio/README.md
Executable file
259
scripts/helm/helm/databases/charts/minio/README.md
Executable file
|
|
@ -0,0 +1,259 @@
|
||||||
|
# MinIO
|
||||||
|
|
||||||
|
[MinIO](https://min.io) is an object storage server, compatible with Amazon S3 cloud storage service, mainly used for storing unstructured data (such as photos, videos, log files, etc.)
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||||
|
$ helm install my-release bitnami/minio
|
||||||
|
```
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This chart bootstraps a [MinIO](https://github.com/bitnami/bitnami-docker-minio) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||||
|
|
||||||
|
Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This Helm chart has been tested on top of [Bitnami Kubernetes Production Runtime](https://kubeprod.io/) (BKPR). Deploy BKPR to get automated TLS certificates, logging and monitoring for your applications.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Kubernetes 1.12+
|
||||||
|
- Helm 2.12+ or Helm 3.0-beta3+
|
||||||
|
- PV provisioner support in the underlying infrastructure
|
||||||
|
- ReadWriteMany volumes for deployment scaling
|
||||||
|
|
||||||
|
## Installing the Chart
|
||||||
|
|
||||||
|
To install the chart with the release name `my-release`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||||
|
$ helm install my-release bitnami/minio
|
||||||
|
```
|
||||||
|
|
||||||
|
These commands deploy MinIO on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
|
||||||
|
|
||||||
|
> **Tip**: List all releases using `helm list`
|
||||||
|
|
||||||
|
## Uninstalling the Chart
|
||||||
|
|
||||||
|
To uninstall/delete the `my-release` deployment:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm delete my-release
|
||||||
|
```
|
||||||
|
|
||||||
|
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
The following table lists the configurable parameters of the MinIO chart and their default values.
|
||||||
|
|
||||||
|
| Parameter | Description | Default |
|
||||||
|
|--------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|
|
||||||
|
| `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.minio.existingSecret` | Name of existing secret to use for MinIO credentials (overrides `existingSecret`) | `nil` |
|
||||||
|
| `global.minio.accessKey` | MinIO Access Key (overrides `accessKey.password`) | `nil` |
|
||||||
|
| `global.minio.secretKey` | MinIO Secret Key (overrides `secretKey.password`) | `nil` |
|
||||||
|
| `image.registry` | MinIO image registry | `docker.io` |
|
||||||
|
| `image.repository` | MinIO image name | `bitnami/minio` |
|
||||||
|
| `image.tag` | MinIO image tag | `{TAG_NAME}` |
|
||||||
|
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
||||||
|
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||||
|
| `image.debug` | Specify if debug logs should be enabled | `false` |
|
||||||
|
| `nameOverride` | String to partially override minio.fullname template with a string (will prepend the release name) | `nil` |
|
||||||
|
| `fullnameOverride` | String to fully override minio.fullname template with a string | `nil` |
|
||||||
|
| `schedulerName` | Specifies the schedulerName, if it's nil uses kube-scheduler | `nil` |
|
||||||
|
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `true` |
|
||||||
|
| `serviceAccount.name` | If serviceAccount.create is enabled, what should the serviceAccount name be - otherwise defaults to the fullname | `nil` |
|
||||||
|
| `clusterDomain` | Kubernetes cluster domain | `cluster.local` |
|
||||||
|
| `clientImage.registry` | MinIO Client image registry | `docker.io` |
|
||||||
|
| `clientImage.repository` | MinIO Client image name | `bitnami/minio-client` |
|
||||||
|
| `clientImage.tag` | MinIO Client image tag | `{TAG_NAME}` |
|
||||||
|
| `volumePermissions.enabled` | Enable init container that changes volume permissions in the data directory (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` |
|
||||||
|
| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` |
|
||||||
|
| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` |
|
||||||
|
| `volumePermissions.image.tag` | Init container volume-permissions image tag | `buster` |
|
||||||
|
| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` |
|
||||||
|
| `volumePermissions.resources` | Init container resource requests/limit | `nil` |
|
||||||
|
| `mode` | MinIO server mode (`standalone` or `distributed`) | `standalone` |
|
||||||
|
| `statefulset.replicaCount` | Number of pods (only for Minio distributed mode). Should be 4 <= x <= 32 | `4` |
|
||||||
|
| `statefulset.updateStrategy` | Statefulset update strategy policy | `RollingUpdate` |
|
||||||
|
| `statefulset.podManagementpolicy` | Statefulset pods management policy | `Parallel` |
|
||||||
|
| `deployment.updateStrategy` | Deployment update strategy policy | `Recreate` |
|
||||||
|
| `existingSecret` | Existing secret with MinIO credentials | `nil` |
|
||||||
|
| `useCredentialsFile` | Have the secret mounted as a file instead of env vars | `false` |
|
||||||
|
| `forceNewKeys` | Force admin credentials (access and secret key) to be reconfigured every time they change in the secrets | `false` |
|
||||||
|
| `accessKey.password` | MinIO Access Key. Ignored if existing secret is provided. | _random 10 character alphanumeric string_ |
|
||||||
|
| `accessKey.forcePassword` | Force users to specify an Access Key | `false` |
|
||||||
|
| `secretKey.password` | MinIO Secret Key. Ignored if existing secret is provided. | _random 40 character alphanumeric string_ |
|
||||||
|
| `secretKey.forcePassword` | Force users to specify an Secret Key | `false` |
|
||||||
|
| `defaultBuckets` | Comma, semi-colon or space separated list of buckets to create (only in standalone mode) | `nil` |
|
||||||
|
| `disableWebUI` | Disable MinIO Web UI | `false` |
|
||||||
|
| `extraEnv` | Any extra environment variables you would like to pass to the pods | `{}` |
|
||||||
|
| `command` | Command for the minio container | `{}` |
|
||||||
|
| `resources` | Minio containers' resources | `{}` |
|
||||||
|
| `podAnnotations` | Pod annotations | `{}` |
|
||||||
|
| `affinity` | Map of node/pod affinities | `{}` (The value is evaluated as a template) |
|
||||||
|
| `nodeSelector` | Node labels for pod assignment | `{}` (The value is evaluated as a template) |
|
||||||
|
| `tolerations` | Tolerations for pod assignment | `[]` (The value is evaluated as a template) |
|
||||||
|
| `securityContext.enabled` | Enable security context | `true` |
|
||||||
|
| `securityContext.fsGroup` | Group ID for the container | `1001` |
|
||||||
|
| `securityContext.runAsUser` | User ID for the container | `1001` |
|
||||||
|
| `livenessProbe.enabled` | Enable/disable the Liveness probe | `true` |
|
||||||
|
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` |
|
||||||
|
| `livenessProbe.periodSeconds` | How often to perform the probe | `10` |
|
||||||
|
| `livenessProbe.timeoutSeconds` | When the probe times out | `5` |
|
||||||
|
| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` |
|
||||||
|
| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` |
|
||||||
|
| `readinessProbe.enabled` | Enable/disable the Readiness probe | `true` |
|
||||||
|
| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` |
|
||||||
|
| `readinessProbe.periodSeconds` | How often to perform the probe | `10` |
|
||||||
|
| `readinessProbe.timeoutSeconds` | When the probe times out | `5` |
|
||||||
|
| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` |
|
||||||
|
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` |
|
||||||
|
| `persistence.enabled` | Use a PVC to persist data | `true` |
|
||||||
|
| `persistence.mountPath` | Path to mount the volume at | `/data` |
|
||||||
|
| `persistence.storageClass` | Storage class of backing PVC | `nil` (uses alpha storage class annotation) |
|
||||||
|
| `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` |
|
||||||
|
| `persistence.size` | Size of data volume | `8Gi` |
|
||||||
|
| `persistence.annotations` | Persistent Volume annotations | `{}` |
|
||||||
|
| `persistence.existingClaim` | Name of an existing PVC to use (only in "standalone" mode) | `nil` |
|
||||||
|
| `service.type` | Kubernetes Service type | `ClusterIP` |
|
||||||
|
| `service.port` | MinIO service port | `9000` |
|
||||||
|
| `service.nodePort` | Port to bind to for NodePort service type | `nil` |
|
||||||
|
| `service.loadBalancerIP` | Static IP Address to use for LoadBalancer service type | `nil` |
|
||||||
|
| `service.annotations` | Kubernetes service annotations | `{}` |
|
||||||
|
| `ingress.enabled` | Enable/disable ingress | `false` |
|
||||||
|
| `ingress.certManager` | Add annotations for cert-manager | `false` |
|
||||||
|
| `ingress.annotations` | Ingress annotations | `[]` |
|
||||||
|
| `ingress.labels` | Ingress additional labels | `{}` |
|
||||||
|
| `ingress.hosts[0].name` | Hostname to your MinIO installation | `minio.local` |
|
||||||
|
| `ingress.hosts[0].path` | Path within the url structure | `/` |
|
||||||
|
| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` |
|
||||||
|
| `ingress.hosts[0].tlsHosts` | Array of TLS hosts for ingress record (defaults to `ingress.hosts[0].name` if `nil`) | `nil` |
|
||||||
|
| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `minio.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` |
|
||||||
|
| `prometheusAuthType` | Authentication mode for Prometheus (`jwt` or `public`) | `public` |
|
||||||
|
|
||||||
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install my-release \
|
||||||
|
--set accessKey.password=minio-access-key \
|
||||||
|
--set secretKey.password=minio-secret-key \
|
||||||
|
bitnami/minio
|
||||||
|
```
|
||||||
|
|
||||||
|
The above command sets the MinIO Server access key and secret key to `minio-access-key` and `minio-secret-key`, respectively.
|
||||||
|
|
||||||
|
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install my-release -f values.yaml bitnami/minio
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||||
|
|
||||||
|
## Configuration and installation details
|
||||||
|
|
||||||
|
### [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.
|
||||||
|
|
||||||
|
### 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`. You can use this file instead of the default one.
|
||||||
|
|
||||||
|
- MinIO server mode:
|
||||||
|
```diff
|
||||||
|
- mode: standalone
|
||||||
|
+ mode: distributed
|
||||||
|
```
|
||||||
|
|
||||||
|
- Disable MinIO Web UI:
|
||||||
|
```diff
|
||||||
|
- disableWebUI: false
|
||||||
|
+ disableWebUI: true
|
||||||
|
```
|
||||||
|
|
||||||
|
- Annotations to be added to pods:
|
||||||
|
```diff
|
||||||
|
- podAnnotations: {}
|
||||||
|
+ podAnnotations:
|
||||||
|
+ prometheus.io/scrape: "true"
|
||||||
|
+ prometheus.io/path: "/minio/prometheus/metrics"
|
||||||
|
+ prometheus.io/port: "9000"
|
||||||
|
```
|
||||||
|
|
||||||
|
- Pod resources:
|
||||||
|
```diff
|
||||||
|
- resources: {}
|
||||||
|
+ resources:
|
||||||
|
+ requests:
|
||||||
|
+ memory: 256Mi
|
||||||
|
+ cpu: 250m
|
||||||
|
```
|
||||||
|
|
||||||
|
- Enable NetworkPolicy:
|
||||||
|
```diff
|
||||||
|
- networkPolicy.enabled: false
|
||||||
|
+ networkPolicy.enabled: true
|
||||||
|
```
|
||||||
|
|
||||||
|
- Don't require client label for connections:
|
||||||
|
```diff
|
||||||
|
- networkPolicy.allowExternal: true
|
||||||
|
+ networkPolicy.allowExternal: false
|
||||||
|
```
|
||||||
|
|
||||||
|
- Change Prometheus authentication:
|
||||||
|
```diff
|
||||||
|
- prometheusAuthType: public
|
||||||
|
+ prometheusAuthType: jwt
|
||||||
|
```
|
||||||
|
|
||||||
|
### Distributed mode
|
||||||
|
|
||||||
|
You can start the MinIO chart in distributed mode with the following parameter: `mode=distributed`
|
||||||
|
|
||||||
|
This chart sets Minio server in distributed mode with 4 nodes by default. You can change the number of nodes setting the `statefulset.replicaCount` parameter, for example to `statefulset.replicaCount=8`
|
||||||
|
|
||||||
|
> Note: that the number of replicas must even, greater than 4 and lower than 32
|
||||||
|
|
||||||
|
### Prometheus exporter
|
||||||
|
|
||||||
|
MinIO exports Prometheus metrics at `/minio/prometheus/metrics`. To allow Prometheus collecting your MinIO metrics, modify the `values.yaml` adding the corresponding annotations:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
- podAnnotations: {}
|
||||||
|
+ podAnnotations:
|
||||||
|
+ prometheus.io/scrape: "true"
|
||||||
|
+ prometheus.io/path: "/minio/prometheus/metrics"
|
||||||
|
+ prometheus.io/port: "9000"
|
||||||
|
```
|
||||||
|
|
||||||
|
> Find more information about MinIO metrics at https://docs.min.io/docs/how-to-monitor-minio-using-prometheus.html
|
||||||
|
|
||||||
|
## Persistence
|
||||||
|
|
||||||
|
The [Bitnami MinIO](https://github.com/bitnami/bitnami-docker-minio) image stores data at the `/data` path of the container.
|
||||||
|
|
||||||
|
The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) at this location. The volume is created using dynamic volume provisioning.
|
||||||
|
|
||||||
|
### Adjust permissions of persistent volume mountpoint
|
||||||
|
|
||||||
|
As the image run as non-root by default, it is necessary to adjust the ownership of the persistent volume so that the container 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`.
|
||||||
27
scripts/helm/helm/databases/charts/minio/ci/values-production.yaml
Executable file
27
scripts/helm/helm/databases/charts/minio/ci/values-production.yaml
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Test values file for generating all of the yaml and check that
|
||||||
|
# the rendering is correct
|
||||||
|
|
||||||
|
volumePermissions:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
mode: distributed
|
||||||
|
|
||||||
|
useCredentialsFile: true
|
||||||
|
|
||||||
|
disableWebUI: false
|
||||||
|
|
||||||
|
podAnnotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/path: "/minio/prometheus/metric"
|
||||||
|
prometheus.io/port: "9000"
|
||||||
|
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 256Mi
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
networkPolicy:
|
||||||
|
enabled: true
|
||||||
71
scripts/helm/helm/databases/charts/minio/templates/NOTES.txt
Executable file
71
scripts/helm/helm/databases/charts/minio/templates/NOTES.txt
Executable file
|
|
@ -0,0 +1,71 @@
|
||||||
|
** Please be patient while the chart is being deployed **
|
||||||
|
|
||||||
|
MinIO can be accessed via port {{ .Values.service.port }} on the following DNS name from within your cluster:
|
||||||
|
|
||||||
|
{{ include "minio.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
|
||||||
|
|
||||||
|
To get your credentials run:
|
||||||
|
|
||||||
|
export MINIO_ACCESS_KEY=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "minio.fullname" . }} -o jsonpath="{.data.access-key}" | base64 --decode)
|
||||||
|
export MINIO_SECRET_KEY=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "minio.fullname" . }} -o jsonpath="{.data.secret-key}" | base64 --decode)
|
||||||
|
|
||||||
|
To connect to your MinIO server using a client:
|
||||||
|
|
||||||
|
- Run a MinIO Client pod and append the desired command (e.g. 'admin info server'):
|
||||||
|
|
||||||
|
kubectl run --namespace {{ .Release.Namespace }} {{ include "minio.fullname" . }}-client \
|
||||||
|
--rm --tty -i --restart='Never' \
|
||||||
|
--env MINIO_SERVER_ACCESS_KEY=$MINIO_ACCESS_KEY \
|
||||||
|
--env MINIO_SERVER_SECRET_KEY=$MINIO_SECRET_KEY \
|
||||||
|
--env MINIO_SERVER_HOST={{ include "minio.fullname" . }} \
|
||||||
|
{{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
|
||||||
|
--labels="{{ template "minio.name" . }}-client=true" \
|
||||||
|
{{- end }}
|
||||||
|
--image {{ template "minio.clientImage" . }} -- admin info server minio
|
||||||
|
|
||||||
|
{{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
|
||||||
|
|
||||||
|
NOTE: Since NetworkPolicy is enabled, only pods with label
|
||||||
|
"{{ template "minio.fullname" . }}-client=true" will be able to connect to MinIO.
|
||||||
|
{{- end }}
|
||||||
|
{{- if not .Values.disableWebUI }}
|
||||||
|
|
||||||
|
To access the MinIO web UI:
|
||||||
|
|
||||||
|
- Get the MinIO URL:
|
||||||
|
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
|
||||||
|
You should be able to access your new MinIO web UI through
|
||||||
|
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
{{ if .tls }}https{{ else }}http{{ end }}://{{ .name }}/minio/
|
||||||
|
{{- 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 "minio.fullname" . }}'
|
||||||
|
|
||||||
|
{{- $port:=.Values.service.port | toString }}
|
||||||
|
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "minio.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||||
|
echo "MinIO web URL: http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/minio"
|
||||||
|
|
||||||
|
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||||
|
|
||||||
|
echo "MinIO web URL: http://127.0.0.1:9000/minio"
|
||||||
|
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "minio.fullname" . }} 9000:{{ .Values.service.port }}
|
||||||
|
|
||||||
|
{{- else if contains "NodePort" .Values.service.type }}
|
||||||
|
|
||||||
|
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "minio.fullname" . }})
|
||||||
|
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||||
|
echo "MinIO web URL: http://$NODE_IP:$NODE_PORT/minio"
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
|
||||||
|
WARN: MinIO Web UI is disabled.
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{ include "minio.validateValues" . }}
|
||||||
|
{{ include "minio.checkRollingTags" . }}
|
||||||
265
scripts/helm/helm/databases/charts/minio/templates/_helpers.tpl
Executable file
265
scripts/helm/helm/databases/charts/minio/templates/_helpers.tpl
Executable file
|
|
@ -0,0 +1,265 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.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).
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.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 "minio.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Common labels
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.labels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "minio.name" . }}
|
||||||
|
helm.sh/chart: {{ include "minio.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 "minio.matchLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "minio.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper MinIO image name
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.image" -}}
|
||||||
|
{{- $registryName := coalesce .Values.global.imageRegistry .Values.image.registry -}}
|
||||||
|
{{- $repositoryName := .Values.image.repository -}}
|
||||||
|
{{- $tag := .Values.image.tag | toString -}}
|
||||||
|
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper MinIO Client image name
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.clientImage" -}}
|
||||||
|
{{- $registryName := coalesce .Values.global.imageRegistry .Values.clientImage.registry -}}
|
||||||
|
{{- $repositoryName := .Values.clientImage.repository -}}
|
||||||
|
{{- $tag := .Values.clientImage.tag | toString -}}
|
||||||
|
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper Docker Image Registry Secret Names
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.imagePullSecrets" -}}
|
||||||
|
{{- $imagePullSecrets := coalesce .Values.global.imagePullSecrets .Values.image.pullSecrets .Values.volumePermissions.image.pullSecrets -}}
|
||||||
|
{{- if $imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- range $imagePullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return MinIO accessKey
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.accessKey" -}}
|
||||||
|
{{- $accessKey := coalesce .Values.global.minio.accessKey .Values.accessKey.password -}}
|
||||||
|
{{- if $accessKey }}
|
||||||
|
{{- $accessKey -}}
|
||||||
|
{{- else if (not .Values.accessKey.forcePassword) }}
|
||||||
|
{{- randAlphaNum 10 -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{ required "An Access Key is required!" .Values.accessKey.password }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return MinIO secretKey
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.secretKey" -}}
|
||||||
|
{{- $secretKey := coalesce .Values.global.minio.secretKey .Values.secretKey.password -}}
|
||||||
|
{{- if $secretKey }}
|
||||||
|
{{- $secretKey -}}
|
||||||
|
{{- else if (not .Values.secretKey.forcePassword) }}
|
||||||
|
{{- randAlphaNum 40 -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{ required "A Secret Key is required!" .Values.secretKey.password }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get the credentials secret.
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.secretName" -}}
|
||||||
|
{{- if .Values.global.minio.existingSecret }}
|
||||||
|
{{- printf "%s" .Values.global.minio.existingSecret -}}
|
||||||
|
{{- else if .Values.existingSecret -}}
|
||||||
|
{{- printf "%s" .Values.existingSecret -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s" (include "minio.fullname" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return true if a secret object should be created
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.createSecret" -}}
|
||||||
|
{{- if .Values.global.minio.existingSecret }}
|
||||||
|
{{- else if .Values.existingSecret -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Compile all warnings into a single message, and call fail.
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.validateValues" -}}
|
||||||
|
{{- $messages := list -}}
|
||||||
|
{{- $messages := append $messages (include "minio.validateValues.mode" .) -}}
|
||||||
|
{{- $messages := append $messages (include "minio.validateValues.replicaCount" .) -}}
|
||||||
|
{{- $messages := without $messages "" -}}
|
||||||
|
{{- $message := join "\n" $messages -}}
|
||||||
|
|
||||||
|
{{- if $message -}}
|
||||||
|
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* Validate values of MinIO - must provide a valid mode ("distributed" or "standalone") */}}
|
||||||
|
{{- define "minio.validateValues.mode" -}}
|
||||||
|
{{- if and (ne .Values.mode "distributed") (ne .Values.mode "standalone") -}}
|
||||||
|
minio: mode
|
||||||
|
Invalid mode selected. Valid values are "distributed" and
|
||||||
|
"standalone". Please set a valid mode (--set mode="xxxx")
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* Validate values of MinIO - number of replicas must be even, greater than 4 and lower than 32 */}}
|
||||||
|
{{- define "minio.validateValues.replicaCount" -}}
|
||||||
|
{{- $replicaCount := int .Values.statefulset.replicaCount }}
|
||||||
|
{{- if and (eq .Values.mode "distributed") (or (eq (mod $replicaCount 2) 1) (lt $replicaCount 4) (gt $replicaCount 32)) -}}
|
||||||
|
minio: replicaCount
|
||||||
|
Number of replicas must be even, greater than 4 and lower than 32!!
|
||||||
|
Please set a valid number of replicas (--set statefulset.replicaCount=X)
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* Check if there are rolling tags in the images */}}
|
||||||
|
{{- define "minio.checkRollingTags" -}}
|
||||||
|
{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||||
|
WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.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.clientImage.repository) (not (.Values.clientImage.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||||
|
WARNING: Rolling tag detected ({{ .Values.clientImage.repository }}:{{ .Values.clientImage.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 proper image name (for the init container volume-permissions image)
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.volumePermissions.image" -}}
|
||||||
|
{{- $registryName := .Values.volumePermissions.image.registry -}}
|
||||||
|
{{- $repositoryName := .Values.volumePermissions.image.repository -}}
|
||||||
|
{{- $tag := .Values.volumePermissions.image.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 Storage Class
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.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 -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Renders a value that contains template.
|
||||||
|
Usage:
|
||||||
|
{{ include "minio.tplValue" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.tplValue" -}}
|
||||||
|
{{- if typeIs "string" .value }}
|
||||||
|
{{- tpl .value .context }}
|
||||||
|
{{- else }}
|
||||||
|
{{- tpl (.value | toYaml) .context }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Returns the proper service account name depending if an explicit service account name is set
|
||||||
|
in the values file. If the name is not set it will default to either minio.fullname if serviceAccount.create
|
||||||
|
is true or default otherwise.
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
{{ default (include "minio.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
160
scripts/helm/helm/databases/charts/minio/templates/deployment-standalone.yaml
Executable file
160
scripts/helm/helm/databases/charts/minio/templates/deployment-standalone.yaml
Executable file
|
|
@ -0,0 +1,160 @@
|
||||||
|
{{- if eq .Values.mode "standalone" }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "minio.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.deployment.updateStrategy }}
|
||||||
|
strategy: {{ toYaml .Values.deployment.updateStrategy | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels: {{- include "minio.matchLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels: {{- include "minio.labels" . | nindent 8 }}
|
||||||
|
{{- if or .Values.podAnnotations (include "minio.createSecret" .) }}
|
||||||
|
annotations:
|
||||||
|
{{- if (include "minio.createSecret" .) }}
|
||||||
|
checksum/credentials-secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.podAnnotations }}
|
||||||
|
{{- include "minio.tplValue" ( dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.schedulerName }}
|
||||||
|
schedulerName: {{ .Values.schedulerName }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ template "minio.serviceAccountName" . }}
|
||||||
|
{{- include "minio.imagePullSecrets" . | nindent 6 }}
|
||||||
|
{{- if .Values.affinity }}
|
||||||
|
affinity: {{- include "minio.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.nodeSelector }}
|
||||||
|
nodeSelector: {{- include "minio.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tolerations }}
|
||||||
|
tolerations: {{- include "minio.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.securityContext.enabled }}
|
||||||
|
securityContext:
|
||||||
|
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
|
||||||
|
initContainers:
|
||||||
|
- name: volume-permissions
|
||||||
|
image: {{ template "minio.volumePermissions.image" . }}
|
||||||
|
imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
- -ec
|
||||||
|
- |
|
||||||
|
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
{{- if .Values.volumePermissions.resources }}
|
||||||
|
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: {{ .Values.persistence.mountPath }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: minio
|
||||||
|
image: {{ include "minio.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||||
|
{{- if .Values.securityContext.enabled }}
|
||||||
|
securityContext:
|
||||||
|
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: BITNAMI_DEBUG
|
||||||
|
value: {{ ternary "true" "false" .Values.image.debug | quote }}
|
||||||
|
- name: MINIO_FORCE_NEW_KEYS
|
||||||
|
value: {{ ternary "yes" "no" .Values.forceNewKeys | quote }}
|
||||||
|
{{- if .Values.useCredentialsFile }}
|
||||||
|
- name: MINIO_ACCESS_KEY_FILE
|
||||||
|
value: "/opt/bitnami/minio/secrets/access-key"
|
||||||
|
{{- else }}
|
||||||
|
- name: MINIO_ACCESS_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "minio.secretName" . }}
|
||||||
|
key: access-key
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.useCredentialsFile }}
|
||||||
|
- name: MINIO_SECRET_KEY_FILE
|
||||||
|
value: "/opt/bitnami/minio/secrets/secret-key"
|
||||||
|
{{- else }}
|
||||||
|
- name: MINIO_SECRET_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "minio.secretName" . }}
|
||||||
|
key: secret-key
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.defaultBuckets }}
|
||||||
|
- name: MINIO_DEFAULT_BUCKETS
|
||||||
|
value: {{ .Values.defaultBuckets }}
|
||||||
|
{{- end }}
|
||||||
|
- name: MINIO_BROWSER
|
||||||
|
value: {{ ternary "off" "on" .Values.disableWebUI | quote }}
|
||||||
|
{{- if .Values.prometheusAuthType }}
|
||||||
|
- name: MINIO_PROMETHEUS_AUTH_TYPE
|
||||||
|
value: {{ .Values.prometheusAuthType }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraEnv }}
|
||||||
|
{{- toYaml .Values.extraEnv | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{ if .Values.command }}
|
||||||
|
command: {{- toYaml .Values.command | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: minio
|
||||||
|
containerPort: 9000
|
||||||
|
{{- if .Values.livenessProbe.enabled }}
|
||||||
|
livenessProbe:
|
||||||
|
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||||
|
httpGet:
|
||||||
|
path: /minio/health/live
|
||||||
|
port: minio
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.readinessProbe.enabled }}
|
||||||
|
readinessProbe:
|
||||||
|
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||||
|
tcpSocket:
|
||||||
|
port: minio
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.resources }}
|
||||||
|
resources: {{ toYaml .Values.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- if .Values.useCredentialsFile }}
|
||||||
|
- name: minio-credentials
|
||||||
|
mountPath: /opt/bitnami/minio/secrets/
|
||||||
|
{{- end }}
|
||||||
|
- name: "data"
|
||||||
|
mountPath: {{ .Values.persistence.mountPath }}
|
||||||
|
volumes:
|
||||||
|
{{- if .Values.useCredentialsFile }}
|
||||||
|
- name: minio-credentials
|
||||||
|
secret:
|
||||||
|
secretName: {{ include "minio.secretName" . }}
|
||||||
|
{{- end }}
|
||||||
|
- name: data
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ include "minio.fullname" . }}{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
43
scripts/helm/helm/databases/charts/minio/templates/ingress.yaml
Executable file
43
scripts/helm/helm/databases/charts/minio/templates/ingress.yaml
Executable file
|
|
@ -0,0 +1,43 @@
|
||||||
|
{{- if and .Values.ingress.enabled (not .Values.disableWebUI ) -}}
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ include "minio.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" . | nindent 4 }}
|
||||||
|
{{- range $key, $value := .Values.ingress.labels }}
|
||||||
|
{{ $key }}: {{ $value }}
|
||||||
|
{{- end }}
|
||||||
|
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: {{ include "minio.fullname" $ }}
|
||||||
|
servicePort: minio
|
||||||
|
{{- end }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
{{- if .tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- if .tlsHosts }}
|
||||||
|
{{- range $host := .tlsHosts }}
|
||||||
|
- {{ $host }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
- {{ .name }}
|
||||||
|
{{- end }}
|
||||||
|
secretName: {{ .tlsSecret }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
23
scripts/helm/helm/databases/charts/minio/templates/networkpolicy.yaml
Executable file
23
scripts/helm/helm/databases/charts/minio/templates/networkpolicy.yaml
Executable file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{{- if .Values.networkPolicy.enabled }}
|
||||||
|
kind: NetworkPolicy
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: {{ include "minio.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: {{ include "minio.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
ingress:
|
||||||
|
# Allow inbound connections
|
||||||
|
- ports:
|
||||||
|
- port: 9000
|
||||||
|
{{- if not .Values.networkPolicy.allowExternal }}
|
||||||
|
from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
{{ include "minio.fullname" . }}-client: "true"
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
17
scripts/helm/helm/databases/charts/minio/templates/pvc-standalone.yaml
Executable file
17
scripts/helm/helm/databases/charts/minio/templates/pvc-standalone.yaml
Executable file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) (eq .Values.mode "standalone") }}
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: {{ include "minio.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
{{- range .Values.persistence.accessModes }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.persistence.size | quote }}
|
||||||
|
{{ include "minio.storageClass" . }}
|
||||||
|
{{- end }}
|
||||||
12
scripts/helm/helm/databases/charts/minio/templates/secrets.yaml
Executable file
12
scripts/helm/helm/databases/charts/minio/templates/secrets.yaml
Executable file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{{- if (include "minio.createSecret" .) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "minio.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" . | nindent 4 }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
access-key: {{ include "minio.accessKey" . | b64enc | quote }}
|
||||||
|
secret-key: {{ include "minio.secretKey" . | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
24
scripts/helm/helm/databases/charts/minio/templates/service.yaml
Executable file
24
scripts/helm/helm/databases/charts/minio/templates/service.yaml
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "minio.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" . | nindent 4 }}
|
||||||
|
{{- if .Values.service.annotations }}
|
||||||
|
annotations: {{- include "minio.tplValue" ( dict "value" .Values.service.annotations "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.service.type }}
|
||||||
|
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
|
||||||
|
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: minio
|
||||||
|
port: {{ .Values.service.port }}
|
||||||
|
targetPort: minio
|
||||||
|
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePort)) }}
|
||||||
|
nodePort: {{ .Values.service.nodePort }}
|
||||||
|
{{- else if eq .Values.service.type "ClusterIP" }}
|
||||||
|
nodePort: null
|
||||||
|
{{- end }}
|
||||||
|
selector: {{- include "minio.matchLabels" . | nindent 4 }}
|
||||||
10
scripts/helm/helm/databases/charts/minio/templates/serviceaccount.yaml
Executable file
10
scripts/helm/helm/databases/charts/minio/templates/serviceaccount.yaml
Executable file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ template "minio.serviceAccountName" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" . | nindent 4 }}
|
||||||
|
secrets:
|
||||||
|
- name: {{ include "minio.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
181
scripts/helm/helm/databases/charts/minio/templates/statefulset.yaml
Executable file
181
scripts/helm/helm/databases/charts/minio/templates/statefulset.yaml
Executable file
|
|
@ -0,0 +1,181 @@
|
||||||
|
{{- if eq .Values.mode "distributed" }}
|
||||||
|
{{- $replicaCount := int .Values.statefulset.replicaCount }}
|
||||||
|
{{- if and (eq (mod $replicaCount 2) 0) (gt $replicaCount 3) (lt $replicaCount 33) }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: {{ include "minio.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels: {{- include "minio.matchLabels" . | nindent 6 }}
|
||||||
|
serviceName: {{ include "minio.fullname" . }}-headless
|
||||||
|
replicas: {{ .Values.statefulset.replicaCount }}
|
||||||
|
podManagementPolicy: {{ .Values.statefulset.podManagementPolicy }}
|
||||||
|
updateStrategy:
|
||||||
|
type: {{ .Values.statefulset.updateStrategy }}
|
||||||
|
{{- if (eq "Recreate" .Values.statefulset.updateStrategy) }}
|
||||||
|
rollingUpdate: null
|
||||||
|
{{- end }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels: {{- include "minio.labels" . | nindent 8 }}
|
||||||
|
{{- if or .Values.podAnnotations (include "minio.createSecret" .) }}
|
||||||
|
annotations:
|
||||||
|
{{- if (include "minio.createSecret" .) }}
|
||||||
|
checksum/credentials-secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.podAnnotations }}
|
||||||
|
{{- include "minio.tplValue" ( dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.schedulerName }}
|
||||||
|
schedulerName: {{ .Values.schedulerName }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ template "minio.serviceAccountName" . }}
|
||||||
|
{{- include "minio.imagePullSecrets" . | nindent 6 }}
|
||||||
|
{{- if .Values.affinity }}
|
||||||
|
affinity: {{- include "minio.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.nodeSelector }}
|
||||||
|
nodeSelector: {{- include "minio.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tolerations }}
|
||||||
|
tolerations: {{- include "minio.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.securityContext.enabled }}
|
||||||
|
securityContext:
|
||||||
|
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
|
||||||
|
initContainers:
|
||||||
|
- name: volume-permissions
|
||||||
|
image: {{ template "minio.volumePermissions.image" . }}
|
||||||
|
imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
- -ec
|
||||||
|
- |
|
||||||
|
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
{{- if .Values.volumePermissions.resources }}
|
||||||
|
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: {{ .Values.persistence.mountPath }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: minio
|
||||||
|
image: {{ include "minio.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||||
|
{{- if .Values.securityContext.enabled }}
|
||||||
|
securityContext:
|
||||||
|
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: BITNAMI_DEBUG
|
||||||
|
value: {{ ternary "true" "false" .Values.image.debug | quote }}
|
||||||
|
- name: MINIO_DISTRIBUTED_MODE_ENABLED
|
||||||
|
value: "yes"
|
||||||
|
- name: MINIO_SKIP_CLIENT
|
||||||
|
value: "yes"
|
||||||
|
- name: MINIO_DISTRIBUTED_NODES
|
||||||
|
{{- $minioFullname := include "minio.fullname" . }}
|
||||||
|
{{- $minioHeadlessServiceName := printf "%s-%s" $minioFullname "headless" | trunc 63 }}
|
||||||
|
{{- $releaseNamespace := .Release.Namespace }}
|
||||||
|
value: {{range $i, $e := until $replicaCount }}{{ $minioFullname }}-{{ $e }}.{{ $minioHeadlessServiceName }}.{{ $releaseNamespace }}.svc.{{ $.Values.clusterDomain }},{{ end }}
|
||||||
|
- name: MINIO_FORCE_NEW_KEYS
|
||||||
|
value: {{ ternary "yes" "no" .Values.forceNewKeys | quote }}
|
||||||
|
{{- if .Values.useCredentialsFile }}
|
||||||
|
- name: MINIO_ACCESS_KEY_FILE
|
||||||
|
value: "/opt/bitnami/minio/secrets/access-key"
|
||||||
|
{{- else }}
|
||||||
|
- name: MINIO_ACCESS_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "minio.secretName" . }}
|
||||||
|
key: access-key
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.useCredentialsFile }}
|
||||||
|
- name: MINIO_SECRET_KEY_FILE
|
||||||
|
value: "/opt/bitnami/minio/secrets/secret-key"
|
||||||
|
{{- else }}
|
||||||
|
- name: MINIO_SECRET_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "minio.secretName" . }}
|
||||||
|
key: secret-key
|
||||||
|
{{- end }}
|
||||||
|
- name: MINIO_BROWSER
|
||||||
|
value: {{ ternary "off" "on" .Values.disableWebUI | quote }}
|
||||||
|
{{- if .Values.prometheusAuthType }}
|
||||||
|
- name: MINIO_PROMETHEUS_AUTH_TYPE
|
||||||
|
value: {{ .Values.prometheusAuthType }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraEnv }}
|
||||||
|
{{- toYaml .Values.extraEnv | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: minio
|
||||||
|
containerPort: 9000
|
||||||
|
{{- if .Values.livenessProbe.enabled }}
|
||||||
|
livenessProbe:
|
||||||
|
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||||
|
httpGet:
|
||||||
|
path: /minio/health/live
|
||||||
|
port: minio
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.readinessProbe.enabled }}
|
||||||
|
readinessProbe:
|
||||||
|
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||||
|
tcpSocket:
|
||||||
|
port: minio
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.resources }}
|
||||||
|
resources: {{ toYaml .Values.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- if .Values.useCredentialsFile }}
|
||||||
|
- name: minio-credentials
|
||||||
|
mountPath: /opt/bitnami/minio/secrets/
|
||||||
|
{{- end }}
|
||||||
|
- name: data
|
||||||
|
mountPath: {{ .Values.persistence.mountPath }}
|
||||||
|
volumes:
|
||||||
|
{{- if .Values.useCredentialsFile }}
|
||||||
|
- name: minio-credentials
|
||||||
|
secret:
|
||||||
|
secretName: {{ include "minio.secretName" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if not .Values.persistence.enabled }}
|
||||||
|
- name: data
|
||||||
|
emptyDir: {}
|
||||||
|
{{- else }}
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: data
|
||||||
|
labels: {{- include "minio.matchLabels" . | nindent 10 }}
|
||||||
|
{{- if .Values.persistence.annotations }}
|
||||||
|
annotations: {{- include "minio.tplValue" ( dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
accessModes: {{ toYaml .Values.persistence.accessModes | nindent 10 }}
|
||||||
|
{{ include "minio.storageClass" . }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.persistence.size | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
16
scripts/helm/helm/databases/charts/minio/templates/svc-headless.yaml
Executable file
16
scripts/helm/helm/databases/charts/minio/templates/svc-headless.yaml
Executable file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{{- if eq .Values.mode "distributed" }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "minio.fullname" . }}-headless
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
clusterIP: None
|
||||||
|
ports:
|
||||||
|
- name: minio
|
||||||
|
port: {{ .Values.service.port }}
|
||||||
|
targetPort: minio
|
||||||
|
selector: {{- include "minio.matchLabels" . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
14
scripts/helm/helm/databases/charts/minio/templates/tls-secrets.yaml
Executable file
14
scripts/helm/helm/databases/charts/minio/templates/tls-secrets.yaml
Executable file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
{{- range .Values.ingress.secrets }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ .name }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels: {{- include "minio.labels" $ | nindent 4 }}
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
tls.crt: {{ .certificate | b64enc }}
|
||||||
|
tls.key: {{ .key | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
389
scripts/helm/helm/databases/charts/minio/values-production.yaml
Executable file
389
scripts/helm/helm/databases/charts/minio/values-production.yaml
Executable file
|
|
@ -0,0 +1,389 @@
|
||||||
|
## 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 and imagePullSecrets
|
||||||
|
##
|
||||||
|
global:
|
||||||
|
minio: {}
|
||||||
|
# minio:
|
||||||
|
# existingSecret: ""
|
||||||
|
# accessKey: ""
|
||||||
|
# secretKey: ""
|
||||||
|
# imageRegistry: myRegistryName
|
||||||
|
# imagePullSecrets:
|
||||||
|
# - myRegistryKeySecretName
|
||||||
|
# storageClass: myStorageClass
|
||||||
|
|
||||||
|
## Bitnami MinIO image version
|
||||||
|
## ref: https://hub.docker.com/r/bitnami/minio/tags/
|
||||||
|
##
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/minio
|
||||||
|
tag: 2020.10.9-debian-10-r6
|
||||||
|
## 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
|
||||||
|
## It turns BASH and NAMI debugging in minideb
|
||||||
|
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||||
|
debug: false
|
||||||
|
|
||||||
|
## String to partially override minio.fullname template (will maintain the release name)
|
||||||
|
##
|
||||||
|
# nameOverride:
|
||||||
|
|
||||||
|
## String to fully override minio.fullname template
|
||||||
|
##
|
||||||
|
# fullnameOverride:
|
||||||
|
|
||||||
|
## Scheduler name
|
||||||
|
## https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||||
|
##
|
||||||
|
# schedulerName: stork
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
# Specifies whether a ServiceAccount should be created
|
||||||
|
create: true
|
||||||
|
# The name of the ServiceAccount to use.
|
||||||
|
# If not set and create is true, a name is generated using the fullname template
|
||||||
|
name:
|
||||||
|
|
||||||
|
## Cluster domain
|
||||||
|
##
|
||||||
|
clusterDomain: cluster.local
|
||||||
|
|
||||||
|
## Bitnami MinIO Client image version
|
||||||
|
## ref: https://hub.docker.com/r/bitnami/minio-client/tags/
|
||||||
|
##
|
||||||
|
clientImage:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/minio-client
|
||||||
|
tag: 2020.10.3-debian-10-r9
|
||||||
|
|
||||||
|
## Init containers parameters:
|
||||||
|
## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section.
|
||||||
|
##
|
||||||
|
volumePermissions:
|
||||||
|
enabled: false
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/minideb
|
||||||
|
tag: buster
|
||||||
|
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
|
||||||
|
## Init container' resource requests and limits
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||||
|
##
|
||||||
|
resources:
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
limits: {}
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
requests: {}
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
## MinIO server mode. Allowed values: standalone or distributed.
|
||||||
|
## Distributed Minio ref: https://docs.minio.io/docs/distributed-minio-quickstart-guide
|
||||||
|
##
|
||||||
|
mode: distributed
|
||||||
|
|
||||||
|
## MinIO deployment parameters
|
||||||
|
## Only when mode is 'standalone'
|
||||||
|
##
|
||||||
|
deployment:
|
||||||
|
## Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to makesure the pods is destroyed first.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
|
||||||
|
## Example:
|
||||||
|
## updateStrategy:
|
||||||
|
## type: RollingUpdate
|
||||||
|
## rollingUpdate:
|
||||||
|
## maxSurge: 25%
|
||||||
|
## maxUnavailable: 25%
|
||||||
|
##
|
||||||
|
updateStrategy:
|
||||||
|
type: Recreate
|
||||||
|
|
||||||
|
## MinIO statefulset parameters
|
||||||
|
## Only when mode is 'distributed'
|
||||||
|
##
|
||||||
|
statefulset:
|
||||||
|
## Update strategy, can be set to RollingUpdate or OnDelete by default.
|
||||||
|
## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
|
||||||
|
##
|
||||||
|
updateStrategy: RollingUpdate
|
||||||
|
|
||||||
|
## StatefulSet controller supports relax its ordering guarantees while preserving its uniqueness and identity guarantees. There are two valid pod management policies: OrderedReady and Parallel
|
||||||
|
## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#pod-management-policy
|
||||||
|
##
|
||||||
|
podManagementPolicy: Parallel
|
||||||
|
|
||||||
|
## Number of replicas, it must even and greater than 4
|
||||||
|
##
|
||||||
|
replicaCount: 4
|
||||||
|
|
||||||
|
## Use existing secret (ignores accessKey, and secretKey passwords)
|
||||||
|
##
|
||||||
|
# existingSecret:
|
||||||
|
|
||||||
|
## Mount MinIO secret as a file instead of passing environment variable
|
||||||
|
##
|
||||||
|
useCredentialsFile: false
|
||||||
|
|
||||||
|
## Force reconfiguring new keys whenever the credentials change
|
||||||
|
##
|
||||||
|
forceNewKeys: false
|
||||||
|
|
||||||
|
## MinIO credentials
|
||||||
|
##
|
||||||
|
accessKey:
|
||||||
|
## MinIO Access Key
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-minio/#setting-up-minio-in-distributed-mode
|
||||||
|
##
|
||||||
|
password:
|
||||||
|
## Option to force users to specify a password. That is required for 'helm upgrade' to work properly.
|
||||||
|
## If it is not force, a random password will be generated.
|
||||||
|
##
|
||||||
|
forcePassword: false
|
||||||
|
secretKey:
|
||||||
|
## MinIO Secret Key
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-minio/#setting-up-minio-in-distributed-mode
|
||||||
|
##
|
||||||
|
password:
|
||||||
|
## Option to force users to specify a password. That is required for 'helm upgrade' to work properly.
|
||||||
|
## If it is not force, a random password will be generated.
|
||||||
|
##
|
||||||
|
forcePassword: false
|
||||||
|
|
||||||
|
## Comma, semi-colon or space separated list of buckets to create at initialization (only in standalone mode)
|
||||||
|
##
|
||||||
|
# defaultBuckets: "my-bucket, my-second-bucket"
|
||||||
|
|
||||||
|
## Disable MinIO Web UI
|
||||||
|
## ref: https://github.com/minio/minio/tree/master/docs/config/#browser
|
||||||
|
##
|
||||||
|
disableWebUI: true
|
||||||
|
|
||||||
|
## Define custom environment variables to pass to the image here
|
||||||
|
##
|
||||||
|
extraEnv: {}
|
||||||
|
|
||||||
|
## Security Context
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||||
|
##
|
||||||
|
securityContext:
|
||||||
|
enabled: true
|
||||||
|
fsGroup: 1001
|
||||||
|
runAsUser: 1001
|
||||||
|
|
||||||
|
## Pod annotations
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
|
||||||
|
##
|
||||||
|
podAnnotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/path: "/minio/prometheus/metric"
|
||||||
|
prometheus.io/port: "9000"
|
||||||
|
|
||||||
|
## Affinity for pod assignment
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
##
|
||||||
|
affinity: {}
|
||||||
|
|
||||||
|
## Node labels for pod assignment. Evaluated as a template.
|
||||||
|
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||||
|
##
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
## Tolerations for pod assignment
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
|
||||||
|
##
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
## MinIO containers' resource requests and limits
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||||
|
##
|
||||||
|
resources:
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
limits: {}
|
||||||
|
# cpu: 250m
|
||||||
|
# memory: 256Mi
|
||||||
|
requests:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 256Mi
|
||||||
|
|
||||||
|
## MinIO containers' liveness and readiness probes
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
|
||||||
|
##
|
||||||
|
livenessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 5
|
||||||
|
readinessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 1
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 5
|
||||||
|
|
||||||
|
## Enable persistence using Persistent Volume Claims
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||||
|
##
|
||||||
|
persistence:
|
||||||
|
## If true, use a Persistent Volume Claim, If false, use emptyDir
|
||||||
|
##
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
## Enable persistence using an existing PVC (only in standalone mode)
|
||||||
|
##
|
||||||
|
# existingClaim:
|
||||||
|
|
||||||
|
## Data volume mount path
|
||||||
|
##
|
||||||
|
mountPath: /data
|
||||||
|
|
||||||
|
## Persistent Volume Access Mode
|
||||||
|
##
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
|
||||||
|
## Persistent Volume size
|
||||||
|
##
|
||||||
|
size: 8Gi
|
||||||
|
|
||||||
|
## 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. (gp2 on AWS, standard on
|
||||||
|
## GKE, AWS & OpenStack)
|
||||||
|
##
|
||||||
|
# storageClass: "-"
|
||||||
|
|
||||||
|
## Persistent Volume Claim annotations
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
|
||||||
|
## MinIO Service properties
|
||||||
|
##
|
||||||
|
service:
|
||||||
|
## MinIO Service type
|
||||||
|
##
|
||||||
|
type: ClusterIP
|
||||||
|
|
||||||
|
## MinIO Service port
|
||||||
|
##
|
||||||
|
port: 9000
|
||||||
|
|
||||||
|
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||||
|
##
|
||||||
|
# nodePort:
|
||||||
|
|
||||||
|
## Provide any additional annotations which may be required. This can be used to
|
||||||
|
## set the LoadBalancer service type to internal only.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
|
||||||
|
## loadBalancerIP for the PrestaShop Service (optional, cloud specific)
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer
|
||||||
|
##
|
||||||
|
# loadBalancerIP:
|
||||||
|
|
||||||
|
## Configure the ingress resource that allows you to access the
|
||||||
|
## MinIO web browser. Set up the URL
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/ingress/
|
||||||
|
##
|
||||||
|
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/user-guide/nginx-configuration/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
|
||||||
|
|
||||||
|
## Ingress additional labels done as key:value pairs
|
||||||
|
labels: {}
|
||||||
|
|
||||||
|
## 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: minio.local
|
||||||
|
path: /
|
||||||
|
|
||||||
|
## Set this to true in order to enable TLS on the ingress record
|
||||||
|
tls: false
|
||||||
|
|
||||||
|
## Optionally specify the TLS hosts for the ingress record
|
||||||
|
## Useful when the Ingress controller supports www-redirection
|
||||||
|
## If not specified, the above host name will be used
|
||||||
|
# tlsHosts:
|
||||||
|
# - www.minio.local
|
||||||
|
# - minio.local
|
||||||
|
|
||||||
|
## If TLS is set to true, you must declare what secret will store the key/certificate for TLS
|
||||||
|
tlsSecret: minio.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: minio.local-tls
|
||||||
|
# key:
|
||||||
|
# certificate:
|
||||||
|
|
||||||
|
## NetworkPolicy parameters
|
||||||
|
##
|
||||||
|
networkPolicy:
|
||||||
|
## Specifies whether a NetworkPolicy should be created
|
||||||
|
##
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
## The Policy model to apply. When set to false, only pods with the correct
|
||||||
|
## client label will have network access to the port MinIO is listening
|
||||||
|
## on. When true, MinIO will accept connections from any source
|
||||||
|
## (with the correct destination port).
|
||||||
|
##
|
||||||
|
allowExternal: false
|
||||||
|
|
||||||
|
## MinIO supports two authentication modes for Prometheus either jwt or public, by default MinIO runs in jwt mode.
|
||||||
|
## To allow public access without authentication for prometheus metrics set environment as follows.
|
||||||
|
prometheusAuthType: jwt
|
||||||
391
scripts/helm/helm/databases/charts/minio/values.yaml
Executable file
391
scripts/helm/helm/databases/charts/minio/values.yaml
Executable file
|
|
@ -0,0 +1,391 @@
|
||||||
|
## 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 and imagePullSecrets
|
||||||
|
##
|
||||||
|
global:
|
||||||
|
minio:
|
||||||
|
accessKey: "minios3AccessKeyS3cr3t"
|
||||||
|
secretKey: "m1n10s3CretK3yPassw0rd"
|
||||||
|
# minio: {}
|
||||||
|
# existingSecret: ""
|
||||||
|
# accessKey: ""
|
||||||
|
# secretKey: ""
|
||||||
|
# imageRegistry: myRegistryName
|
||||||
|
# imagePullSecrets:
|
||||||
|
# - myRegistryKeySecretName
|
||||||
|
# storageClass: myStorageClass
|
||||||
|
|
||||||
|
## Bitnami MinIO image version
|
||||||
|
## ref: https://hub.docker.com/r/bitnami/minio/tags/
|
||||||
|
##
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/minio
|
||||||
|
tag: 2020.10.9-debian-10-r6
|
||||||
|
## 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
|
||||||
|
## It turns BASH and NAMI debugging in minideb
|
||||||
|
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||||
|
debug: false
|
||||||
|
|
||||||
|
## String to partially override minio.fullname template (will maintain the release name)
|
||||||
|
##
|
||||||
|
# nameOverride:
|
||||||
|
|
||||||
|
## String to fully override minio.fullname template
|
||||||
|
##
|
||||||
|
# fullnameOverride:
|
||||||
|
|
||||||
|
## Scheduler name
|
||||||
|
## https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||||
|
##
|
||||||
|
# schedulerName: stork
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
# Specifies whether a ServiceAccount should be created
|
||||||
|
create: true
|
||||||
|
# The name of the ServiceAccount to use.
|
||||||
|
# If not set and create is true, a name is generated using the fullname template
|
||||||
|
name:
|
||||||
|
|
||||||
|
## Cluster domain
|
||||||
|
##
|
||||||
|
clusterDomain: cluster.local
|
||||||
|
|
||||||
|
## Bitnami MinIO Client image version
|
||||||
|
## ref: https://hub.docker.com/r/bitnami/minio-client/tags/
|
||||||
|
##
|
||||||
|
clientImage:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/minio-client
|
||||||
|
tag: 2020.10.3-debian-10-r9
|
||||||
|
|
||||||
|
## Init containers parameters:
|
||||||
|
## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section.
|
||||||
|
##
|
||||||
|
volumePermissions:
|
||||||
|
enabled: false
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/minideb
|
||||||
|
tag: buster
|
||||||
|
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
|
||||||
|
## Init container' resource requests and limits
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||||
|
##
|
||||||
|
resources:
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
limits: {}
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
requests: {}
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
## MinIO server mode. Allowed values: standalone or distributed.
|
||||||
|
## Distributed Minio ref: https://docs.minio.io/docs/distributed-minio-quickstart-guide
|
||||||
|
##
|
||||||
|
mode: standalone
|
||||||
|
|
||||||
|
## MinIO deployment parameters
|
||||||
|
## Only when mode is 'standalone'
|
||||||
|
##
|
||||||
|
deployment:
|
||||||
|
## Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to makesure the pods is destroyed first.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
|
||||||
|
## Example:
|
||||||
|
## updateStrategy:
|
||||||
|
## type: RollingUpdate
|
||||||
|
## rollingUpdate:
|
||||||
|
## maxSurge: 25%
|
||||||
|
## maxUnavailable: 25%
|
||||||
|
##
|
||||||
|
updateStrategy:
|
||||||
|
type: Recreate
|
||||||
|
|
||||||
|
## MinIO statefulset parameters
|
||||||
|
## Only when mode is 'distributed'
|
||||||
|
##
|
||||||
|
statefulset:
|
||||||
|
## Update strategy, can be set to RollingUpdate or OnDelete by default.
|
||||||
|
## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
|
||||||
|
##
|
||||||
|
updateStrategy: RollingUpdate
|
||||||
|
|
||||||
|
## StatefulSet controller supports relax its ordering guarantees while preserving its uniqueness and identity guarantees. There are two valid pod management policies: OrderedReady and Parallel
|
||||||
|
## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#pod-management-policy
|
||||||
|
##
|
||||||
|
podManagementPolicy: Parallel
|
||||||
|
|
||||||
|
## Number of replicas, it must even and greater than 4
|
||||||
|
##
|
||||||
|
replicaCount: 4
|
||||||
|
|
||||||
|
## Use existing secret (ignores accessKey, and secretKey passwords)
|
||||||
|
##
|
||||||
|
# existingSecret:
|
||||||
|
|
||||||
|
## Mount MinIO secret as a file instead of passing environment variable
|
||||||
|
##
|
||||||
|
useCredentialsFile: false
|
||||||
|
|
||||||
|
## Force reconfiguring new keys whenever the credentials change
|
||||||
|
##
|
||||||
|
forceNewKeys: false
|
||||||
|
|
||||||
|
## MinIO credentials
|
||||||
|
##
|
||||||
|
accessKey:
|
||||||
|
## MinIO Access Key
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-minio/#setting-up-minio-in-distributed-mode
|
||||||
|
##
|
||||||
|
password:
|
||||||
|
## Option to force users to specify a password. That is required for 'helm upgrade' to work properly.
|
||||||
|
## If it is not force, a random password will be generated.
|
||||||
|
##
|
||||||
|
forcePassword: false
|
||||||
|
secretKey:
|
||||||
|
## MinIO Secret Key
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-minio/#setting-up-minio-in-distributed-mode
|
||||||
|
##
|
||||||
|
password:
|
||||||
|
## Option to force users to specify a password. That is required for 'helm upgrade' to work properly.
|
||||||
|
## If it is not force, a random password will be generated.
|
||||||
|
##
|
||||||
|
forcePassword: false
|
||||||
|
|
||||||
|
## Comma, semi-colon or space separated list of buckets to create at initialization (only in standalone mode)
|
||||||
|
##
|
||||||
|
# defaultBuckets: "my-bucket, my-second-bucket"
|
||||||
|
|
||||||
|
## Disable MinIO Web UI
|
||||||
|
## ref: https://github.com/minio/minio/tree/master/docs/config/#browser
|
||||||
|
##
|
||||||
|
disableWebUI: false
|
||||||
|
|
||||||
|
## Define custom environment variables to pass to the image here
|
||||||
|
##
|
||||||
|
extraEnv: {}
|
||||||
|
|
||||||
|
## Define a custom command for the minio container
|
||||||
|
command: {}
|
||||||
|
|
||||||
|
## Security Context
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||||
|
##
|
||||||
|
securityContext:
|
||||||
|
enabled: true
|
||||||
|
fsGroup: 1001
|
||||||
|
runAsUser: 1001
|
||||||
|
|
||||||
|
## Pod annotations
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
|
||||||
|
##
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
## Affinity for pod assignment
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
##
|
||||||
|
affinity: {}
|
||||||
|
|
||||||
|
## Node labels for pod assignment. Evaluated as a template.
|
||||||
|
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||||
|
##
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
## Tolerations for pod assignment
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
|
||||||
|
##
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
## MinIO containers' resource requests and limits
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||||
|
##
|
||||||
|
resources:
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
limits: {}
|
||||||
|
# cpu: 250m
|
||||||
|
# memory: 256Mi
|
||||||
|
requests: {}
|
||||||
|
# cpu: 250m
|
||||||
|
# memory: 256Mi
|
||||||
|
|
||||||
|
## MinIO containers' liveness and readiness probes
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
|
||||||
|
##
|
||||||
|
livenessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 5
|
||||||
|
readinessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 1
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 5
|
||||||
|
|
||||||
|
## Enable persistence using Persistent Volume Claims
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||||
|
##
|
||||||
|
persistence:
|
||||||
|
## If true, use a Persistent Volume Claim, If false, use emptyDir
|
||||||
|
##
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
## Enable persistence using an existing PVC (only in standalone mode)
|
||||||
|
##
|
||||||
|
# existingClaim:
|
||||||
|
|
||||||
|
## Data volume mount path
|
||||||
|
##
|
||||||
|
mountPath: /data
|
||||||
|
|
||||||
|
## Persistent Volume Access Mode
|
||||||
|
##
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
|
||||||
|
## Persistent Volume size
|
||||||
|
##
|
||||||
|
size: 50Gi
|
||||||
|
|
||||||
|
## 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. (gp2 on AWS, standard on
|
||||||
|
## GKE, AWS & OpenStack)
|
||||||
|
##
|
||||||
|
# storageClass: "-"
|
||||||
|
|
||||||
|
## Persistent Volume Claim annotations
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
|
||||||
|
## MinIO Service properties
|
||||||
|
##
|
||||||
|
service:
|
||||||
|
## MinIO Service type
|
||||||
|
##
|
||||||
|
type: ClusterIP
|
||||||
|
|
||||||
|
## MinIO Service port
|
||||||
|
##
|
||||||
|
port: 9000
|
||||||
|
|
||||||
|
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||||
|
##
|
||||||
|
# nodePort:
|
||||||
|
|
||||||
|
## Provide any additional annotations which may be required. This can be used to
|
||||||
|
## set the LoadBalancer service type to internal only.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
|
||||||
|
## loadBalancerIP for the PrestaShop Service (optional, cloud specific)
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer
|
||||||
|
##
|
||||||
|
# loadBalancerIP:
|
||||||
|
|
||||||
|
## Configure the ingress resource that allows you to access the
|
||||||
|
## MinIO web browser. Set up the URL
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/ingress/
|
||||||
|
##
|
||||||
|
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/user-guide/nginx-configuration/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
|
||||||
|
|
||||||
|
## Ingress additional labels done as key:value pairs
|
||||||
|
labels: {}
|
||||||
|
|
||||||
|
## 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: minio.local
|
||||||
|
path: /
|
||||||
|
|
||||||
|
## Set this to true in order to enable TLS on the ingress record
|
||||||
|
tls: false
|
||||||
|
|
||||||
|
## Optionally specify the TLS hosts for the ingress record
|
||||||
|
## Useful when the Ingress controller supports www-redirection
|
||||||
|
## If not specified, the above host name will be used
|
||||||
|
# tlsHosts:
|
||||||
|
# - www.minio.local
|
||||||
|
# - minio.local
|
||||||
|
|
||||||
|
## If TLS is set to true, you must declare what secret will store the key/certificate for TLS
|
||||||
|
tlsSecret: minio.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: minio.local-tls
|
||||||
|
# key:
|
||||||
|
# certificate:
|
||||||
|
|
||||||
|
## NetworkPolicy parameters
|
||||||
|
##
|
||||||
|
networkPolicy:
|
||||||
|
## Specifies whether a NetworkPolicy should be created
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
## The Policy model to apply. When set to false, only pods with the correct
|
||||||
|
## client label will have network access to the port MinIO is listening
|
||||||
|
## on. When true, MinIO will accept connections from any source
|
||||||
|
## (with the correct destination port).
|
||||||
|
##
|
||||||
|
allowExternal: true
|
||||||
|
|
||||||
|
## MinIO supports two authentication modes for Prometheus either jwt or public, by default MinIO runs in jwt mode.
|
||||||
|
## To allow public access without authentication for prometheus metrics set environment as follows.
|
||||||
|
prometheusAuthType: public
|
||||||
21
scripts/helm/helm/databases/charts/postgresql/.helmignore
Executable file
21
scripts/helm/helm/databases/charts/postgresql/.helmignore
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# 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
|
||||||
26
scripts/helm/helm/databases/charts/postgresql/Chart.yaml
Executable file
26
scripts/helm/helm/databases/charts/postgresql/Chart.yaml
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
annotations:
|
||||||
|
category: Database
|
||||||
|
apiVersion: v1
|
||||||
|
appVersion: 11.9.0
|
||||||
|
description: Chart for PostgreSQL, an object-relational database management system
|
||||||
|
(ORDBMS) with an emphasis on extensibility and on standards-compliance.
|
||||||
|
engine: gotpl
|
||||||
|
home: https://github.com/bitnami/charts/tree/master/bitnami/postgresql
|
||||||
|
icon: https://bitnami.com/assets/stacks/postgresql/img/postgresql-stack-110x117.png
|
||||||
|
keywords:
|
||||||
|
- postgresql
|
||||||
|
- postgres
|
||||||
|
- database
|
||||||
|
- sql
|
||||||
|
- replication
|
||||||
|
- cluster
|
||||||
|
maintainers:
|
||||||
|
- email: containers@bitnami.com
|
||||||
|
name: Bitnami
|
||||||
|
- email: cedric@desaintmartin.fr
|
||||||
|
name: desaintmartin
|
||||||
|
name: postgresql
|
||||||
|
sources:
|
||||||
|
- https://github.com/bitnami/bitnami-docker-postgresql
|
||||||
|
- https://www.postgresql.org/
|
||||||
|
version: 9.8.2
|
||||||
707
scripts/helm/helm/databases/charts/postgresql/README.md
Executable file
707
scripts/helm/helm/databases/charts/postgresql/README.md
Executable file
|
|
@ -0,0 +1,707 @@
|
||||||
|
# PostgreSQL
|
||||||
|
|
||||||
|
[PostgreSQL](https://www.postgresql.org/) is an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
|
||||||
|
|
||||||
|
For HA, please see [this repo](https://github.com/bitnami/charts/tree/master/bitnami/postgresql-ha)
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||||
|
$ helm install my-release bitnami/postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This chart bootstraps a [PostgreSQL](https://github.com/bitnami/bitnami-docker-postgresql) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||||
|
|
||||||
|
Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the [BKPR](https://kubeprod.io/).
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Kubernetes 1.12+
|
||||||
|
- Helm 2.12+ or Helm 3.0-beta3+
|
||||||
|
- PV provisioner support in the underlying infrastructure
|
||||||
|
|
||||||
|
## Installing the Chart
|
||||||
|
To install the chart with the release name `my-release`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install my-release bitnami/postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
The command deploys PostgreSQL on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
|
||||||
|
|
||||||
|
> **Tip**: List all releases using `helm list`
|
||||||
|
|
||||||
|
## Uninstalling the Chart
|
||||||
|
|
||||||
|
To uninstall/delete the `my-release` deployment:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm delete my-release
|
||||||
|
```
|
||||||
|
|
||||||
|
The command removes all the Kubernetes components but PVC's associated with the chart and deletes the release.
|
||||||
|
|
||||||
|
To delete the PVC's associated with `my-release`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ kubectl delete pvc -l release=my-release
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note**: Deleting the PVC's will delete postgresql data as well. Please be cautious before doing it.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
The following tables lists the configurable parameters of the PostgreSQL chart and their default values.
|
||||||
|
|
||||||
|
| Parameter | Description | Default |
|
||||||
|
|-----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
|
||||||
|
| `global.imageRegistry` | Global Docker Image registry | `nil` |
|
||||||
|
| `global.postgresql.postgresqlDatabase` | PostgreSQL database (overrides `postgresqlDatabase`) | `nil` |
|
||||||
|
| `global.postgresql.postgresqlUsername` | PostgreSQL username (overrides `postgresqlUsername`) | `nil` |
|
||||||
|
| `global.postgresql.existingSecret` | Name of existing secret to use for PostgreSQL passwords (overrides `existingSecret`) | `nil` |
|
||||||
|
| `global.postgresql.postgresqlPassword` | PostgreSQL admin password (overrides `postgresqlPassword`) | `nil` |
|
||||||
|
| `global.postgresql.servicePort` | PostgreSQL port (overrides `service.port`) | `nil` |
|
||||||
|
| `global.postgresql.replicationPassword` | Replication user password (overrides `replication.password`) | `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` |
|
||||||
|
| `image.registry` | PostgreSQL Image registry | `docker.io` |
|
||||||
|
| `image.repository` | PostgreSQL Image name | `bitnami/postgresql` |
|
||||||
|
| `image.tag` | PostgreSQL Image tag | `{TAG_NAME}` |
|
||||||
|
| `image.pullPolicy` | PostgreSQL Image pull policy | `IfNotPresent` |
|
||||||
|
| `image.pullSecrets` | Specify Image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
|
||||||
|
| `image.debug` | Specify if debug values should be set | `false` |
|
||||||
|
| `nameOverride` | String to partially override postgresql.fullname template with a string (will prepend the release name) | `nil` |
|
||||||
|
| `fullnameOverride` | String to fully override postgresql.fullname template with a string | `nil` |
|
||||||
|
| `volumePermissions.enabled` | Enable init container that changes volume permissions in the data directory (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` |
|
||||||
|
| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` |
|
||||||
|
| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` |
|
||||||
|
| `volumePermissions.image.tag` | Init container volume-permissions image tag | `buster` |
|
||||||
|
| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` |
|
||||||
|
| `volumePermissions.securityContext.*` | Other container security context to be included as-is in the container spec | `{}` |
|
||||||
|
| `volumePermissions.securityContext.runAsUser` | User ID for the init container (when facing issues in OpenShift or uid unknown, try value "auto") | `0` |
|
||||||
|
| `usePasswordFile` | Have the secrets mounted as a file instead of env vars | `false` |
|
||||||
|
| `ldap.enabled` | Enable LDAP support | `false` |
|
||||||
|
| `ldap.existingSecret` | Name of existing secret to use for LDAP passwords | `nil` |
|
||||||
|
| `ldap.url` | LDAP URL beginning in the form `ldap[s]://host[:port]/basedn[?[attribute][?[scope][?[filter]]]]` | `nil` |
|
||||||
|
| `ldap.server` | IP address or name of the LDAP server. | `nil` |
|
||||||
|
| `ldap.port` | Port number on the LDAP server to connect to | `nil` |
|
||||||
|
| `ldap.scheme` | Set to `ldaps` to use LDAPS. | `nil` |
|
||||||
|
| `ldap.tls` | Set to `1` to use TLS encryption | `nil` |
|
||||||
|
| `ldap.prefix` | String to prepend to the user name when forming the DN to bind | `nil` |
|
||||||
|
| `ldap.suffix` | String to append to the user name when forming the DN to bind | `nil` |
|
||||||
|
| `ldap.search_attr` | Attribute to match agains the user name in the search | `nil` |
|
||||||
|
| `ldap.search_filter` | The search filter to use when doing search+bind authentication | `nil` |
|
||||||
|
| `ldap.baseDN` | Root DN to begin the search for the user in | `nil` |
|
||||||
|
| `ldap.bindDN` | DN of user to bind to LDAP | `nil` |
|
||||||
|
| `ldap.bind_password` | Password for the user to bind to LDAP | `nil` |
|
||||||
|
| `replication.enabled` | Enable replication | `false` |
|
||||||
|
| `replication.user` | Replication user | `repl_user` |
|
||||||
|
| `replication.password` | Replication user password | `repl_password` |
|
||||||
|
| `replication.slaveReplicas` | Number of slaves replicas | `1` |
|
||||||
|
| `replication.synchronousCommit` | Set synchronous commit mode. Allowed values: `on`, `remote_apply`, `remote_write`, `local` and `off` | `off` |
|
||||||
|
| `replication.numSynchronousReplicas` | Number of replicas that will have synchronous replication. Note: Cannot be greater than `replication.slaveReplicas`. | `0` |
|
||||||
|
| `replication.applicationName` | Cluster application name. Useful for advanced replication settings | `my_application` |
|
||||||
|
| `existingSecret` | Name of existing secret to use for PostgreSQL passwords. The secret has to contain the keys `postgresql-password` which is the password for `postgresqlUsername` when it is different of `postgres`, `postgresql-postgres-password` which will override `postgresqlPassword`, `postgresql-replication-password` which will override `replication.password` and `postgresql-ldap-password` which will be sed to authenticate on LDAP. The value is evaluated as a template. | `nil` |
|
||||||
|
| `postgresqlPostgresPassword` | PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`, in which case`postgres` is the admin username). | _random 10 character alphanumeric string_ |
|
||||||
|
| `postgresqlUsername` | PostgreSQL user (creates a non-admin user when `postgresqlUsername` is not `postgres`) | `postgres` |
|
||||||
|
| `postgresqlPassword` | PostgreSQL user password | _random 10 character alphanumeric string_ |
|
||||||
|
| `postgresqlDatabase` | PostgreSQL database | `nil` |
|
||||||
|
| `postgresqlDataDir` | PostgreSQL data dir folder | `/bitnami/postgresql` (same value as persistence.mountPath) |
|
||||||
|
| `extraEnv` | Any extra environment variables you would like to pass on to the pod. The value is evaluated as a template. | `[]` |
|
||||||
|
| `extraEnvVarsCM` | Name of a Config Map containing extra environment variables you would like to pass on to the pod. The value is evaluated as a template. | `nil` |
|
||||||
|
| `postgresqlInitdbArgs` | PostgreSQL initdb extra arguments | `nil` |
|
||||||
|
| `postgresqlInitdbWalDir` | PostgreSQL location for transaction log | `nil` |
|
||||||
|
| `postgresqlConfiguration` | Runtime Config Parameters | `nil` |
|
||||||
|
| `postgresqlExtendedConf` | Extended Runtime Config Parameters (appended to main or default configuration) | `nil` |
|
||||||
|
| `pgHbaConfiguration` | Content of pg_hba.conf | `nil (do not create pg_hba.conf)` |
|
||||||
|
| `postgresqlSharedPreloadLibraries` | Shared preload libraries (comma-separated list) | `pgaudit` |
|
||||||
|
| `postgresqlMaxConnections` | Maximum total connections | `nil` |
|
||||||
|
| `postgresqlPostgresConnectionLimit` | Maximum total connections for the postgres user | `nil` |
|
||||||
|
| `postgresqlDbUserConnectionLimit` | Maximum total connections for the non-admin user | `nil` |
|
||||||
|
| `postgresqlTcpKeepalivesInterval` | TCP keepalives interval | `nil` |
|
||||||
|
| `postgresqlTcpKeepalivesIdle` | TCP keepalives idle | `nil` |
|
||||||
|
| `postgresqlTcpKeepalivesCount` | TCP keepalives count | `nil` |
|
||||||
|
| `postgresqlStatementTimeout` | Statement timeout | `nil` |
|
||||||
|
| `postgresqlPghbaRemoveFilters` | Comma-separated list of patterns to remove from the pg_hba.conf file | `nil` |
|
||||||
|
| `customLivenessProbe` | Override default liveness probe | `nil` |
|
||||||
|
| `customReadinessProbe` | Override default readiness probe | `nil` |
|
||||||
|
| `audit.logHostname` | Add client hostnames to the log file | `false` |
|
||||||
|
| `audit.logConnections` | Add client log-in operations to the log file | `false` |
|
||||||
|
| `audit.logDisconnections` | Add client log-outs operations to the log file | `false` |
|
||||||
|
| `audit.pgAuditLog` | Add operations to log using the pgAudit extension | `nil` |
|
||||||
|
| `audit.clientMinMessages` | Message log level to share with the user | `nil` |
|
||||||
|
| `audit.logLinePrefix` | Template string for the log line prefix | `nil` |
|
||||||
|
| `audit.logTimezone` | Timezone for the log timestamps | `nil` |
|
||||||
|
| `configurationConfigMap` | ConfigMap with the PostgreSQL configuration files (Note: Overrides `postgresqlConfiguration` and `pgHbaConfiguration`). The value is evaluated as a template. | `nil` |
|
||||||
|
| `extendedConfConfigMap` | ConfigMap with the extended PostgreSQL configuration files. The value is evaluated as a template. | `nil` |
|
||||||
|
| `initdbScripts` | Dictionary of initdb scripts | `nil` |
|
||||||
|
| `initdbUser` | PostgreSQL user to execute the .sql and sql.gz scripts | `nil` |
|
||||||
|
| `initdbPassword` | Password for the user specified in `initdbUser` | `nil` |
|
||||||
|
| `initdbScriptsConfigMap` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`). The value is evaluated as a template. | `nil` |
|
||||||
|
| `initdbScriptsSecret` | Secret with initdb scripts that contain sensitive information (Note: can be used with `initdbScriptsConfigMap` or `initdbScripts`). The value is evaluated as a template. | `nil` |
|
||||||
|
| `service.type` | Kubernetes Service type | `ClusterIP` |
|
||||||
|
| `service.port` | PostgreSQL port | `5432` |
|
||||||
|
| `service.nodePort` | Kubernetes Service nodePort | `nil` |
|
||||||
|
| `service.annotations` | Annotations for PostgreSQL service | `{}` (evaluated as a template) |
|
||||||
|
| `service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` |
|
||||||
|
| `service.loadBalancerSourceRanges` | Address that are allowed when svc is LoadBalancer | `[]` (evaluated as a template) |
|
||||||
|
| `schedulerName` | Name of the k8s scheduler (other than default) | `nil` |
|
||||||
|
| `shmVolume.enabled` | Enable emptyDir volume for /dev/shm for master and slave(s) Pod(s) | `true` |
|
||||||
|
| `shmVolume.chmod.enabled` | Run at init chmod 777 of the /dev/shm (ignored if `volumePermissions.enabled` is `false`) | `true` |
|
||||||
|
| `persistence.enabled` | Enable persistence using PVC | `true` |
|
||||||
|
| `persistence.existingClaim` | Provide an existing `PersistentVolumeClaim`, the value is evaluated as a template. | `nil` |
|
||||||
|
| `persistence.mountPath` | Path to mount the volume at | `/bitnami/postgresql` |
|
||||||
|
| `persistence.subPath` | Subdirectory of the volume to mount at | `""` |
|
||||||
|
| `persistence.storageClass` | PVC Storage Class for PostgreSQL volume | `nil` |
|
||||||
|
| `persistence.accessModes` | PVC Access Mode for PostgreSQL volume | `[ReadWriteOnce]` |
|
||||||
|
| `persistence.size` | PVC Storage Request for PostgreSQL volume | `8Gi` |
|
||||||
|
| `persistence.annotations` | Annotations for the PVC | `{}` |
|
||||||
|
| `commonAnnotations` | Annotations to be added to all deployed resources (rendered as a template) | `{}` |
|
||||||
|
| `master.nodeSelector` | Node labels for pod assignment (postgresql master) | `{}` |
|
||||||
|
| `master.affinity` | Affinity labels for pod assignment (postgresql master) | `{}` |
|
||||||
|
| `master.tolerations` | Toleration labels for pod assignment (postgresql master) | `[]` |
|
||||||
|
| `master.anotations` | Map of annotations to add to the statefulset (postgresql master) | `{}` |
|
||||||
|
| `master.labels` | Map of labels to add to the statefulset (postgresql master) | `{}` |
|
||||||
|
| `master.podAnnotations` | Map of annotations to add to the pods (postgresql master) | `{}` |
|
||||||
|
| `master.podLabels` | Map of labels to add to the pods (postgresql master) | `{}` |
|
||||||
|
| `master.priorityClassName` | Priority Class to use for each pod (postgresql master) | `nil` |
|
||||||
|
| `master.extraInitContainers` | Additional init containers to add to the pods (postgresql master) | `[]` |
|
||||||
|
| `master.extraVolumeMounts` | Additional volume mounts to add to the pods (postgresql master) | `[]` |
|
||||||
|
| `master.extraVolumes` | Additional volumes to add to the pods (postgresql master) | `[]` |
|
||||||
|
| `master.sidecars` | Add additional containers to the pod | `[]` |
|
||||||
|
| `master.service.type` | Allows using a different service type for Master | `nil` |
|
||||||
|
| `master.service.nodePort` | Allows using a different nodePort for Master | `nil` |
|
||||||
|
| `master.service.clusterIP` | Allows using a different clusterIP for Master | `nil` |
|
||||||
|
| `masterAsStandBy.enabled` | Whether to enable current cluster's Master as standby server of another cluster or not. | `false` |
|
||||||
|
| `masterAsStandBy.masterHost` | The Host of replication Master in the other cluster. | `nil` |
|
||||||
|
| `masterAsStandBy.masterPort ` | The Port of replication Master in the other cluster. | `nil` |
|
||||||
|
| `slave.nodeSelector` | Node labels for pod assignment (postgresql slave) | `{}` |
|
||||||
|
| `slave.affinity` | Affinity labels for pod assignment (postgresql slave) | `{}` |
|
||||||
|
| `slave.tolerations` | Toleration labels for pod assignment (postgresql slave) | `[]` |
|
||||||
|
| `slave.anotations` | Map of annotations to add to the statefulsets (postgresql slave) | `{}` |
|
||||||
|
| `slave.resources` | CPU/Memory resource requests/limits override for slaves. Will fallback to `values.resources` if not defined. | `{}` |
|
||||||
|
| `slave.labels` | Map of labels to add to the statefulsets (postgresql slave) | `{}` |
|
||||||
|
| `slave.podAnnotations` | Map of annotations to add to the pods (postgresql slave) | `{}` |
|
||||||
|
| `slave.podLabels` | Map of labels to add to the pods (postgresql slave) | `{}` |
|
||||||
|
| `slave.priorityClassName` | Priority Class to use for each pod (postgresql slave) | `nil` |
|
||||||
|
| `slave.extraInitContainers` | Additional init containers to add to the pods (postgresql slave) | `[]` |
|
||||||
|
| `slave.extraVolumeMounts` | Additional volume mounts to add to the pods (postgresql slave) | `[]` |
|
||||||
|
| `slave.extraVolumes` | Additional volumes to add to the pods (postgresql slave) | `[]` |
|
||||||
|
| `slave.sidecars` | Add additional containers to the pod | `[]` |
|
||||||
|
| `slave.service.type` | Allows using a different service type for Slave | `nil` |
|
||||||
|
| `slave.service.nodePort` | Allows using a different nodePort for Slave | `nil` |
|
||||||
|
| `slave.service.clusterIP` | Allows using a different clusterIP for Slave | `nil` |
|
||||||
|
| `slave.persistence.enabled` | Whether to enable slave replicas persistence | `true` |
|
||||||
|
| `terminationGracePeriodSeconds` | Seconds the pod needs to terminate gracefully | `nil` |
|
||||||
|
| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `250m` |
|
||||||
|
| `securityContext.*` | Other pod security context to be included as-is in the pod spec | `{}` |
|
||||||
|
| `securityContext.enabled` | Enable security context | `true` |
|
||||||
|
| `securityContext.fsGroup` | Group ID for the pod | `1001` |
|
||||||
|
| `containerSecurityContext.*` | Other container security context to be included as-is in the container spec | `{}` |
|
||||||
|
| `containerSecurityContext.enabled` | Enable container security context | `true` |
|
||||||
|
| `containerSecurityContext.runAsUser` | User ID for the container | `1001` |
|
||||||
|
| `serviceAccount.enabled` | Enable service account (Note: Service Account will only be automatically created if `serviceAccount.name` is not set) | `false` |
|
||||||
|
| `serviceAccount.name` | Name of existing service account | `nil` |
|
||||||
|
| `livenessProbe.enabled` | Would you like a livenessProbe to be enabled | `true` |
|
||||||
|
| `networkPolicy.enabled` | Enable NetworkPolicy | `false` |
|
||||||
|
| `networkPolicy.allowExternal` | Don't require client label for connections | `true` |
|
||||||
|
| `networkPolicy.explicitNamespacesSelector` | A Kubernetes LabelSelector to explicitly select namespaces from which ingress traffic could be allowed | `{}` |
|
||||||
|
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 30 |
|
||||||
|
| `livenessProbe.periodSeconds` | How often to perform the probe | 10 |
|
||||||
|
| `livenessProbe.timeoutSeconds` | When the probe times out | 5 |
|
||||||
|
| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 |
|
||||||
|
| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
|
||||||
|
| `readinessProbe.enabled` | would you like a readinessProbe to be enabled | `true` |
|
||||||
|
| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | 5 |
|
||||||
|
| `readinessProbe.periodSeconds` | How often to perform the probe | 10 |
|
||||||
|
| `readinessProbe.timeoutSeconds` | When the probe times out | 5 |
|
||||||
|
| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 |
|
||||||
|
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
|
||||||
|
| `tls.enabled` | Enable TLS traffic support | `false` |
|
||||||
|
| `tls.preferServerCiphers` | Whether to use the server's TLS cipher preferences rather than the client's | `true` |
|
||||||
|
| `tls.certificatesSecret` | Name of an existing secret that contains the certificates | `nil` |
|
||||||
|
| `tls.certFilename` | Certificate filename | `""` |
|
||||||
|
| `tls.certKeyFilename` | Certificate key filename | `""` |
|
||||||
|
| `tls.certCAFilename` | CA Certificate filename. If provided, PostgreSQL will authenticate TLS/SSL clients by requesting them a certificate. | `nil` |
|
||||||
|
| `tls.crlFilename` | File containing a Certificate Revocation List | `nil` |
|
||||||
|
| `metrics.enabled` | Start a prometheus exporter | `false` |
|
||||||
|
| `metrics.service.type` | Kubernetes Service type | `ClusterIP` |
|
||||||
|
| `service.clusterIP` | Static clusterIP or None for headless services | `nil` |
|
||||||
|
| `metrics.service.annotations` | Additional annotations for metrics exporter pod | `{ prometheus.io/scrape: "true", prometheus.io/port: "9187"}` |
|
||||||
|
| `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` |
|
||||||
|
| `metrics.serviceMonitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` |
|
||||||
|
| `metrics.serviceMonitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}` |
|
||||||
|
| `metrics.serviceMonitor.namespace` | Optional namespace in which to create ServiceMonitor | `nil` |
|
||||||
|
| `metrics.serviceMonitor.interval` | Scrape interval. If not set, the Prometheus default scrape interval is used | `nil` |
|
||||||
|
| `metrics.serviceMonitor.scrapeTimeout` | Scrape timeout. If not set, the Prometheus default scrape timeout is used | `nil` |
|
||||||
|
| `metrics.prometheusRule.enabled` | Set this to true to create prometheusRules for Prometheus operator | `false` |
|
||||||
|
| `metrics.prometheusRule.additionalLabels` | Additional labels that can be used so prometheusRules will be discovered by Prometheus | `{}` |
|
||||||
|
| `metrics.prometheusRule.namespace` | namespace where prometheusRules resource should be created | the same namespace as postgresql |
|
||||||
|
| `metrics.prometheusRule.rules` | [rules](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) to be created, check values for an example. | `[]` |
|
||||||
|
| `metrics.image.registry` | PostgreSQL Exporter Image registry | `docker.io` |
|
||||||
|
| `metrics.image.repository` | PostgreSQL Exporter Image name | `bitnami/postgres-exporter` |
|
||||||
|
| `metrics.image.tag` | PostgreSQL Exporter Image tag | `{TAG_NAME}` |
|
||||||
|
| `metrics.image.pullPolicy` | PostgreSQL Exporter Image pull policy | `IfNotPresent` |
|
||||||
|
| `metrics.image.pullSecrets` | Specify Image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
|
||||||
|
| `metrics.customMetrics` | Additional custom metrics | `nil` |
|
||||||
|
| `metrics.extraEnvVars` | Extra environment variables to add to exporter | `{}` (evaluated as a template) |
|
||||||
|
| `metrics.securityContext.*` | Other container security context to be included as-is in the container spec | `{}` |
|
||||||
|
| `metrics.securityContext.enabled` | Enable security context for metrics | `false` |
|
||||||
|
| `metrics.securityContext.runAsUser` | User ID for the container for metrics | `1001` |
|
||||||
|
| `metrics.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 30 |
|
||||||
|
| `metrics.livenessProbe.periodSeconds` | How often to perform the probe | 10 |
|
||||||
|
| `metrics.livenessProbe.timeoutSeconds` | When the probe times out | 5 |
|
||||||
|
| `metrics.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 |
|
||||||
|
| `metrics.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
|
||||||
|
| `metrics.readinessProbe.enabled` | would you like a readinessProbe to be enabled | `true` |
|
||||||
|
| `metrics.readinessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 5 |
|
||||||
|
| `metrics.readinessProbe.periodSeconds` | How often to perform the probe | 10 |
|
||||||
|
| `metrics.readinessProbe.timeoutSeconds` | When the probe times out | 5 |
|
||||||
|
| `metrics.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 |
|
||||||
|
| `metrics.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
|
||||||
|
| `updateStrategy` | Update strategy policy | `{type: "RollingUpdate"}` |
|
||||||
|
| `psp.create` | Create Pod Security Policy | `false` |
|
||||||
|
| `rbac.create` | Create Role and RoleBinding (required for PSP to work) | `false` |
|
||||||
|
| `extraDeploy` | Array of extra objects to deploy with the release (evaluated as a template). | `nil` |
|
||||||
|
|
||||||
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install my-release \
|
||||||
|
--set postgresqlPassword=secretpassword,postgresqlDatabase=my-database \
|
||||||
|
bitnami/postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
The above command sets the PostgreSQL `postgres` account password to `secretpassword`. Additionally it creates a database named `my-database`.
|
||||||
|
|
||||||
|
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install my-release -f values.yaml bitnami/postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||||
|
|
||||||
|
## Configuration and installation details
|
||||||
|
|
||||||
|
### [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.
|
||||||
|
|
||||||
|
### Production configuration and horizontal scaling
|
||||||
|
|
||||||
|
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`. You can use this file instead of the default one.
|
||||||
|
|
||||||
|
- Enable replication:
|
||||||
|
```diff
|
||||||
|
- replication.enabled: false
|
||||||
|
+ replication.enabled: true
|
||||||
|
```
|
||||||
|
|
||||||
|
- Number of slaves replicas:
|
||||||
|
```diff
|
||||||
|
- replication.slaveReplicas: 1
|
||||||
|
+ replication.slaveReplicas: 2
|
||||||
|
```
|
||||||
|
|
||||||
|
- Set synchronous commit mode:
|
||||||
|
```diff
|
||||||
|
- replication.synchronousCommit: "off"
|
||||||
|
+ replication.synchronousCommit: "on"
|
||||||
|
```
|
||||||
|
|
||||||
|
- Number of replicas that will have synchronous replication:
|
||||||
|
```diff
|
||||||
|
- replication.numSynchronousReplicas: 0
|
||||||
|
+ replication.numSynchronousReplicas: 1
|
||||||
|
```
|
||||||
|
|
||||||
|
- Start a prometheus exporter:
|
||||||
|
```diff
|
||||||
|
- metrics.enabled: false
|
||||||
|
+ metrics.enabled: true
|
||||||
|
```
|
||||||
|
|
||||||
|
To horizontally scale this chart, you can use the `--replicas` flag to modify the number of nodes in your PostgreSQL deployment. Also you can use the `values-production.yaml` file or modify the parameters shown above.
|
||||||
|
|
||||||
|
### Customizing Master and Slave services in a replicated configuration
|
||||||
|
|
||||||
|
At the top level, there is a service object which defines the services for both master and slave. For deeper customization, there are service objects for both the master and slave types individually. This allows you to override the values in the top level service object so that the master and slave can be of different service types and with different clusterIPs / nodePorts. Also in the case you want the master and slave to be of type nodePort, you will need to set the nodePorts to different values to prevent a collision. The values that are deeper in the master.service or slave.service objects will take precedence over the top level service object.
|
||||||
|
|
||||||
|
### 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 `image.tag` parameter. For example, `image.tag=X.Y.Z`. This approach is also applicable to other images like exporters.
|
||||||
|
|
||||||
|
### postgresql.conf / pg_hba.conf files as configMap
|
||||||
|
|
||||||
|
This helm chart also supports to customize the whole configuration file.
|
||||||
|
|
||||||
|
Add your custom file to "files/postgresql.conf" in your working directory. This file will be mounted as configMap to the containers and it will be used for configuring the PostgreSQL server.
|
||||||
|
|
||||||
|
Alternatively, you can specify PostgreSQL configuration parameters using the `postgresqlConfiguration` parameter as a dict, using camelCase, e.g. {"sharedBuffers": "500MB"}.
|
||||||
|
|
||||||
|
In addition to these options, you can also set an external ConfigMap with all the configuration files. This is done by setting the `configurationConfigMap` parameter. Note that this will override the two previous options.
|
||||||
|
|
||||||
|
### Allow settings to be loaded from files other than the default `postgresql.conf`
|
||||||
|
|
||||||
|
If you don't want to provide the whole PostgreSQL configuration file and only specify certain parameters, you can add your extended `.conf` files to "files/conf.d/" in your working directory.
|
||||||
|
Those files will be mounted as configMap to the containers adding/overwriting the default configuration using the `include_dir` directive that allows settings to be loaded from files other than the default `postgresql.conf`.
|
||||||
|
|
||||||
|
Alternatively, you can also set an external ConfigMap with all the extra configuration files. This is done by setting the `extendedConfConfigMap` parameter. Note that this will override the previous option.
|
||||||
|
|
||||||
|
### Initialize a fresh instance
|
||||||
|
|
||||||
|
The [Bitnami PostgreSQL](https://github.com/bitnami/bitnami-docker-postgresql) image allows you to use your custom scripts to initialize a fresh instance. In order to execute the scripts, they must be located inside the chart folder `files/docker-entrypoint-initdb.d` so they can be consumed as a ConfigMap.
|
||||||
|
|
||||||
|
Alternatively, you can specify custom scripts using the `initdbScripts` parameter as dict.
|
||||||
|
|
||||||
|
In addition to these options, you can also set an external ConfigMap with all the initialization scripts. This is done by setting the `initdbScriptsConfigMap` parameter. Note that this will override the two previous options. 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`.
|
||||||
|
|
||||||
|
### Securing traffic using TLS
|
||||||
|
|
||||||
|
TLS support can be enabled in the chart by specifying the `tls.` parameters while creating a release. The following parameters should be configured to properly enable the TLS support in the chart:
|
||||||
|
|
||||||
|
- `tls.enabled`: Enable TLS support. Defaults to `false`
|
||||||
|
- `tls.certificatesSecret`: Name of an existing secret that contains the certificates. No defaults.
|
||||||
|
- `tls.certFilename`: Certificate filename. No defaults.
|
||||||
|
- `tls.certKeyFilename`: Certificate key filename. No defaults.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
* First, create the secret with the cetificates files:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl create secret generic certificates-tls-secret --from-file=./cert.crt --from-file=./cert.key --from-file=./ca.crt
|
||||||
|
```
|
||||||
|
|
||||||
|
* Then, use the following parameters:
|
||||||
|
|
||||||
|
```console
|
||||||
|
volumePermissions.enabled=true
|
||||||
|
tls.enabled=true
|
||||||
|
tls.certificatesSecret="certificates-tls-secret"
|
||||||
|
tls.certFilename="cert.crt"
|
||||||
|
tls.certKeyFilename="cert.key"
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note TLS and VolumePermissions: PostgreSQL requires certain permissions on sensitive files (such as certificate keys) to start up. Due to an on-going [issue](https://github.com/kubernetes/kubernetes/issues/57923) regarding kubernetes permissions and the use of `containerSecurityContext.runAsUser`, you must enable `volumePermissions` to ensure everything works as expected.
|
||||||
|
|
||||||
|
### Sidecars
|
||||||
|
|
||||||
|
If you need additional containers to run within the same pod as PostgreSQL (e.g. an additional metrics or logging exporter), you can do so via the `sidecars` config parameter. Simply define your container according to the Kubernetes container spec.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# For the PostgreSQL master
|
||||||
|
master:
|
||||||
|
sidecars:
|
||||||
|
- name: your-image-name
|
||||||
|
image: your-image
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- name: portname
|
||||||
|
containerPort: 1234
|
||||||
|
# For the PostgreSQL replicas
|
||||||
|
slave:
|
||||||
|
sidecars:
|
||||||
|
- name: your-image-name
|
||||||
|
image: your-image
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- name: portname
|
||||||
|
containerPort: 1234
|
||||||
|
```
|
||||||
|
|
||||||
|
### Metrics
|
||||||
|
|
||||||
|
The chart optionally can start a metrics exporter for [prometheus](https://prometheus.io). The metrics endpoint (port 9187) is not exposed and it is expected that the metrics are collected from inside the k8s cluster using something similar as the described in the [example Prometheus scrape configuration](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml).
|
||||||
|
|
||||||
|
The exporter allows to create custom metrics from additional SQL queries. See the Chart's `values.yaml` for an example and consult the [exporters documentation](https://github.com/wrouesnel/postgres_exporter#adding-new-metrics-via-a-config-file) for more details.
|
||||||
|
|
||||||
|
### Use of global variables
|
||||||
|
|
||||||
|
In more complex scenarios, we may have the following tree of dependencies
|
||||||
|
|
||||||
|
```
|
||||||
|
+--------------+
|
||||||
|
| |
|
||||||
|
+------------+ Chart 1 +-----------+
|
||||||
|
| | | |
|
||||||
|
| --------+------+ |
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
v v v
|
||||||
|
+-------+------+ +--------+------+ +--------+------+
|
||||||
|
| | | | | |
|
||||||
|
| PostgreSQL | | 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 as well. In order to do so, subcharts 1 and 2 need to know the PostgreSQL credentials, so one option for deploying could be deploy Chart 1 with the following parameters:
|
||||||
|
|
||||||
|
```
|
||||||
|
postgresql.postgresqlPassword=testtest
|
||||||
|
subchart1.postgresql.postgresqlPassword=testtest
|
||||||
|
subchart2.postgresql.postgresqlPassword=testtest
|
||||||
|
postgresql.postgresqlDatabase=db1
|
||||||
|
subchart1.postgresql.postgresqlDatabase=db1
|
||||||
|
subchart2.postgresql.postgresqlDatabase=db1
|
||||||
|
```
|
||||||
|
|
||||||
|
If the number of dependent sub-charts increases, installing the chart with parameters can become increasingly difficult. An alternative would be to set the credentials using global variables as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
global.postgresql.postgresqlPassword=testtest
|
||||||
|
global.postgresql.postgresqlDatabase=db1
|
||||||
|
```
|
||||||
|
|
||||||
|
This way, the credentials will be available in all of the subcharts.
|
||||||
|
|
||||||
|
## Persistence
|
||||||
|
|
||||||
|
The [Bitnami PostgreSQL](https://github.com/bitnami/bitnami-docker-postgresql) image stores the PostgreSQL data and configurations at the `/bitnami/postgresql` path of the container.
|
||||||
|
|
||||||
|
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
|
||||||
|
See the [Parameters](#parameters) section to configure the PVC or to disable persistence.
|
||||||
|
|
||||||
|
If you already have data in it, you will fail to sync to standby nodes for all commits, details can refer to [code](https://github.com/bitnami/bitnami-docker-postgresql/blob/8725fe1d7d30ebe8d9a16e9175d05f7ad9260c93/9.6/debian-9/rootfs/libpostgresql.sh#L518-L556). If you need to use those data, please covert them to sql and import after `helm install` finished.
|
||||||
|
|
||||||
|
## NetworkPolicy
|
||||||
|
|
||||||
|
To enable network policy for PostgreSQL, install [a networking plugin that implements the Kubernetes NetworkPolicy spec](https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy#before-you-begin), and set `networkPolicy.enabled` to `true`.
|
||||||
|
|
||||||
|
For Kubernetes v1.5 & v1.6, you must also turn on NetworkPolicy by setting the DefaultDeny namespace annotation. Note: this will enforce policy for _all_ pods in the namespace:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ kubectl annotate namespace default "net.beta.kubernetes.io/network-policy={\"ingress\":{\"isolation\":\"DefaultDeny\"}}"
|
||||||
|
```
|
||||||
|
|
||||||
|
With NetworkPolicy enabled, traffic will be limited to just port 5432.
|
||||||
|
|
||||||
|
For more precise policy, set `networkPolicy.allowExternal=false`. This will only allow pods with the generated client label to connect to PostgreSQL.
|
||||||
|
This label will be displayed in the output of a successful install.
|
||||||
|
|
||||||
|
## Differences between Bitnami PostgreSQL image and [Docker Official](https://hub.docker.com/_/postgres) image
|
||||||
|
|
||||||
|
- The Docker Official PostgreSQL image does not support replication. If you pass any replication environment variable, this would be ignored. The only environment variables supported by the Docker Official image are POSTGRES_USER, POSTGRES_DB, POSTGRES_PASSWORD, POSTGRES_INITDB_ARGS, POSTGRES_INITDB_WALDIR and PGDATA. All the remaining environment variables are specific to the Bitnami PostgreSQL image.
|
||||||
|
- The Bitnami PostgreSQL image is non-root by default. This requires that you run the pod with `securityContext` and updates the permissions of the volume with an `initContainer`. A key benefit of this configuration is that the pod follows security best practices and is prepared to run on Kubernetes distributions with hard security constraints like OpenShift.
|
||||||
|
- For OpenShift, one may either define the runAsUser and fsGroup accordingly, or try this more dynamic option: volumePermissions.securityContext.runAsUser="auto",securityContext.enabled=false,containerSecurityContext.enabled=false,shmVolume.chmod.enabled=false
|
||||||
|
|
||||||
|
### Deploy chart using Docker Official PostgreSQL Image
|
||||||
|
|
||||||
|
From chart version 4.0.0, it is possible to use this chart with the Docker Official PostgreSQL image.
|
||||||
|
Besides specifying the new Docker repository and tag, it is important to modify the PostgreSQL data directory and volume mount point. Basically, the PostgreSQL data dir cannot be the mount point directly, it has to be a subdirectory.
|
||||||
|
|
||||||
|
```
|
||||||
|
image.repository=postgres
|
||||||
|
image.tag=10.6
|
||||||
|
postgresqlDataDir=/data/pgdata
|
||||||
|
persistence.mountPath=/data/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Upgrade
|
||||||
|
|
||||||
|
It's necessary to specify the existing passwords while performing an upgrade to ensure the secrets are not updated with invalid randomly generated passwords. Remember to specify the existing values of the `postgresqlPassword` and `replication.password` parameters when upgrading the chart:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm upgrade my-release stable/postgresql \
|
||||||
|
--set postgresqlPassword=[POSTGRESQL_PASSWORD] \
|
||||||
|
--set replication.password=[REPLICATION_PASSWORD]
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note: you need to substitute the placeholders _[POSTGRESQL_PASSWORD]_, and _[REPLICATION_PASSWORD]_ with the values obtained from instructions in the installation notes.
|
||||||
|
|
||||||
|
## 9.0.0
|
||||||
|
|
||||||
|
In this version the chart was adapted to follow the Helm label best practices, see [PR 3021](https://github.com/bitnami/charts/pull/3021). That means the backward compatibility is not guarantee when upgrading the chart to this major version.
|
||||||
|
|
||||||
|
As a workaround, you can delete the existing statefulset (using the `--cascade=false` flag pods are not deleted) before upgrade the chart. For example, this can be a valid workflow:
|
||||||
|
|
||||||
|
- Deploy an old version (8.X.X)
|
||||||
|
```console
|
||||||
|
$ helm install postgresql bitnami/postgresql --version 8.10.14
|
||||||
|
```
|
||||||
|
|
||||||
|
- Old version is up and running
|
||||||
|
```console
|
||||||
|
$ helm ls
|
||||||
|
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
|
||||||
|
postgresql default 1 2020-08-04 13:39:54.783480286 +0000 UTC deployed postgresql-8.10.14 11.8.0
|
||||||
|
|
||||||
|
$ kubectl get pods
|
||||||
|
NAME READY STATUS RESTARTS AGE
|
||||||
|
postgresql-postgresql-0 1/1 Running 0 76s
|
||||||
|
```
|
||||||
|
|
||||||
|
- The upgrade to the latest one (9.X.X) is going to fail
|
||||||
|
```console
|
||||||
|
$ helm upgrade postgresql bitnami/postgresql
|
||||||
|
Error: UPGRADE FAILED: cannot patch "postgresql-postgresql" with kind StatefulSet: StatefulSet.apps "postgresql-postgresql" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden
|
||||||
|
```
|
||||||
|
|
||||||
|
- Delete the statefulset
|
||||||
|
```console
|
||||||
|
$ kubectl delete statefulsets.apps --cascade=false postgresql-postgresql
|
||||||
|
statefulset.apps "postgresql-postgresql" deleted
|
||||||
|
```
|
||||||
|
|
||||||
|
- Now the upgrade works
|
||||||
|
```cosnole
|
||||||
|
$ helm upgrade postgresql bitnami/postgresql
|
||||||
|
$ helm ls
|
||||||
|
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
|
||||||
|
postgresql default 3 2020-08-04 13:42:08.020385884 +0000 UTC deployed postgresql-9.1.2 11.8.0
|
||||||
|
```
|
||||||
|
|
||||||
|
- We can kill the existing pod and the new statefulset is going to create a new one:
|
||||||
|
```console
|
||||||
|
$ kubectl delete pod postgresql-postgresql-0
|
||||||
|
pod "postgresql-postgresql-0" deleted
|
||||||
|
|
||||||
|
$ kubectl get pods
|
||||||
|
NAME READY STATUS RESTARTS AGE
|
||||||
|
postgresql-postgresql-0 1/1 Running 0 19s
|
||||||
|
```
|
||||||
|
|
||||||
|
Please, note that without the `--cascade=false` both objects (statefulset and pod) are going to be removed and both objects will be deployed again with the `helm upgrade` command
|
||||||
|
|
||||||
|
## 8.0.0
|
||||||
|
|
||||||
|
Prefixes the port names with their protocols to comply with Istio conventions.
|
||||||
|
|
||||||
|
If you depend on the port names in your setup, make sure to update them to reflect this change.
|
||||||
|
|
||||||
|
## 7.1.0
|
||||||
|
|
||||||
|
Adds support for LDAP configuration.
|
||||||
|
|
||||||
|
## 7.0.0
|
||||||
|
|
||||||
|
Helm performs a lookup for the object based on its group (apps), version (v1), and kind (Deployment). Also known as its GroupVersionKind, or GVK. Changing the GVK is considered a compatibility breaker from Kubernetes' point of view, so you cannot "upgrade" those objects to the new GVK in-place. Earlier versions of Helm 3 did not perform the lookup correctly which has since been fixed to match the spec.
|
||||||
|
|
||||||
|
In https://github.com/helm/charts/pull/17281 the `apiVersion` of the statefulset resources was updated to `apps/v1` in tune with the api's deprecated, resulting in compatibility breakage.
|
||||||
|
|
||||||
|
This major version bump signifies this change.
|
||||||
|
|
||||||
|
## 6.5.7
|
||||||
|
|
||||||
|
In this version, the chart will use PostgreSQL with the Postgis extension included. The version used with Postgresql version 10, 11 and 12 is Postgis 2.5. It has been compiled with the following dependencies:
|
||||||
|
|
||||||
|
- protobuf
|
||||||
|
- protobuf-c
|
||||||
|
- json-c
|
||||||
|
- geos
|
||||||
|
- proj
|
||||||
|
|
||||||
|
## 5.0.0
|
||||||
|
|
||||||
|
In this version, the **chart is using PostgreSQL 11 instead of PostgreSQL 10**. You can find the main difference and notable changes in the following links: [https://www.postgresql.org/about/news/1894/](https://www.postgresql.org/about/news/1894/) and [https://www.postgresql.org/about/featurematrix/](https://www.postgresql.org/about/featurematrix/).
|
||||||
|
|
||||||
|
For major releases of PostgreSQL, the internal data storage format is subject to change, thus complicating upgrades, you can see some errors like the following one in the logs:
|
||||||
|
|
||||||
|
```console
|
||||||
|
Welcome to the Bitnami postgresql container
|
||||||
|
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
|
||||||
|
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
|
||||||
|
Send us your feedback at containers@bitnami.com
|
||||||
|
|
||||||
|
INFO ==> ** Starting PostgreSQL setup **
|
||||||
|
NFO ==> Validating settings in POSTGRESQL_* env vars..
|
||||||
|
INFO ==> Initializing PostgreSQL database...
|
||||||
|
INFO ==> postgresql.conf file not detected. Generating it...
|
||||||
|
INFO ==> pg_hba.conf file not detected. Generating it...
|
||||||
|
INFO ==> Deploying PostgreSQL with persisted data...
|
||||||
|
INFO ==> Configuring replication parameters
|
||||||
|
INFO ==> Loading custom scripts...
|
||||||
|
INFO ==> Enabling remote connections
|
||||||
|
INFO ==> Stopping PostgreSQL...
|
||||||
|
INFO ==> ** PostgreSQL setup finished! **
|
||||||
|
|
||||||
|
INFO ==> ** Starting PostgreSQL **
|
||||||
|
[1] FATAL: database files are incompatible with server
|
||||||
|
[1] DETAIL: The data directory was initialized by PostgreSQL version 10, which is not compatible with this version 11.3.
|
||||||
|
```
|
||||||
|
|
||||||
|
In this case, you should migrate the data from the old chart to the new one following an approach similar to that described in [this section](https://www.postgresql.org/docs/current/upgrading.html#UPGRADING-VIA-PGDUMPALL) from the official documentation. Basically, create a database dump in the old chart, move and restore it in the new one.
|
||||||
|
|
||||||
|
### 4.0.0
|
||||||
|
|
||||||
|
This chart will use by default the Bitnami PostgreSQL container starting from version `10.7.0-r68`. This version moves the initialization logic from node.js to bash. This new version of the chart requires setting the `POSTGRES_PASSWORD` in the slaves as well, in order to properly configure the `pg_hba.conf` file. Users from previous versions of the chart are advised to upgrade immediately.
|
||||||
|
|
||||||
|
IMPORTANT: If you do not want to upgrade the chart version then make sure you use the `10.7.0-r68` version of the container. Otherwise, you will get this error
|
||||||
|
|
||||||
|
```
|
||||||
|
The POSTGRESQL_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.0.0
|
||||||
|
|
||||||
|
This releases make it possible to specify different nodeSelector, affinity and tolerations for master and slave pods.
|
||||||
|
It also fixes an issue with `postgresql.master.fullname` helper template not obeying fullnameOverride.
|
||||||
|
|
||||||
|
#### Breaking changes
|
||||||
|
|
||||||
|
- `affinty` has been renamed to `master.affinity` and `slave.affinity`.
|
||||||
|
- `tolerations` has been renamed to `master.tolerations` and `slave.tolerations`.
|
||||||
|
- `nodeSelector` has been renamed to `master.nodeSelector` and `slave.nodeSelector`.
|
||||||
|
|
||||||
|
### 2.0.0
|
||||||
|
|
||||||
|
In order to upgrade from the `0.X.X` branch to `1.X.X`, you should follow the below steps:
|
||||||
|
|
||||||
|
- Obtain the service name (`SERVICE_NAME`) and password (`OLD_PASSWORD`) of the existing postgresql chart. You can find the instructions to obtain the password in the NOTES.txt, the service name can be obtained by running
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ kubectl get svc
|
||||||
|
```
|
||||||
|
|
||||||
|
- Install (not upgrade) the new version
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm repo update
|
||||||
|
$ helm install my-release bitnami/postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
- Connect to the new pod (you can obtain the name by running `kubectl get pods`):
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ kubectl exec -it NAME bash
|
||||||
|
```
|
||||||
|
|
||||||
|
- Once logged in, create a dump file from the previous database using `pg_dump`, for that we should connect to the previous postgresql chart:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ pg_dump -h SERVICE_NAME -U postgres DATABASE_NAME > /tmp/backup.sql
|
||||||
|
```
|
||||||
|
|
||||||
|
After run above command you should be prompted for a password, this password is the previous chart password (`OLD_PASSWORD`).
|
||||||
|
This operation could take some time depending on the database size.
|
||||||
|
|
||||||
|
- Once you have the backup file, you can restore it with a command like the one below:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ psql -U postgres DATABASE_NAME < /tmp/backup.sql
|
||||||
|
```
|
||||||
|
|
||||||
|
In this case, you are accessing to the local postgresql, so the password should be the new one (you can find it in NOTES.txt).
|
||||||
|
|
||||||
|
If you want to restore the database and the database schema does not exist, it is necessary to first follow the steps described below.
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ psql -U postgres
|
||||||
|
postgres=# drop database DATABASE_NAME;
|
||||||
|
postgres=# create database DATABASE_NAME;
|
||||||
|
postgres=# create user USER_NAME;
|
||||||
|
postgres=# alter role USER_NAME with password 'BITNAMI_USER_PASSWORD';
|
||||||
|
postgres=# grant all privileges on database DATABASE_NAME to USER_NAME;
|
||||||
|
postgres=# alter database DATABASE_NAME owner to USER_NAME;
|
||||||
|
```
|
||||||
22
scripts/helm/helm/databases/charts/postgresql/charts/common/.helmignore
Executable file
22
scripts/helm/helm/databases/charts/postgresql/charts/common/.helmignore
Executable file
|
|
@ -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/
|
||||||
22
scripts/helm/helm/databases/charts/postgresql/charts/common/Chart.yaml
Executable file
22
scripts/helm/helm/databases/charts/postgresql/charts/common/Chart.yaml
Executable file
|
|
@ -0,0 +1,22 @@
|
||||||
|
annotations:
|
||||||
|
category: Infrastructure
|
||||||
|
apiVersion: v1
|
||||||
|
appVersion: 0.8.1
|
||||||
|
description: A Library Helm Chart for grouping common logic between bitnami charts.
|
||||||
|
This chart is not deployable by itself.
|
||||||
|
home: https://github.com/bitnami/charts/tree/master/bitnami/common
|
||||||
|
icon: https://bitnami.com/downloads/logos/bitnami-mark.png
|
||||||
|
keywords:
|
||||||
|
- common
|
||||||
|
- helper
|
||||||
|
- template
|
||||||
|
- function
|
||||||
|
- bitnami
|
||||||
|
maintainers:
|
||||||
|
- email: containers@bitnami.com
|
||||||
|
name: Bitnami
|
||||||
|
name: common
|
||||||
|
sources:
|
||||||
|
- https://github.com/bitnami/charts
|
||||||
|
- http://www.bitnami.com/
|
||||||
|
version: 0.8.1
|
||||||
286
scripts/helm/helm/databases/charts/postgresql/charts/common/README.md
Executable file
286
scripts/helm/helm/databases/charts/postgresql/charts/common/README.md
Executable file
|
|
@ -0,0 +1,286 @@
|
||||||
|
# Bitnami Common Library Chart
|
||||||
|
|
||||||
|
A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts.
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
version: 0.x.x
|
||||||
|
repository: https://charts.bitnami.com/bitnami
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm dependency update
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
data:
|
||||||
|
myvalue: "Hello World"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager.
|
||||||
|
|
||||||
|
Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This Helm chart has been tested on top of [Bitnami Kubernetes Production Runtime](https://kubeprod.io/) (BKPR). Deploy BKPR to get automated TLS certificates, logging and monitoring for your applications.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Kubernetes 1.12+
|
||||||
|
- Helm 2.12+ or Helm 3.0-beta3+
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
The following table lists the helpers available in the library which are scoped in different sections.
|
||||||
|
|
||||||
|
### Affinities
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|-------------------------------------|-----------------------------------------------------------------|------------------------------------------------------------------|
|
||||||
|
| `common.affinities.node.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` |
|
||||||
|
| `common.affinities.node.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` |
|
||||||
|
| `common.affinities.pod.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` |
|
||||||
|
| `common.affinities.pod.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` |
|
||||||
|
|
||||||
|
### Capabilities
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|------------------------------------------------|-----------------------------------------------------------------|----------------------------|
|
||||||
|
| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context |
|
||||||
|
| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context |
|
||||||
|
| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context |
|
||||||
|
|
||||||
|
### Errors
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|
||||||
|
| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` |
|
||||||
|
|
||||||
|
### Images
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------|-----------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. |
|
||||||
|
| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` |
|
||||||
|
|
||||||
|
### Labels
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------|-----------------------------------------------------------------|-----------------------------|
|
||||||
|
| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context |
|
||||||
|
| `common.labels.matchLabels` | Return the proper Docker Image Registry Secret Names | `.` Chart context |
|
||||||
|
|
||||||
|
### Names
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------|-----------------------------------------------------------------|-----------------------------|
|
||||||
|
| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context |
|
||||||
|
| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context |
|
||||||
|
| `common.names.chart` | Chart name plus version | `.` Chart context |
|
||||||
|
|
||||||
|
### Secrets
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------|-----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. |
|
||||||
|
| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. |
|
||||||
|
|
||||||
|
### Storage
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------|-----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.affinities.node.soft` | Return a soft nodeAffinity definition | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. |
|
||||||
|
|
||||||
|
### TplValues
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------|-----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frecuently is the chart context `$` or `.` |
|
||||||
|
|
||||||
|
### Utils
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------|-----------------------------------------------------------------|------------------------------------------------------------------------|
|
||||||
|
| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` |
|
||||||
|
| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` |
|
||||||
|
| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` |
|
||||||
|
|
||||||
|
### Validations
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "context" $` secret and field are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) |
|
||||||
|
| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) |
|
||||||
|
| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. |
|
||||||
|
| `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. |
|
||||||
|
|
||||||
|
### Warnings
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------|-----------------------------------------------------------------|------------------------------------------------------------------|
|
||||||
|
| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. |
|
||||||
|
|
||||||
|
## Special input schemas
|
||||||
|
|
||||||
|
### ImageRoot
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
registry:
|
||||||
|
type: string
|
||||||
|
description: Docker registry where the image is located
|
||||||
|
example: docker.io
|
||||||
|
|
||||||
|
repository:
|
||||||
|
type: string
|
||||||
|
description: Repository and image name
|
||||||
|
example: bitnami/nginx
|
||||||
|
|
||||||
|
tag:
|
||||||
|
type: string
|
||||||
|
description: image tag
|
||||||
|
example: 1.16.1-debian-10-r63
|
||||||
|
|
||||||
|
pullPolicy:
|
||||||
|
type: string
|
||||||
|
description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||||
|
|
||||||
|
pullSecrets:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
description: Optionally specify an array of imagePullSecrets.
|
||||||
|
|
||||||
|
debug:
|
||||||
|
type: boolean
|
||||||
|
description: Set to true if you would like to see extra information on logs
|
||||||
|
example: false
|
||||||
|
|
||||||
|
## An instance would be:
|
||||||
|
# registry: docker.io
|
||||||
|
# repository: bitnami/nginx
|
||||||
|
# tag: 1.16.1-debian-10-r63
|
||||||
|
# pullPolicy: IfNotPresent
|
||||||
|
# debug: false
|
||||||
|
```
|
||||||
|
|
||||||
|
### Persistence
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
enabled:
|
||||||
|
type: boolean
|
||||||
|
description: Whether enable persistence.
|
||||||
|
example: true
|
||||||
|
|
||||||
|
storageClass:
|
||||||
|
type: string
|
||||||
|
description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning.
|
||||||
|
example: "-"
|
||||||
|
|
||||||
|
accessMode:
|
||||||
|
type: string
|
||||||
|
description: Access mode for the Persistent Volume Storage.
|
||||||
|
example: ReadWriteOnce
|
||||||
|
|
||||||
|
size:
|
||||||
|
type: string
|
||||||
|
description: Size the Persistent Volume Storage.
|
||||||
|
example: 8Gi
|
||||||
|
|
||||||
|
path:
|
||||||
|
type: string
|
||||||
|
description: Path to be persisted.
|
||||||
|
example: /bitnami
|
||||||
|
|
||||||
|
## An instance would be:
|
||||||
|
# enabled: true
|
||||||
|
# storageClass: "-"
|
||||||
|
# accessMode: ReadWriteOnce
|
||||||
|
# size: 8Gi
|
||||||
|
# path: /bitnami
|
||||||
|
```
|
||||||
|
|
||||||
|
### ExistingSecret
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: Name of the existing secret.
|
||||||
|
example: mySecret
|
||||||
|
keyMapping:
|
||||||
|
description: Mapping between the expected key name and the name of the key in the existing secret.
|
||||||
|
type: object
|
||||||
|
|
||||||
|
## An instance would be:
|
||||||
|
# name: mySecret
|
||||||
|
# keyMapping:
|
||||||
|
# password: myPasswordKey
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example of use
|
||||||
|
|
||||||
|
When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# templates/secret.yaml
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "common.names.fullname" . }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
password: {{ .Values.password | b64enc | quote }}
|
||||||
|
|
||||||
|
# templates/dpl.yaml
|
||||||
|
---
|
||||||
|
...
|
||||||
|
env:
|
||||||
|
- name: PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }}
|
||||||
|
key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }}
|
||||||
|
...
|
||||||
|
|
||||||
|
# values.yaml
|
||||||
|
---
|
||||||
|
name: mySecret
|
||||||
|
keyMapping:
|
||||||
|
password: myPasswordKey
|
||||||
|
```
|
||||||
|
|
||||||
|
### ValidateValue
|
||||||
|
|
||||||
|
#### NOTES.txt
|
||||||
|
|
||||||
|
```console
|
||||||
|
{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}}
|
||||||
|
{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}}
|
||||||
|
|
||||||
|
{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||||
|
```
|
||||||
|
|
||||||
|
If we force those values to be empty we will see some alerts
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install test mychart --set path.to.value00="",path.to.value01=""
|
||||||
|
'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value:
|
||||||
|
|
||||||
|
export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 --decode)
|
||||||
|
|
||||||
|
'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value:
|
||||||
|
|
||||||
|
export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 --decode)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notable changes
|
||||||
|
|
||||||
|
N/A
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a soft nodeAffinity definition
|
||||||
|
{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.nodes.soft" -}}
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- preference:
|
||||||
|
matchExpressions:
|
||||||
|
key: {{ .key }}
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
{{- range .values }}
|
||||||
|
- {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
weight: 1
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a hard nodeAffinity definition
|
||||||
|
{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.nodes.hard" -}}
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
nodeSelectorTerms:
|
||||||
|
- matchExpressions:
|
||||||
|
key: {{ .key }}
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
{{- range .values }}
|
||||||
|
- {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a nodeAffinity definition
|
||||||
|
{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.nodes" -}}
|
||||||
|
{{- if eq .type "soft" }}
|
||||||
|
{{- include "common.affinities.nodes.soft" . -}}
|
||||||
|
{{- else if eq .type "hard" }}
|
||||||
|
{{- include "common.affinities.nodes.hard" . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a soft podAffinity/podAntiAffinity definition
|
||||||
|
{{ include "common.affinities.pods.soft" (dict "component" "FOO" "context" $) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.pods.soft" -}}
|
||||||
|
{{- $component := default "" .component -}}
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }}
|
||||||
|
{{- if not (empty $component) }}
|
||||||
|
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||||
|
{{- end }}
|
||||||
|
namespaces:
|
||||||
|
- {{ .context.Release.Namespace }}
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
weight: 1
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a hard podAffinity/podAntiAffinity definition
|
||||||
|
{{ include "common.affinities.pods.hard" (dict "component" "FOO" "context" $) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.pods.hard" -}}
|
||||||
|
{{- $component := default "" .component -}}
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- labelSelector:
|
||||||
|
matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }}
|
||||||
|
{{- if not (empty $component) }}
|
||||||
|
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||||
|
{{- end }}
|
||||||
|
namespaces:
|
||||||
|
- {{ .context.Release.Namespace }}
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a podAffinity/podAntiAffinity definition
|
||||||
|
{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.pods" -}}
|
||||||
|
{{- if eq .type "soft" }}
|
||||||
|
{{- include "common.affinities.pods.soft" . -}}
|
||||||
|
{{- else if eq .type "hard" }}
|
||||||
|
{{- include "common.affinities.pods.hard" . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for deployment.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.deployment.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apps/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for statefulset.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.statefulset.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
{{- print "apps/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apps/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for ingress.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.ingress.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "networking.k8s.io/v1beta1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Through error when upgrading using empty passwords values that must not be empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
|
||||||
|
{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
|
||||||
|
{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
|
||||||
|
|
||||||
|
Required password params:
|
||||||
|
- validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
|
||||||
|
- context - Context - Required. Parent context.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.errors.upgrade.passwords.empty" -}}
|
||||||
|
{{- $validationErrors := join "" .validationErrors -}}
|
||||||
|
{{- if and $validationErrors .context.Release.IsUpgrade -}}
|
||||||
|
{{- $errorString := "\nPASSWORDS ERROR: you must provide your current passwords when upgrade the release%s" -}}
|
||||||
|
{{- printf $errorString $validationErrors | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Return the proper image name
|
||||||
|
{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.images.image" -}}
|
||||||
|
{{- $registryName := .imageRoot.registry -}}
|
||||||
|
{{- $repositoryName := .imageRoot.repository -}}
|
||||||
|
{{- $tag := .imageRoot.tag | toString -}}
|
||||||
|
{{- if .global }}
|
||||||
|
{{- if .global.imageRegistry }}
|
||||||
|
{{- $registryName = .global.imageRegistry -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper Docker Image Registry Secret Names
|
||||||
|
{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.images.pullSecrets" -}}
|
||||||
|
{{- $pullSecrets := list }}
|
||||||
|
|
||||||
|
{{- if .global }}
|
||||||
|
{{- range .global.imagePullSecrets -}}
|
||||||
|
{{- $pullSecrets = append $pullSecrets . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- range .images -}}
|
||||||
|
{{- range .pullSecrets -}}
|
||||||
|
{{- $pullSecrets = append $pullSecrets . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (not (empty $pullSecrets)) }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- range $pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Kubernetes standard labels
|
||||||
|
*/}}
|
||||||
|
{{- define "common.labels.standard" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||||
|
helm.sh/chart: {{ include "common.names.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 "common.labels.matchLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | 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 "common.names.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 -}}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Generate secret name.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- existingSecret - ExistingSecret - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||||
|
to be used istead of the default one. +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret
|
||||||
|
- defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment.
|
||||||
|
- context - Dict - Required. The context for the template evaluation.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.name" -}}
|
||||||
|
{{- $name := (include "common.names.fullname" .context) -}}
|
||||||
|
|
||||||
|
{{- if .defaultNameSuffix -}}
|
||||||
|
{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- with .existingSecret -}}
|
||||||
|
{{- $name = .name -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- printf "%s" $name -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Generate secret key.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- existingSecret - ExistingSecret - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||||
|
to be used istead of the default one. +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret
|
||||||
|
- key - String - Required. Name of the key in the secret.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.key" -}}
|
||||||
|
{{- $key := .key -}}
|
||||||
|
|
||||||
|
{{- if .existingSecret -}}
|
||||||
|
{{- if .existingSecret.keyMapping -}}
|
||||||
|
{{- $key = index .existingSecret.keyMapping $.key -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- printf "%s" $key -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Return the proper Storage Class
|
||||||
|
{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.storage.class" -}}
|
||||||
|
|
||||||
|
{{- $storageClass := .persistence.storageClass -}}
|
||||||
|
{{- if .global -}}
|
||||||
|
{{- if .global.storageClass -}}
|
||||||
|
{{- $storageClass = .global.storageClass -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if $storageClass -}}
|
||||||
|
{{- if (eq "-" $storageClass) -}}
|
||||||
|
{{- printf "storageClassName: \"\"" -}}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "storageClassName: %s" $storageClass -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Renders a value that contains template.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.tplvalues.render" -}}
|
||||||
|
{{- if typeIs "string" .value }}
|
||||||
|
{{- tpl .value .context }}
|
||||||
|
{{- else }}
|
||||||
|
{{- tpl (.value | toYaml) .context }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Print instructions to get a secret value.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.secret.getvalue" -}}
|
||||||
|
{{- $varname := include "common.utils.fieldToEnvVar" . -}}
|
||||||
|
export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 --decode)
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Build env var name given a field
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.fieldToEnvVar" -}}
|
||||||
|
{{- $fieldNameSplit := splitList "-" .field -}}
|
||||||
|
{{- $upperCaseFieldNameSplit := list -}}
|
||||||
|
|
||||||
|
{{- range $fieldNameSplit -}}
|
||||||
|
{{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{ join "_" $upperCaseFieldNameSplit }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Gets a value from .Values given
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.getValueFromKey" -}}
|
||||||
|
{{- $splitKey := splitList "." .key -}}
|
||||||
|
{{- $value := "" -}}
|
||||||
|
{{- $latestObj := $.context.Values -}}
|
||||||
|
{{- range $splitKey -}}
|
||||||
|
{{- if not $latestObj -}}
|
||||||
|
{{- printf "please review the entire path of '%s' exists in values" $.key | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $value = ( index $latestObj . ) -}}
|
||||||
|
{{- $latestObj = $value -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "%v" (default "" $value) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,278 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate values must not be empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}}
|
||||||
|
{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}}
|
||||||
|
{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||||
|
|
||||||
|
Validate value params:
|
||||||
|
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||||
|
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||||
|
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.multiple.empty" -}}
|
||||||
|
{{- range .required -}}
|
||||||
|
{{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Validate a value must not be empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "context" $) }}
|
||||||
|
|
||||||
|
Validate value params:
|
||||||
|
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||||
|
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||||
|
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.single.empty" -}}
|
||||||
|
{{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }}
|
||||||
|
|
||||||
|
{{- if not $value -}}
|
||||||
|
{{- $varname := "my-value" -}}
|
||||||
|
{{- $getCurrentValue := "" -}}
|
||||||
|
{{- if and .secret .field -}}
|
||||||
|
{{- $varname = include "common.utils.fieldToEnvVar" . -}}
|
||||||
|
{{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "\n '%s' must not be empty, please add '--set %s=$%s' to the command.%s" .valueKey .valueKey $varname $getCurrentValue -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Validate MariaDB required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.mariadb.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.mariadb.values.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.mariadb.values.enabled" . -}}
|
||||||
|
{{- $architecture := include "common.mariadb.values.architecture" . -}}
|
||||||
|
{{- $authPrefix := include "common.mariadb.values.key.auth" . -}}
|
||||||
|
{{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}}
|
||||||
|
{{- $valueKeyUsername := printf "%s.username" $authPrefix -}}
|
||||||
|
{{- $valueKeyPassword := printf "%s.password" $authPrefix -}}
|
||||||
|
{{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}}
|
||||||
|
|
||||||
|
{{- if and (not $existingSecret) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}}
|
||||||
|
|
||||||
|
{{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }}
|
||||||
|
{{- if not (empty $valueUsername) -}}
|
||||||
|
{{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (eq $architecture "replication") -}}
|
||||||
|
{{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.existingSecret" (dict "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.existingSecret" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mariadb.existingSecret | quote -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.existingSecret | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to get the right value for enabled mariadb.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.mariadb.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to get the right value for architecture
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.architecture" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mariadb.architecture -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.architecture -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to get the right value for the key auth
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.key.auth" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
mariadb.auth
|
||||||
|
{{- else -}}
|
||||||
|
auth
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Validate PostgreSQL required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where postgresql values are stored, e.g: "mysql-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.postgresql.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.postgresql.values.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.postgresql.values.enabled" . -}}
|
||||||
|
{{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}}
|
||||||
|
{{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}}
|
||||||
|
{{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}}
|
||||||
|
|
||||||
|
{{- if and (not $existingSecret) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}}
|
||||||
|
|
||||||
|
{{- if (eq $enabledReplication "true") -}}
|
||||||
|
{{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to decide whether evaluate global values.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- key - String - Required. Field to be evaluated within global, e.g: "existingSecret"
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.use.global" -}}
|
||||||
|
{{- if .context.Values.global -}}
|
||||||
|
{{- if .context.Values.global.postgresql -}}
|
||||||
|
{{- index .context.Values.global.postgresql .key | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.existingSecret" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.existingSecret" -}}
|
||||||
|
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}}
|
||||||
|
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- default (.context.Values.existingSecret | quote) $globalValue -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to get the right value for enabled postgresql.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.postgresql.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to get the right value for the key postgressPassword.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.key.postgressPassword" -}}
|
||||||
|
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}}
|
||||||
|
|
||||||
|
{{- if not $globalValue -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
postgresql.postgresqlPassword
|
||||||
|
{{- else -}}
|
||||||
|
postgresqlPassword
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
global.postgresql.postgresqlPassword
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to get the right value for enabled.replication.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.enabled.replication" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.postgresql.replication.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" .context.Values.replication.enabled -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliar function to get the right value for the key replication.password.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.key.replicationPassword" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
postgresql.replication.password
|
||||||
|
{{- else -}}
|
||||||
|
replication.password
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Warning about using rolling tag.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.warnings.rollingTag" -}}
|
||||||
|
|
||||||
|
{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||||
|
WARNING: Rolling tag detected ({{ .repository }}:{{ .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 -}}
|
||||||
3
scripts/helm/helm/databases/charts/postgresql/charts/common/values.yaml
Executable file
3
scripts/helm/helm/databases/charts/postgresql/charts/common/values.yaml
Executable file
|
|
@ -0,0 +1,3 @@
|
||||||
|
## bitnami/common
|
||||||
|
## It is required by CI/CD tools and processes.
|
||||||
|
exampleValue: common-chart
|
||||||
3
scripts/helm/helm/databases/charts/postgresql/ci/commonAnnotations.yaml
Executable file
3
scripts/helm/helm/databases/charts/postgresql/ci/commonAnnotations.yaml
Executable file
|
|
@ -0,0 +1,3 @@
|
||||||
|
commonAnnotations:
|
||||||
|
helm.sh/hook: 'pre-install, pre-upgrade'
|
||||||
|
helm.sh/hook-weight: '-1'
|
||||||
1
scripts/helm/helm/databases/charts/postgresql/ci/default-values.yaml
Executable file
1
scripts/helm/helm/databases/charts/postgresql/ci/default-values.yaml
Executable file
|
|
@ -0,0 +1 @@
|
||||||
|
# Leave this file empty to ensure that CI runs builds against the default configuration in values.yaml.
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
shmVolume:
|
||||||
|
enabled: false
|
||||||
1
scripts/helm/helm/databases/charts/postgresql/files/README.md
Executable file
1
scripts/helm/helm/databases/charts/postgresql/files/README.md
Executable file
|
|
@ -0,0 +1 @@
|
||||||
|
Copy here your postgresql.conf and/or pg_hba.conf files to use it as a config map.
|
||||||
4
scripts/helm/helm/databases/charts/postgresql/files/conf.d/README.md
Executable file
4
scripts/helm/helm/databases/charts/postgresql/files/conf.d/README.md
Executable file
|
|
@ -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 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](https://github.com/bitnami/bitnami-docker-postgresql#initializing-a-new-instance) repository.
|
||||||
185
scripts/helm/helm/databases/charts/postgresql/postgresql.yaml
Normal file
185
scripts/helm/helm/databases/charts/postgresql/postgresql.yaml
Normal file
|
|
@ -0,0 +1,185 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: db
|
||||||
|
---
|
||||||
|
# Source: postgresql/templates/secrets.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: postgres-postgresql
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
helm.sh/chart: postgresql-9.8.2
|
||||||
|
app.kubernetes.io/instance: postgres
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
postgresql-password: "YXNheWVyUG9zdGdyZXM="
|
||||||
|
---
|
||||||
|
# Source: postgresql/templates/svc-headless.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: postgres-postgresql-headless
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
helm.sh/chart: postgresql-9.8.2
|
||||||
|
app.kubernetes.io/instance: postgres
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
clusterIP: None
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
port: 5432
|
||||||
|
targetPort: tcp-postgresql
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
app.kubernetes.io/instance: postgres
|
||||||
|
---
|
||||||
|
# Source: postgresql/templates/svc.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: postgres-postgresql
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
helm.sh/chart: postgresql-9.8.2
|
||||||
|
app.kubernetes.io/instance: postgres
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
annotations:
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
port: 5432
|
||||||
|
targetPort: tcp-postgresql
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
app.kubernetes.io/instance: postgres
|
||||||
|
role: master
|
||||||
|
---
|
||||||
|
# Source: postgresql/templates/statefulset.yaml
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: postgres-postgresql
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
helm.sh/chart: postgresql-9.8.2
|
||||||
|
app.kubernetes.io/instance: postgres
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
annotations:
|
||||||
|
spec:
|
||||||
|
serviceName: postgres-postgresql-headless
|
||||||
|
replicas: 1
|
||||||
|
updateStrategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
app.kubernetes.io/instance: postgres
|
||||||
|
role: master
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: postgres-postgresql
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
helm.sh/chart: postgresql-9.8.2
|
||||||
|
app.kubernetes.io/instance: postgres
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
role: master
|
||||||
|
spec:
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 1001
|
||||||
|
containers:
|
||||||
|
- name: postgres-postgresql
|
||||||
|
image: docker.io/bitnami/postgresql:11.9.0-debian-10-r48
|
||||||
|
imagePullPolicy: "IfNotPresent"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 256Mi
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 1001
|
||||||
|
env:
|
||||||
|
- name: BITNAMI_DEBUG
|
||||||
|
value: "false"
|
||||||
|
- name: POSTGRESQL_PORT_NUMBER
|
||||||
|
value: "5432"
|
||||||
|
- name: POSTGRESQL_VOLUME_DIR
|
||||||
|
value: "/bitnami/postgresql"
|
||||||
|
- name: PGDATA
|
||||||
|
value: "/bitnami/postgresql/data"
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
value: "postgres"
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: postgres-postgresql
|
||||||
|
key: postgresql-password
|
||||||
|
- name: POSTGRESQL_ENABLE_LDAP
|
||||||
|
value: "no"
|
||||||
|
- name: POSTGRESQL_ENABLE_TLS
|
||||||
|
value: "no"
|
||||||
|
- name: POSTGRESQL_LOG_HOSTNAME
|
||||||
|
value: "false"
|
||||||
|
- name: POSTGRESQL_LOG_CONNECTIONS
|
||||||
|
value: "false"
|
||||||
|
- name: POSTGRESQL_LOG_DISCONNECTIONS
|
||||||
|
value: "false"
|
||||||
|
- name: POSTGRESQL_PGAUDIT_LOG_CATALOG
|
||||||
|
value: "off"
|
||||||
|
- name: POSTGRESQL_CLIENT_MIN_MESSAGES
|
||||||
|
value: "error"
|
||||||
|
- name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES
|
||||||
|
value: "pgaudit"
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
containerPort: 5432
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- -e
|
||||||
|
- |
|
||||||
|
exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432
|
||||||
|
[ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ]
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
volumeMounts:
|
||||||
|
- name: dshm
|
||||||
|
mountPath: /dev/shm
|
||||||
|
- name: data
|
||||||
|
mountPath: /bitnami/postgresql
|
||||||
|
subPath:
|
||||||
|
volumes:
|
||||||
|
- name: dshm
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
sizeLimit: 1Gi
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: data
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- "ReadWriteOnce"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: "8Gi"
|
||||||
6
scripts/helm/helm/databases/charts/postgresql/requirements.lock
Executable file
6
scripts/helm/helm/databases/charts/postgresql/requirements.lock
Executable file
|
|
@ -0,0 +1,6 @@
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
repository: https://charts.bitnami.com/bitnami
|
||||||
|
version: 0.8.1
|
||||||
|
digest: sha256:740783295d301fdd168fafdbaa760de27ab54b0ff36b513589a5a2515072b885
|
||||||
|
generated: "2020-10-06T07:04:23.948475694Z"
|
||||||
4
scripts/helm/helm/databases/charts/postgresql/requirements.yaml
Executable file
4
scripts/helm/helm/databases/charts/postgresql/requirements.yaml
Executable file
|
|
@ -0,0 +1,4 @@
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
version: 0.x.x
|
||||||
|
repository: https://charts.bitnami.com/bitnami
|
||||||
59
scripts/helm/helm/databases/charts/postgresql/templates/NOTES.txt
Executable file
59
scripts/helm/helm/databases/charts/postgresql/templates/NOTES.txt
Executable file
|
|
@ -0,0 +1,59 @@
|
||||||
|
** Please be patient while the chart is being deployed **
|
||||||
|
|
||||||
|
PostgreSQL can be accessed via port {{ template "postgresql.port" . }} on the following DNS name from within your cluster:
|
||||||
|
|
||||||
|
{{ template "postgresql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local - Read/Write connection
|
||||||
|
{{- if .Values.replication.enabled }}
|
||||||
|
{{ template "postgresql.fullname" . }}-read.{{ .Release.Namespace }}.svc.cluster.local - Read only connection
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if and (not (eq .Values.postgresqlUsername "postgres")) (or .Values.postgresqlPostgresPassword (include "postgresql.useExistingSecret" .)) }}
|
||||||
|
|
||||||
|
To get the password for "postgres" run:
|
||||||
|
|
||||||
|
export POSTGRES_ADMIN_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "postgresql.secretName" . }} -o jsonpath="{.data.postgresql-postgres-password}" | base64 --decode)
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
To get the password for "{{ template "postgresql.username" . }}" run:
|
||||||
|
|
||||||
|
export POSTGRES_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "postgresql.secretName" . }} -o jsonpath="{.data.postgresql-password}" | base64 --decode)
|
||||||
|
|
||||||
|
To connect to your database run the following command:
|
||||||
|
|
||||||
|
kubectl run {{ template "postgresql.fullname" . }}-client --rm --tty -i --restart='Never' --namespace {{ .Release.Namespace }} --image {{ template "postgresql.image" . }} --env="PGPASSWORD=$POSTGRES_PASSWORD" {{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
|
||||||
|
--labels="{{ template "postgresql.fullname" . }}-client=true" {{- end }} --command -- psql --host {{ template "postgresql.fullname" . }} -U {{ .Values.postgresqlUsername }} -d {{- if .Values.postgresqlDatabase }} {{ .Values.postgresqlDatabase }}{{- else }} postgres{{- end }} -p {{ template "postgresql.port" . }}
|
||||||
|
|
||||||
|
{{ if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
|
||||||
|
Note: Since NetworkPolicy is enabled, only pods with label {{ template "postgresql.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 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 {{ template "postgresql.fullname" . }})
|
||||||
|
{{ if (include "postgresql.password" . ) }}PGPASSWORD="$POSTGRES_PASSWORD" {{ end }}psql --host $NODE_IP --port $NODE_PORT -U {{ .Values.postgresqlUsername }} -d {{- if .Values.postgresqlDatabase }} {{ .Values.postgresqlDatabase }}{{- else }} postgres{{- 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 {{ template "postgresql.fullname" . }}'
|
||||||
|
|
||||||
|
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "postgresql.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||||
|
{{ if (include "postgresql.password" . ) }}PGPASSWORD="$POSTGRES_PASSWORD" {{ end }}psql --host $SERVICE_IP --port {{ template "postgresql.port" . }} -U {{ .Values.postgresqlUsername }} -d {{- if .Values.postgresqlDatabase }} {{ .Values.postgresqlDatabase }}{{- else }} postgres{{- end }}
|
||||||
|
|
||||||
|
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||||
|
|
||||||
|
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "postgresql.fullname" . }} {{ template "postgresql.port" . }}:{{ template "postgresql.port" . }} &
|
||||||
|
{{ if (include "postgresql.password" . ) }}PGPASSWORD="$POSTGRES_PASSWORD" {{ end }}psql --host 127.0.0.1 -U {{ .Values.postgresqlUsername }} -d {{- if .Values.postgresqlDatabase }} {{ .Values.postgresqlDatabase }}{{- else }} postgres{{- end }} -p {{ template "postgresql.port" . }}
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- include "postgresql.validateValues" . -}}
|
||||||
|
|
||||||
|
{{- include "common.warnings.rollingTag" .Values.image -}}
|
||||||
|
|
||||||
|
{{- $passwordValidationErrors := include "common.validations.values.postgresql.passwords" (dict "secret" (include "postgresql.fullname" .) "context" $) -}}
|
||||||
|
|
||||||
|
{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $passwordValidationErrors) "context" $) -}}
|
||||||
488
scripts/helm/helm/databases/charts/postgresql/templates/_helpers.tpl
Executable file
488
scripts/helm/helm/databases/charts/postgresql/templates/_helpers.tpl
Executable file
|
|
@ -0,0 +1,488 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.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).
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.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 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).
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.master.fullname" -}}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||||
|
{{- $fullname := default (printf "%s-%s" .Release.Name $name) .Values.fullnameOverride -}}
|
||||||
|
{{- if .Values.replication.enabled -}}
|
||||||
|
{{- printf "%s-%s" $fullname "master" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s" $fullname | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for networkpolicy.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.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 -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper PostgreSQL image name
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.image" -}}
|
||||||
|
{{- $registryName := .Values.image.registry -}}
|
||||||
|
{{- $repositoryName := .Values.image.repository -}}
|
||||||
|
{{- $tag := .Values.image.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 PostgreSQL postgres user password
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.postgres.password" -}}
|
||||||
|
{{- if .Values.global.postgresql.postgresqlPostgresPassword }}
|
||||||
|
{{- .Values.global.postgresql.postgresqlPostgresPassword -}}
|
||||||
|
{{- else if .Values.postgresqlPostgresPassword -}}
|
||||||
|
{{- .Values.postgresqlPostgresPassword -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- randAlphaNum 10 -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return PostgreSQL password
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.password" -}}
|
||||||
|
{{- if .Values.global.postgresql.postgresqlPassword }}
|
||||||
|
{{- .Values.global.postgresql.postgresqlPassword -}}
|
||||||
|
{{- else if .Values.postgresqlPassword -}}
|
||||||
|
{{- .Values.postgresqlPassword -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- randAlphaNum 10 -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return PostgreSQL replication password
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.replication.password" -}}
|
||||||
|
{{- if .Values.global.postgresql.replicationPassword }}
|
||||||
|
{{- .Values.global.postgresql.replicationPassword -}}
|
||||||
|
{{- else if .Values.replication.password -}}
|
||||||
|
{{- .Values.replication.password -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- randAlphaNum 10 -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return PostgreSQL username
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.username" -}}
|
||||||
|
{{- if .Values.global.postgresql.postgresqlUsername }}
|
||||||
|
{{- .Values.global.postgresql.postgresqlUsername -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .Values.postgresqlUsername -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return PostgreSQL replication username
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.replication.username" -}}
|
||||||
|
{{- if .Values.global.postgresql.replicationUser }}
|
||||||
|
{{- .Values.global.postgresql.replicationUser -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .Values.replication.user -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return PostgreSQL port
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.port" -}}
|
||||||
|
{{- if .Values.global.postgresql.servicePort }}
|
||||||
|
{{- .Values.global.postgresql.servicePort -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .Values.service.port -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return PostgreSQL created database
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.database" -}}
|
||||||
|
{{- if .Values.global.postgresql.postgresqlDatabase }}
|
||||||
|
{{- .Values.global.postgresql.postgresqlDatabase -}}
|
||||||
|
{{- else if .Values.postgresqlDatabase -}}
|
||||||
|
{{- .Values.postgresqlDatabase -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper image name to change the volume permissions
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.volumePermissions.image" -}}
|
||||||
|
{{- $registryName := .Values.volumePermissions.image.registry -}}
|
||||||
|
{{- $repositoryName := .Values.volumePermissions.image.repository -}}
|
||||||
|
{{- $tag := .Values.volumePermissions.image.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 metrics image name
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.metrics.image" -}}
|
||||||
|
{{- $registryName := default "docker.io" .Values.metrics.image.registry -}}
|
||||||
|
{{- $repositoryName := .Values.metrics.image.repository -}}
|
||||||
|
{{- $tag := default "latest" .Values.metrics.image.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 -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get the password secret.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.secretName" -}}
|
||||||
|
{{- if .Values.global.postgresql.existingSecret }}
|
||||||
|
{{- printf "%s" (tpl .Values.global.postgresql.existingSecret $) -}}
|
||||||
|
{{- else if .Values.existingSecret -}}
|
||||||
|
{{- printf "%s" (tpl .Values.existingSecret $) -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s" (include "postgresql.fullname" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return true if we should use an existingSecret.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.useExistingSecret" -}}
|
||||||
|
{{- if or .Values.global.postgresql.existingSecret .Values.existingSecret -}}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return true if a secret object should be created
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.createSecret" -}}
|
||||||
|
{{- if not (include "postgresql.useExistingSecret" .) -}}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get the configuration ConfigMap name.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.configurationCM" -}}
|
||||||
|
{{- if .Values.configurationConfigMap -}}
|
||||||
|
{{- printf "%s" (tpl .Values.configurationConfigMap $) -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-configuration" (include "postgresql.fullname" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get the extended configuration ConfigMap name.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.extendedConfigurationCM" -}}
|
||||||
|
{{- if .Values.extendedConfConfigMap -}}
|
||||||
|
{{- printf "%s" (tpl .Values.extendedConfConfigMap $) -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-extended-configuration" (include "postgresql.fullname" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return true if a configmap should be mounted with PostgreSQL configuration
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.mountConfigurationCM" -}}
|
||||||
|
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap }}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get the initialization scripts ConfigMap name.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.initdbScriptsCM" -}}
|
||||||
|
{{- if .Values.initdbScriptsConfigMap -}}
|
||||||
|
{{- printf "%s" (tpl .Values.initdbScriptsConfigMap $) -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-init-scripts" (include "postgresql.fullname" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get the initialization scripts Secret name.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.initdbScriptsSecret" -}}
|
||||||
|
{{- printf "%s" (tpl .Values.initdbScriptsSecret $) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get the metrics ConfigMap name.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.metricsCM" -}}
|
||||||
|
{{- printf "%s-metrics" (include "postgresql.fullname" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper Docker Image Registry Secret Names
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.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.image.pullSecrets .Values.metrics.image.pullSecrets .Values.volumePermissions.image.pullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- range .Values.image.pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.metrics.image.pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.volumePermissions.image.pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets .Values.volumePermissions.image.pullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- range .Values.image.pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.metrics.image.pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.volumePermissions.image.pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get the readiness probe command
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.readinessProbeCommand" -}}
|
||||||
|
- |
|
||||||
|
{{- if (include "postgresql.database" .) }}
|
||||||
|
exec pg_isready -U {{ include "postgresql.username" . | quote }} -d "dbname={{ include "postgresql.database" . }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}{{- end }}" -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||||
|
{{- else }}
|
||||||
|
exec pg_isready -U {{ include "postgresql.username" . | quote }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} -d "sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}"{{- end }} -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if contains "bitnami/" .Values.image.repository }}
|
||||||
|
[ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ]
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper Storage Class
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.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 -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for statefulset.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.statefulset.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
{{- print "apps/v1beta2" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apps/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Compile all warnings into a single message, and call fail.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.validateValues" -}}
|
||||||
|
{{- $messages := list -}}
|
||||||
|
{{- $messages := append $messages (include "postgresql.validateValues.ldapConfigurationMethod" .) -}}
|
||||||
|
{{- $messages := append $messages (include "postgresql.validateValues.psp" .) -}}
|
||||||
|
{{- $messages := append $messages (include "postgresql.validateValues.tls" .) -}}
|
||||||
|
{{- $messages := without $messages "" -}}
|
||||||
|
{{- $message := join "\n" $messages -}}
|
||||||
|
|
||||||
|
{{- if $message -}}
|
||||||
|
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Validate values of Postgresql - If ldap.url is used then you don't need the other settings for ldap
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.validateValues.ldapConfigurationMethod" -}}
|
||||||
|
{{- if and .Values.ldap.enabled (and (not (empty .Values.ldap.url)) (not (empty .Values.ldap.server))) }}
|
||||||
|
postgresql: ldap.url, ldap.server
|
||||||
|
You cannot set both `ldap.url` and `ldap.server` at the same time.
|
||||||
|
Please provide a unique way to configure LDAP.
|
||||||
|
More info at https://www.postgresql.org/docs/current/auth-ldap.html
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Validate values of Postgresql - If PSP is enabled RBAC should be enabled too
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.validateValues.psp" -}}
|
||||||
|
{{- if and .Values.psp.create (not .Values.rbac.create) }}
|
||||||
|
postgresql: psp.create, rbac.create
|
||||||
|
RBAC should be enabled if PSP is enabled in order for PSP to work.
|
||||||
|
More info at https://kubernetes.io/docs/concepts/policy/pod-security-policy/#authorizing-policies
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for podsecuritypolicy.
|
||||||
|
*/}}
|
||||||
|
{{- define "podsecuritypolicy.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.10-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "policy/v1beta1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Validate values of Postgresql TLS - When TLS is enabled, so must be VolumePermissions
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.validateValues.tls" -}}
|
||||||
|
{{- if and .Values.tls.enabled (not .Values.volumePermissions.enabled) }}
|
||||||
|
postgresql: tls.enabled, volumePermissions.enabled
|
||||||
|
When TLS is enabled you must enable volumePermissions as well to ensure certificates files have
|
||||||
|
the right permissions.
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the path to the cert file.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.tlsCert" -}}
|
||||||
|
{{- required "Certificate filename is required when TLS in enabled" .Values.tls.certFilename | printf "/opt/bitnami/postgresql/certs/%s" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the path to the cert key file.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.tlsCertKey" -}}
|
||||||
|
{{- required "Certificate Key filename is required when TLS in enabled" .Values.tls.certKeyFilename | printf "/opt/bitnami/postgresql/certs/%s" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the path to the CA cert file.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.tlsCACert" -}}
|
||||||
|
{{- printf "/opt/bitnami/postgresql/certs/%s" .Values.tls.certCAFilename -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the path to the CRL file.
|
||||||
|
*/}}
|
||||||
|
{{- define "postgresql.tlsCRL" -}}
|
||||||
|
{{- if .Values.tls.crlFilename -}}
|
||||||
|
{{- printf "/opt/bitnami/postgresql/certs/%s" .Values.tls.crlFilename -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
26
scripts/helm/helm/databases/charts/postgresql/templates/configmap.yaml
Executable file
26
scripts/helm/helm/databases/charts/postgresql/templates/configmap.yaml
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{{ if and (or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration) (not .Values.configurationConfigMap) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}-configuration
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
{{- if (.Files.Glob "files/postgresql.conf") }}
|
||||||
|
{{ (.Files.Glob "files/postgresql.conf").AsConfig | indent 2 }}
|
||||||
|
{{- else if .Values.postgresqlConfiguration }}
|
||||||
|
postgresql.conf: |
|
||||||
|
{{- range $key, $value := default dict .Values.postgresqlConfiguration }}
|
||||||
|
{{ $key | snakecase }}={{ $value }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if (.Files.Glob "files/pg_hba.conf") }}
|
||||||
|
{{ (.Files.Glob "files/pg_hba.conf").AsConfig | indent 2 }}
|
||||||
|
{{- else if .Values.pgHbaConfiguration }}
|
||||||
|
pg_hba.conf: |
|
||||||
|
{{ .Values.pgHbaConfiguration | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{ end }}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
{{- if and (or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf) (not .Values.extendedConfConfigMap)}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}-extended-configuration
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
{{- with .Files.Glob "files/conf.d/*.conf" }}
|
||||||
|
{{ .AsConfig | indent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{ with .Values.postgresqlExtendedConf }}
|
||||||
|
override.conf: |
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key | snakecase }}={{ $value }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
5
scripts/helm/helm/databases/charts/postgresql/templates/extra-list.yaml
Executable file
5
scripts/helm/helm/databases/charts/postgresql/templates/extra-list.yaml
Executable file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{{- if .Values.extraDeploy }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: List
|
||||||
|
items: {{- include "postgresql.tplValue" (dict "value" .Values.extraDeploy "context" $) | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
{{- if and (or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScripts) (not .Values.initdbScriptsConfigMap) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}-init-scripts
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- 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.initdbScripts }}
|
||||||
|
{{ toYaml . | indent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{{- if and .Values.metrics.enabled .Values.metrics.customMetrics }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.metricsCM" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
custom-metrics.yaml: {{ toYaml .Values.metrics.customMetrics | quote }}
|
||||||
|
{{- end }}
|
||||||
25
scripts/helm/helm/databases/charts/postgresql/templates/metrics-svc.yaml
Executable file
25
scripts/helm/helm/databases/charts/postgresql/templates/metrics-svc.yaml
Executable file
|
|
@ -0,0 +1,25 @@
|
||||||
|
{{- if .Values.metrics.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}-metrics
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- toYaml .Values.metrics.service.annotations | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.metrics.service.type }}
|
||||||
|
{{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }}
|
||||||
|
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: http-metrics
|
||||||
|
port: 9187
|
||||||
|
targetPort: http-metrics
|
||||||
|
selector:
|
||||||
|
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
||||||
|
role: master
|
||||||
|
{{- end }}
|
||||||
36
scripts/helm/helm/databases/charts/postgresql/templates/networkpolicy.yaml
Executable file
36
scripts/helm/helm/databases/charts/postgresql/templates/networkpolicy.yaml
Executable file
|
|
@ -0,0 +1,36 @@
|
||||||
|
{{- if .Values.networkPolicy.enabled }}
|
||||||
|
kind: NetworkPolicy
|
||||||
|
apiVersion: {{ template "postgresql.networkPolicy.apiVersion" . }}
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||||
|
ingress:
|
||||||
|
# Allow inbound connections
|
||||||
|
- ports:
|
||||||
|
- port: {{ template "postgresql.port" . }}
|
||||||
|
{{- if not .Values.networkPolicy.allowExternal }}
|
||||||
|
from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
{{ template "postgresql.fullname" . }}-client: "true"
|
||||||
|
{{- if .Values.networkPolicy.explicitNamespacesSelector }}
|
||||||
|
namespaceSelector:
|
||||||
|
{{ toYaml .Values.networkPolicy.explicitNamespacesSelector | indent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "common.labels.matchLabels" . | nindent 14 }}
|
||||||
|
role: slave
|
||||||
|
{{- end }}
|
||||||
|
# Allow prometheus scrapes
|
||||||
|
- ports:
|
||||||
|
- port: 9187
|
||||||
|
{{- end }}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
{{- if .Values.psp.create }}
|
||||||
|
apiVersion: {{ include "podsecuritypolicy.apiVersion" . }}
|
||||||
|
kind: PodSecurityPolicy
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
privileged: false
|
||||||
|
volumes:
|
||||||
|
- 'configMap'
|
||||||
|
- 'secret'
|
||||||
|
- 'persistentVolumeClaim'
|
||||||
|
- 'emptyDir'
|
||||||
|
- 'projected'
|
||||||
|
hostNetwork: false
|
||||||
|
hostIPC: false
|
||||||
|
hostPID: false
|
||||||
|
runAsUser:
|
||||||
|
rule: 'MustRunAsNonRoot'
|
||||||
|
seLinux:
|
||||||
|
rule: 'RunAsAny'
|
||||||
|
supplementalGroups:
|
||||||
|
rule: 'MustRunAs'
|
||||||
|
ranges:
|
||||||
|
- min: 1
|
||||||
|
max: 65535
|
||||||
|
fsGroup:
|
||||||
|
rule: 'MustRunAs'
|
||||||
|
ranges:
|
||||||
|
- min: 1
|
||||||
|
max: 65535
|
||||||
|
readOnlyRootFilesystem: false
|
||||||
|
{{- end }}
|
||||||
23
scripts/helm/helm/databases/charts/postgresql/templates/prometheusrule.yaml
Executable file
23
scripts/helm/helm/databases/charts/postgresql/templates/prometheusrule.yaml
Executable file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: PrometheusRule
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
{{- with .Values.metrics.prometheusRule.namespace }}
|
||||||
|
namespace: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- with .Values.metrics.prometheusRule.additionalLabels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.metrics.prometheusRule.rules }}
|
||||||
|
groups:
|
||||||
|
- name: {{ template "postgresql.name" $ }}
|
||||||
|
rules: {{ tpl (toYaml .) $ | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
19
scripts/helm/helm/databases/charts/postgresql/templates/role.yaml
Executable file
19
scripts/helm/helm/databases/charts/postgresql/templates/role.yaml
Executable file
|
|
@ -0,0 +1,19 @@
|
||||||
|
{{- if .Values.rbac.create }}
|
||||||
|
kind: Role
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- if .Values.psp.create }}
|
||||||
|
- apiGroups: ["extensions"]
|
||||||
|
resources: ["podsecuritypolicies"]
|
||||||
|
verbs: ["use"]
|
||||||
|
resourceNames:
|
||||||
|
- {{ template "postgresql.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
19
scripts/helm/helm/databases/charts/postgresql/templates/rolebinding.yaml
Executable file
19
scripts/helm/helm/databases/charts/postgresql/templates/rolebinding.yaml
Executable file
|
|
@ -0,0 +1,19 @@
|
||||||
|
{{- if .Values.rbac.create }}
|
||||||
|
kind: RoleBinding
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
roleRef:
|
||||||
|
kind: Role
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ default (include "postgresql.fullname" . ) .Values.serviceAccount.name }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
{{- end }}
|
||||||
23
scripts/helm/helm/databases/charts/postgresql/templates/secrets.yaml
Executable file
23
scripts/helm/helm/databases/charts/postgresql/templates/secrets.yaml
Executable file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{{- if (include "postgresql.createSecret" .) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{- if and .Values.postgresqlPostgresPassword (not (eq .Values.postgresqlUsername "postgres")) }}
|
||||||
|
postgresql-postgres-password: {{ include "postgresql.postgres.password" . | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
postgresql-password: {{ include "postgresql.password" . | b64enc | quote }}
|
||||||
|
{{- if .Values.replication.enabled }}
|
||||||
|
postgresql-replication-password: {{ include "postgresql.replication.password" . | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if (and .Values.ldap.enabled .Values.ldap.bind_password)}}
|
||||||
|
postgresql-ldap-password: {{ .Values.ldap.bind_password | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
11
scripts/helm/helm/databases/charts/postgresql/templates/serviceaccount.yaml
Executable file
11
scripts/helm/helm/databases/charts/postgresql/templates/serviceaccount.yaml
Executable file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{{- if and (.Values.serviceAccount.enabled) (not .Values.serviceAccount.name) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
33
scripts/helm/helm/databases/charts/postgresql/templates/servicemonitor.yaml
Executable file
33
scripts/helm/helm/databases/charts/postgresql/templates/servicemonitor.yaml
Executable file
|
|
@ -0,0 +1,33 @@
|
||||||
|
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ include "postgresql.fullname" . }}
|
||||||
|
{{- if .Values.metrics.serviceMonitor.namespace }}
|
||||||
|
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.metrics.serviceMonitor.additionalLabels }}
|
||||||
|
{{- toYaml .Values.metrics.serviceMonitor.additionalLabels | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
spec:
|
||||||
|
endpoints:
|
||||||
|
- port: http-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 }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
403
scripts/helm/helm/databases/charts/postgresql/templates/statefulset-slaves.yaml
Executable file
403
scripts/helm/helm/databases/charts/postgresql/templates/statefulset-slaves.yaml
Executable file
|
|
@ -0,0 +1,403 @@
|
||||||
|
{{- if .Values.replication.enabled }}
|
||||||
|
{{- $slaveResources := coalesce .Values.slave.resources .Values.resources -}}
|
||||||
|
apiVersion: {{ template "postgresql.statefulset.apiVersion" . }}
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: "{{ template "postgresql.fullname" . }}-slave"
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- with .Values.slave.labels }}
|
||||||
|
{{ toYaml . | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.slave.annotations }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
serviceName: {{ template "postgresql.fullname" . }}-headless
|
||||||
|
replicas: {{ .Values.replication.slaveReplicas }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||||
|
role: slave
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 8 }}
|
||||||
|
role: slave
|
||||||
|
{{- with .Values.slave.podLabels }}
|
||||||
|
{{ toYaml . | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.slave.podAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{ toYaml . | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.schedulerName }}
|
||||||
|
schedulerName: "{{ .Values.schedulerName }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- include "postgresql.imagePullSecrets" . | indent 6 }}
|
||||||
|
{{- if .Values.slave.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{ toYaml .Values.slave.nodeSelector | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.slave.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{ toYaml .Values.slave.affinity | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.slave.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{ toYaml .Values.slave.tolerations | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.terminationGracePeriodSeconds }}
|
||||||
|
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.securityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.securityContext "enabled" | toYaml | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.serviceAccount.enabled }}
|
||||||
|
serviceAccountName: {{ default (include "postgresql.fullname" . ) .Values.serviceAccount.name}}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.slave.extraInitContainers (and .Values.volumePermissions.enabled (or .Values.persistence.enabled (and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled))) }}
|
||||||
|
initContainers:
|
||||||
|
{{- if and .Values.volumePermissions.enabled (or .Values.persistence.enabled (and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled) .Values.tls.enabled) }}
|
||||||
|
- name: init-chmod-data
|
||||||
|
image: {{ template "postgresql.volumePermissions.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
||||||
|
{{- if .Values.resources }}
|
||||||
|
resources: {{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -cx
|
||||||
|
- |
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||||
|
chown `id -u`:`id -G | cut -d " " -f2` {{ .Values.persistence.mountPath }}
|
||||||
|
{{- else }}
|
||||||
|
chown {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}
|
||||||
|
{{- end }}
|
||||||
|
mkdir -p {{ .Values.persistence.mountPath }}/data {{- if (include "postgresql.mountConfigurationCM" .) }} {{ .Values.persistence.mountPath }}/conf {{- end }}
|
||||||
|
chmod 700 {{ .Values.persistence.mountPath }}/data {{- if (include "postgresql.mountConfigurationCM" .) }} {{ .Values.persistence.mountPath }}/conf {{- end }}
|
||||||
|
find {{ .Values.persistence.mountPath }} -mindepth 1 -maxdepth 1 {{- if not (include "postgresql.mountConfigurationCM" .) }} -not -name "conf" {{- end }} -not -name ".snapshot" -not -name "lost+found" | \
|
||||||
|
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||||
|
xargs chown -R `id -u`:`id -G | cut -d " " -f2`
|
||||||
|
{{- else }}
|
||||||
|
xargs chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled }}
|
||||||
|
chmod -R 777 /dev/shm
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
cp /tmp/certs/* /opt/bitnami/postgresql/certs/
|
||||||
|
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||||
|
chown -R `id -u`:`id -G | cut -d " " -f2` /opt/bitnami/postgresql/certs/
|
||||||
|
{{- else }}
|
||||||
|
chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /opt/bitnami/postgresql/certs/
|
||||||
|
{{- end }}
|
||||||
|
chmod 600 {{ template "postgresql.tlsCertKey" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||||
|
securityContext: {{- omit .Values.volumePermissions.securityContext "runAsUser" | toYaml | nindent 12 }}
|
||||||
|
{{- else }}
|
||||||
|
securityContext: {{- .Values.volumePermissions.securityContext | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
{{ if .Values.persistence.enabled }}
|
||||||
|
- name: data
|
||||||
|
mountPath: {{ .Values.persistence.mountPath }}
|
||||||
|
subPath: {{ .Values.persistence.subPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.shmVolume.enabled }}
|
||||||
|
- name: dshm
|
||||||
|
mountPath: /dev/shm
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
- name: raw-certificates
|
||||||
|
mountPath: /tmp/certs
|
||||||
|
- name: postgresql-certificates
|
||||||
|
mountPath: /opt/bitnami/postgresql/certs
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.slave.extraInitContainers }}
|
||||||
|
{{ tpl .Values.slave.extraInitContainers . | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.slave.priorityClassName }}
|
||||||
|
priorityClassName: {{ .Values.slave.priorityClassName }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: {{ template "postgresql.fullname" . }}
|
||||||
|
image: {{ template "postgresql.image" . }}
|
||||||
|
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
|
||||||
|
{{- if $slaveResources }}
|
||||||
|
resources: {{- toYaml $slaveResources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.containerSecurityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: BITNAMI_DEBUG
|
||||||
|
value: {{ ternary "true" "false" .Values.image.debug | quote }}
|
||||||
|
- name: POSTGRESQL_VOLUME_DIR
|
||||||
|
value: "{{ .Values.persistence.mountPath }}"
|
||||||
|
- name: POSTGRESQL_PORT_NUMBER
|
||||||
|
value: "{{ template "postgresql.port" . }}"
|
||||||
|
{{- if .Values.persistence.mountPath }}
|
||||||
|
- name: PGDATA
|
||||||
|
value: {{ .Values.postgresqlDataDir | quote }}
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRES_REPLICATION_MODE
|
||||||
|
value: "slave"
|
||||||
|
- name: POSTGRES_REPLICATION_USER
|
||||||
|
value: {{ include "postgresql.replication.username" . | quote }}
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: POSTGRES_REPLICATION_PASSWORD_FILE
|
||||||
|
value: "/opt/bitnami/postgresql/secrets/postgresql-replication-password"
|
||||||
|
{{- else }}
|
||||||
|
- name: POSTGRES_REPLICATION_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ template "postgresql.secretName" . }}
|
||||||
|
key: postgresql-replication-password
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRES_CLUSTER_APP_NAME
|
||||||
|
value: {{ .Values.replication.applicationName }}
|
||||||
|
- name: POSTGRES_MASTER_HOST
|
||||||
|
value: {{ template "postgresql.fullname" . }}
|
||||||
|
- name: POSTGRES_MASTER_PORT_NUMBER
|
||||||
|
value: {{ include "postgresql.port" . | quote }}
|
||||||
|
{{- if and (not (eq .Values.postgresqlUsername "postgres")) (or .Values.postgresqlPostgresPassword (include "postgresql.useExistingSecret" .)) }}
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: POSTGRES_POSTGRES_PASSWORD_FILE
|
||||||
|
value: "/opt/bitnami/postgresql/secrets/postgresql-postgres-password"
|
||||||
|
{{- else }}
|
||||||
|
- name: POSTGRES_POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ template "postgresql.secretName" . }}
|
||||||
|
key: postgresql-postgres-password
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: POSTGRES_PASSWORD_FILE
|
||||||
|
value: "/opt/bitnami/postgresql/secrets/postgresql-password"
|
||||||
|
{{- else }}
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ template "postgresql.secretName" . }}
|
||||||
|
key: postgresql-password
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRESQL_ENABLE_TLS
|
||||||
|
value: {{ ternary "yes" "no" .Values.tls.enabled | quote }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
- name: POSTGRESQL_TLS_PREFER_SERVER_CIPHERS
|
||||||
|
value: {{ ternary "yes" "no" .Values.tls.preferServerCiphers | quote }}
|
||||||
|
- name: POSTGRESQL_TLS_CERT_FILE
|
||||||
|
value: {{ template "postgresql.tlsCert" . }}
|
||||||
|
- name: POSTGRESQL_TLS_KEY_FILE
|
||||||
|
value: {{ template "postgresql.tlsCertKey" . }}
|
||||||
|
{{- if .Values.tls.certCAFilename }}
|
||||||
|
- name: POSTGRESQL_TLS_CA_FILE
|
||||||
|
value: {{ template "postgresql.tlsCACert" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.crlFilename }}
|
||||||
|
- name: POSTGRESQL_TLS_CRL_FILE
|
||||||
|
value: {{ template "postgresql.tlsCRL" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRESQL_LOG_HOSTNAME
|
||||||
|
value: {{ .Values.audit.logHostname | quote }}
|
||||||
|
- name: POSTGRESQL_LOG_CONNECTIONS
|
||||||
|
value: {{ .Values.audit.logConnections | quote }}
|
||||||
|
- name: POSTGRESQL_LOG_DISCONNECTIONS
|
||||||
|
value: {{ .Values.audit.logDisconnections | quote }}
|
||||||
|
{{- if .Values.audit.logLinePrefix }}
|
||||||
|
- name: POSTGRESQL_LOG_LINE_PREFIX
|
||||||
|
value: {{ .Values.audit.logLinePrefix | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.audit.logTimezone }}
|
||||||
|
- name: POSTGRESQL_LOG_TIMEZONE
|
||||||
|
value: {{ .Values.audit.logTimezone | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.audit.pgAuditLog }}
|
||||||
|
- name: POSTGRESQL_PGAUDIT_LOG
|
||||||
|
value: {{ .Values.audit.pgAuditLog | quote }}
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRESQL_PGAUDIT_LOG_CATALOG
|
||||||
|
value: {{ .Values.audit.pgAuditLogCatalog | quote }}
|
||||||
|
- name: POSTGRESQL_CLIENT_MIN_MESSAGES
|
||||||
|
value: {{ .Values.audit.clientMinMessages | quote }}
|
||||||
|
- name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES
|
||||||
|
value: {{ .Values.postgresqlSharedPreloadLibraries | quote }}
|
||||||
|
{{- if .Values.postgresqlMaxConnections }}
|
||||||
|
- name: POSTGRESQL_MAX_CONNECTIONS
|
||||||
|
value: {{ .Values.postgresqlMaxConnections | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlPostgresConnectionLimit }}
|
||||||
|
- name: POSTGRESQL_POSTGRES_CONNECTION_LIMIT
|
||||||
|
value: {{ .Values.postgresqlPostgresConnectionLimit | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlDbUserConnectionLimit }}
|
||||||
|
- name: POSTGRESQL_USERNAME_CONNECTION_LIMIT
|
||||||
|
value: {{ .Values.postgresqlDbUserConnectionLimit | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlTcpKeepalivesInterval }}
|
||||||
|
- name: POSTGRESQL_TCP_KEEPALIVES_INTERVAL
|
||||||
|
value: {{ .Values.postgresqlTcpKeepalivesInterval | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlTcpKeepalivesIdle }}
|
||||||
|
- name: POSTGRESQL_TCP_KEEPALIVES_IDLE
|
||||||
|
value: {{ .Values.postgresqlTcpKeepalivesIdle | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlStatementTimeout }}
|
||||||
|
- name: POSTGRESQL_STATEMENT_TIMEOUT
|
||||||
|
value: {{ .Values.postgresqlStatementTimeout | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlTcpKeealivesCount }}
|
||||||
|
- name: POSTGRESQL_TCP_KEEPALIVES_COUNT
|
||||||
|
value: {{ .Values.postgresqlTcpKeealivesCount | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlPghbaRemoveFilters }}
|
||||||
|
- name: POSTGRESQL_PGHBA_REMOVE_FILTERS
|
||||||
|
value: {{ .Values.postgresqlPghbaRemoveFilters | quote }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
containerPort: {{ template "postgresql.port" . }}
|
||||||
|
{{- if .Values.livenessProbe.enabled }}
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
{{- if (include "postgresql.database" .) }}
|
||||||
|
- exec pg_isready -U {{ include "postgresql.username" . | quote }} -d "dbname={{ include "postgresql.database" . }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}{{- end }}" -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||||
|
{{- else }}
|
||||||
|
- exec pg_isready -U {{ include "postgresql.username" . | quote }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} -d "sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}"{{- end }} -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||||
|
{{- end }}
|
||||||
|
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||||
|
{{- else if .Values.customLivenessProbe }}
|
||||||
|
livenessProbe: {{- include "postgresql.tplValue" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.readinessProbe.enabled }}
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- -e
|
||||||
|
{{- include "postgresql.readinessProbeCommand" . | nindent 16 }}
|
||||||
|
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||||
|
{{- else if .Values.customReadinessProbe }}
|
||||||
|
readinessProbe: {{- include "postgresql.tplValue" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: postgresql-password
|
||||||
|
mountPath: /opt/bitnami/postgresql/secrets/
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.shmVolume.enabled }}
|
||||||
|
- name: dshm
|
||||||
|
mountPath: /dev/shm
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
- name: data
|
||||||
|
mountPath: {{ .Values.persistence.mountPath }}
|
||||||
|
subPath: {{ .Values.persistence.subPath }}
|
||||||
|
{{ end }}
|
||||||
|
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf .Values.extendedConfConfigMap }}
|
||||||
|
- name: postgresql-extended-config
|
||||||
|
mountPath: /bitnami/postgresql/conf/conf.d/
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap }}
|
||||||
|
- name: postgresql-config
|
||||||
|
mountPath: /bitnami/postgresql/conf
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
- name: postgresql-certificates
|
||||||
|
mountPath: /opt/bitnami/postgresql/certs
|
||||||
|
readOnly: true
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.slave.extraVolumeMounts }}
|
||||||
|
{{- toYaml .Values.slave.extraVolumeMounts | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.slave.sidecars }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.slave.sidecars "context" $ ) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: postgresql-password
|
||||||
|
secret:
|
||||||
|
secretName: {{ template "postgresql.secretName" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap}}
|
||||||
|
- name: postgresql-config
|
||||||
|
configMap:
|
||||||
|
name: {{ template "postgresql.configurationCM" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf .Values.extendedConfConfigMap }}
|
||||||
|
- name: postgresql-extended-config
|
||||||
|
configMap:
|
||||||
|
name: {{ template "postgresql.extendedConfigurationCM" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
- name: raw-certificates
|
||||||
|
secret:
|
||||||
|
secretName: {{ required "A secret containing TLS certificates is required when TLS is enabled" .Values.tls.certificatesSecret }}
|
||||||
|
- name: postgresql-certificates
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.shmVolume.enabled }}
|
||||||
|
- name: dshm
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
sizeLimit: 1Gi
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (not .Values.persistence.enabled) (not .Values.slave.persistence.enabled) }}
|
||||||
|
- name: data
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.slave.extraVolumes }}
|
||||||
|
{{- toYaml .Values.slave.extraVolumes | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
updateStrategy:
|
||||||
|
type: {{ .Values.updateStrategy.type }}
|
||||||
|
{{- if (eq "Recreate" .Values.updateStrategy.type) }}
|
||||||
|
rollingUpdate: null
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.persistence.enabled .Values.slave.persistence.enabled }}
|
||||||
|
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.storageClass" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
580
scripts/helm/helm/databases/charts/postgresql/templates/statefulset.yaml
Executable file
580
scripts/helm/helm/databases/charts/postgresql/templates/statefulset.yaml
Executable file
|
|
@ -0,0 +1,580 @@
|
||||||
|
apiVersion: {{ template "postgresql.statefulset.apiVersion" . }}
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.master.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- with .Values.master.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.master.annotations }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
serviceName: {{ template "postgresql.fullname" . }}-headless
|
||||||
|
replicas: 1
|
||||||
|
updateStrategy:
|
||||||
|
type: {{ .Values.updateStrategy.type }}
|
||||||
|
{{- if (eq "Recreate" .Values.updateStrategy.type) }}
|
||||||
|
rollingUpdate: null
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||||
|
role: master
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 8 }}
|
||||||
|
role: master
|
||||||
|
{{- with .Values.master.podLabels }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.master.podAnnotations }}
|
||||||
|
annotations: {{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.schedulerName }}
|
||||||
|
schedulerName: "{{ .Values.schedulerName }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- include "postgresql.imagePullSecrets" . | indent 6 }}
|
||||||
|
{{- if .Values.master.nodeSelector }}
|
||||||
|
nodeSelector: {{- toYaml .Values.master.nodeSelector | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.master.affinity }}
|
||||||
|
affinity: {{- toYaml .Values.master.affinity | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.master.tolerations }}
|
||||||
|
tolerations: {{- toYaml .Values.master.tolerations | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.terminationGracePeriodSeconds }}
|
||||||
|
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.securityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.securityContext "enabled" | toYaml | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.serviceAccount.enabled }}
|
||||||
|
serviceAccountName: {{ default (include "postgresql.fullname" . ) .Values.serviceAccount.name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.master.extraInitContainers (and .Values.volumePermissions.enabled (or .Values.persistence.enabled (and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled))) }}
|
||||||
|
initContainers:
|
||||||
|
{{- if and .Values.volumePermissions.enabled (or .Values.persistence.enabled (and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled) .Values.tls.enabled) }}
|
||||||
|
- name: init-chmod-data
|
||||||
|
image: {{ template "postgresql.volumePermissions.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
||||||
|
{{- if .Values.resources }}
|
||||||
|
resources: {{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -cx
|
||||||
|
- |
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||||
|
chown `id -u`:`id -G | cut -d " " -f2` {{ .Values.persistence.mountPath }}
|
||||||
|
{{- else }}
|
||||||
|
chown {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}
|
||||||
|
{{- end }}
|
||||||
|
mkdir -p {{ .Values.persistence.mountPath }}/data {{- if (include "postgresql.mountConfigurationCM" .) }} {{ .Values.persistence.mountPath }}/conf {{- end }}
|
||||||
|
chmod 700 {{ .Values.persistence.mountPath }}/data {{- if (include "postgresql.mountConfigurationCM" .) }} {{ .Values.persistence.mountPath }}/conf {{- end }}
|
||||||
|
find {{ .Values.persistence.mountPath }} -mindepth 1 -maxdepth 1 {{- if not (include "postgresql.mountConfigurationCM" .) }} -not -name "conf" {{- end }} -not -name ".snapshot" -not -name "lost+found" | \
|
||||||
|
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||||
|
xargs chown -R `id -u`:`id -G | cut -d " " -f2`
|
||||||
|
{{- else }}
|
||||||
|
xargs chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled }}
|
||||||
|
chmod -R 777 /dev/shm
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
cp /tmp/certs/* /opt/bitnami/postgresql/certs/
|
||||||
|
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||||
|
chown -R `id -u`:`id -G | cut -d " " -f2` /opt/bitnami/postgresql/certs/
|
||||||
|
{{- else }}
|
||||||
|
chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /opt/bitnami/postgresql/certs/
|
||||||
|
{{- end }}
|
||||||
|
chmod 600 {{ template "postgresql.tlsCertKey" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||||
|
securityContext: {{- omit .Values.volumePermissions.securityContext "runAsUser" | toYaml | nindent 12 }}
|
||||||
|
{{- else }}
|
||||||
|
securityContext: {{- .Values.volumePermissions.securityContext | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
- name: data
|
||||||
|
mountPath: {{ .Values.persistence.mountPath }}
|
||||||
|
subPath: {{ .Values.persistence.subPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.shmVolume.enabled }}
|
||||||
|
- name: dshm
|
||||||
|
mountPath: /dev/shm
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
- name: raw-certificates
|
||||||
|
mountPath: /tmp/certs
|
||||||
|
- name: postgresql-certificates
|
||||||
|
mountPath: /opt/bitnami/postgresql/certs
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.master.extraInitContainers }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.master.extraInitContainers "context" $ ) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.master.priorityClassName }}
|
||||||
|
priorityClassName: {{ .Values.master.priorityClassName }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: {{ template "postgresql.fullname" . }}
|
||||||
|
image: {{ template "postgresql.image" . }}
|
||||||
|
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
|
||||||
|
{{- if .Values.resources }}
|
||||||
|
resources: {{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.containerSecurityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: BITNAMI_DEBUG
|
||||||
|
value: {{ ternary "true" "false" .Values.image.debug | quote }}
|
||||||
|
- name: POSTGRESQL_PORT_NUMBER
|
||||||
|
value: "{{ template "postgresql.port" . }}"
|
||||||
|
- name: POSTGRESQL_VOLUME_DIR
|
||||||
|
value: "{{ .Values.persistence.mountPath }}"
|
||||||
|
{{- if .Values.postgresqlInitdbArgs }}
|
||||||
|
- name: POSTGRES_INITDB_ARGS
|
||||||
|
value: {{ .Values.postgresqlInitdbArgs | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlInitdbWalDir }}
|
||||||
|
- name: POSTGRES_INITDB_WALDIR
|
||||||
|
value: {{ .Values.postgresqlInitdbWalDir | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.initdbUser }}
|
||||||
|
- name: POSTGRESQL_INITSCRIPTS_USERNAME
|
||||||
|
value: {{ .Values.initdbUser }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.initdbPassword }}
|
||||||
|
- name: POSTGRESQL_INITSCRIPTS_PASSWORD
|
||||||
|
value: {{ .Values.initdbPassword }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.persistence.mountPath }}
|
||||||
|
- name: PGDATA
|
||||||
|
value: {{ .Values.postgresqlDataDir | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.masterAsStandBy.enabled }}
|
||||||
|
- name: POSTGRES_MASTER_HOST
|
||||||
|
value: {{ .Values.masterAsStandBy.masterHost }}
|
||||||
|
- name: POSTGRES_MASTER_PORT_NUMBER
|
||||||
|
value: {{ .Values.masterAsStandBy.masterPort | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.replication.enabled .Values.masterAsStandBy.enabled }}
|
||||||
|
- name: POSTGRES_REPLICATION_MODE
|
||||||
|
{{- if .Values.masterAsStandBy.enabled }}
|
||||||
|
value: "slave"
|
||||||
|
{{- else }}
|
||||||
|
value: "master"
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRES_REPLICATION_USER
|
||||||
|
value: {{ include "postgresql.replication.username" . | quote }}
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: POSTGRES_REPLICATION_PASSWORD_FILE
|
||||||
|
value: "/opt/bitnami/postgresql/secrets/postgresql-replication-password"
|
||||||
|
{{- else }}
|
||||||
|
- name: POSTGRES_REPLICATION_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ template "postgresql.secretName" . }}
|
||||||
|
key: postgresql-replication-password
|
||||||
|
{{- end }}
|
||||||
|
{{- if not (eq .Values.replication.synchronousCommit "off")}}
|
||||||
|
- name: POSTGRES_SYNCHRONOUS_COMMIT_MODE
|
||||||
|
value: {{ .Values.replication.synchronousCommit | quote }}
|
||||||
|
- name: POSTGRES_NUM_SYNCHRONOUS_REPLICAS
|
||||||
|
value: {{ .Values.replication.numSynchronousReplicas | quote }}
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRES_CLUSTER_APP_NAME
|
||||||
|
value: {{ .Values.replication.applicationName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (not (eq .Values.postgresqlUsername "postgres")) (or .Values.postgresqlPostgresPassword (include "postgresql.useExistingSecret" .)) }}
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: POSTGRES_POSTGRES_PASSWORD_FILE
|
||||||
|
value: "/opt/bitnami/postgresql/secrets/postgresql-postgres-password"
|
||||||
|
{{- else }}
|
||||||
|
- name: POSTGRES_POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ template "postgresql.secretName" . }}
|
||||||
|
key: postgresql-postgres-password
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
value: {{ include "postgresql.username" . | quote }}
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: POSTGRES_PASSWORD_FILE
|
||||||
|
value: "/opt/bitnami/postgresql/secrets/postgresql-password"
|
||||||
|
{{- else }}
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ template "postgresql.secretName" . }}
|
||||||
|
key: postgresql-password
|
||||||
|
{{- end }}
|
||||||
|
{{- if (include "postgresql.database" .) }}
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
value: {{ (include "postgresql.database" .) | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraEnv }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnv "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRESQL_ENABLE_LDAP
|
||||||
|
value: {{ ternary "yes" "no" .Values.ldap.enabled | quote }}
|
||||||
|
{{- if .Values.ldap.enabled }}
|
||||||
|
- name: POSTGRESQL_LDAP_SERVER
|
||||||
|
value: {{ .Values.ldap.server }}
|
||||||
|
- name: POSTGRESQL_LDAP_PORT
|
||||||
|
value: {{ .Values.ldap.port | quote }}
|
||||||
|
- name: POSTGRESQL_LDAP_SCHEME
|
||||||
|
value: {{ .Values.ldap.scheme }}
|
||||||
|
{{- if .Values.ldap.tls }}
|
||||||
|
- name: POSTGRESQL_LDAP_TLS
|
||||||
|
value: "1"
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRESQL_LDAP_PREFIX
|
||||||
|
value: {{ .Values.ldap.prefix | quote }}
|
||||||
|
- name: POSTGRESQL_LDAP_SUFFIX
|
||||||
|
value: {{ .Values.ldap.suffix | quote }}
|
||||||
|
- name: POSTGRESQL_LDAP_BASE_DN
|
||||||
|
value: {{ .Values.ldap.baseDN }}
|
||||||
|
- name: POSTGRESQL_LDAP_BIND_DN
|
||||||
|
value: {{ .Values.ldap.bindDN }}
|
||||||
|
{{- if (not (empty .Values.ldap.bind_password)) }}
|
||||||
|
- name: POSTGRESQL_LDAP_BIND_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ template "postgresql.secretName" . }}
|
||||||
|
key: postgresql-ldap-password
|
||||||
|
{{- end}}
|
||||||
|
- name: POSTGRESQL_LDAP_SEARCH_ATTR
|
||||||
|
value: {{ .Values.ldap.search_attr }}
|
||||||
|
- name: POSTGRESQL_LDAP_SEARCH_FILTER
|
||||||
|
value: {{ .Values.ldap.search_filter }}
|
||||||
|
- name: POSTGRESQL_LDAP_URL
|
||||||
|
value: {{ .Values.ldap.url }}
|
||||||
|
{{- end}}
|
||||||
|
- name: POSTGRESQL_ENABLE_TLS
|
||||||
|
value: {{ ternary "yes" "no" .Values.tls.enabled | quote }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
- name: POSTGRESQL_TLS_PREFER_SERVER_CIPHERS
|
||||||
|
value: {{ ternary "yes" "no" .Values.tls.preferServerCiphers | quote }}
|
||||||
|
- name: POSTGRESQL_TLS_CERT_FILE
|
||||||
|
value: {{ template "postgresql.tlsCert" . }}
|
||||||
|
- name: POSTGRESQL_TLS_KEY_FILE
|
||||||
|
value: {{ template "postgresql.tlsCertKey" . }}
|
||||||
|
{{- if .Values.tls.certCAFilename }}
|
||||||
|
- name: POSTGRESQL_TLS_CA_FILE
|
||||||
|
value: {{ template "postgresql.tlsCACert" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.crlFilename }}
|
||||||
|
- name: POSTGRESQL_TLS_CRL_FILE
|
||||||
|
value: {{ template "postgresql.tlsCRL" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRESQL_LOG_HOSTNAME
|
||||||
|
value: {{ .Values.audit.logHostname | quote }}
|
||||||
|
- name: POSTGRESQL_LOG_CONNECTIONS
|
||||||
|
value: {{ .Values.audit.logConnections | quote }}
|
||||||
|
- name: POSTGRESQL_LOG_DISCONNECTIONS
|
||||||
|
value: {{ .Values.audit.logDisconnections | quote }}
|
||||||
|
{{- if .Values.audit.logLinePrefix }}
|
||||||
|
- name: POSTGRESQL_LOG_LINE_PREFIX
|
||||||
|
value: {{ .Values.audit.logLinePrefix | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.audit.logTimezone }}
|
||||||
|
- name: POSTGRESQL_LOG_TIMEZONE
|
||||||
|
value: {{ .Values.audit.logTimezone | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.audit.pgAuditLog }}
|
||||||
|
- name: POSTGRESQL_PGAUDIT_LOG
|
||||||
|
value: {{ .Values.audit.pgAuditLog | quote }}
|
||||||
|
{{- end }}
|
||||||
|
- name: POSTGRESQL_PGAUDIT_LOG_CATALOG
|
||||||
|
value: {{ .Values.audit.pgAuditLogCatalog | quote }}
|
||||||
|
- name: POSTGRESQL_CLIENT_MIN_MESSAGES
|
||||||
|
value: {{ .Values.audit.clientMinMessages | quote }}
|
||||||
|
- name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES
|
||||||
|
value: {{ .Values.postgresqlSharedPreloadLibraries | quote }}
|
||||||
|
{{- if .Values.postgresqlMaxConnections }}
|
||||||
|
- name: POSTGRESQL_MAX_CONNECTIONS
|
||||||
|
value: {{ .Values.postgresqlMaxConnections | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlPostgresConnectionLimit }}
|
||||||
|
- name: POSTGRESQL_POSTGRES_CONNECTION_LIMIT
|
||||||
|
value: {{ .Values.postgresqlPostgresConnectionLimit | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlDbUserConnectionLimit }}
|
||||||
|
- name: POSTGRESQL_USERNAME_CONNECTION_LIMIT
|
||||||
|
value: {{ .Values.postgresqlDbUserConnectionLimit | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlTcpKeepalivesInterval }}
|
||||||
|
- name: POSTGRESQL_TCP_KEEPALIVES_INTERVAL
|
||||||
|
value: {{ .Values.postgresqlTcpKeepalivesInterval | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlTcpKeepalivesIdle }}
|
||||||
|
- name: POSTGRESQL_TCP_KEEPALIVES_IDLE
|
||||||
|
value: {{ .Values.postgresqlTcpKeepalivesIdle | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlStatementTimeout }}
|
||||||
|
- name: POSTGRESQL_STATEMENT_TIMEOUT
|
||||||
|
value: {{ .Values.postgresqlStatementTimeout | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlTcpKeealivesCount }}
|
||||||
|
- name: POSTGRESQL_TCP_KEEPALIVES_COUNT
|
||||||
|
value: {{ .Values.postgresqlTcpKeealivesCount | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postgresqlPghbaRemoveFilters }}
|
||||||
|
- name: POSTGRESQL_PGHBA_REMOVE_FILTERS
|
||||||
|
value: {{ .Values.postgresqlPghbaRemoveFilters | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraEnvVarsCM }}
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: {{ tpl .Values.extraEnvVarsCM . }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
containerPort: {{ template "postgresql.port" . }}
|
||||||
|
{{- if .Values.livenessProbe.enabled }}
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
{{- if (include "postgresql.database" .) }}
|
||||||
|
- exec pg_isready -U {{ include "postgresql.username" . | quote }} -d "dbname={{ include "postgresql.database" . }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}{{- end }}" -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||||
|
{{- else }}
|
||||||
|
- exec pg_isready -U {{ include "postgresql.username" . | quote }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} -d "sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}"{{- end }} -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||||
|
{{- end }}
|
||||||
|
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||||
|
{{- else if .Values.customLivenessProbe }}
|
||||||
|
livenessProbe: {{- include "postgresql.tplValue" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.readinessProbe.enabled }}
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- -e
|
||||||
|
{{- include "postgresql.readinessProbeCommand" . | nindent 16 }}
|
||||||
|
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||||
|
{{- else if .Values.customReadinessProbe }}
|
||||||
|
readinessProbe: {{- include "postgresql.tplValue" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap .Values.initdbScripts }}
|
||||||
|
- name: custom-init-scripts
|
||||||
|
mountPath: /docker-entrypoint-initdb.d/
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.initdbScriptsSecret }}
|
||||||
|
- name: custom-init-scripts-secret
|
||||||
|
mountPath: /docker-entrypoint-initdb.d/secret
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf .Values.extendedConfConfigMap }}
|
||||||
|
- name: postgresql-extended-config
|
||||||
|
mountPath: /bitnami/postgresql/conf/conf.d/
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: postgresql-password
|
||||||
|
mountPath: /opt/bitnami/postgresql/secrets/
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
- name: postgresql-certificates
|
||||||
|
mountPath: /opt/bitnami/postgresql/certs
|
||||||
|
readOnly: true
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.shmVolume.enabled }}
|
||||||
|
- name: dshm
|
||||||
|
mountPath: /dev/shm
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
- name: data
|
||||||
|
mountPath: {{ .Values.persistence.mountPath }}
|
||||||
|
subPath: {{ .Values.persistence.subPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap }}
|
||||||
|
- name: postgresql-config
|
||||||
|
mountPath: /bitnami/postgresql/conf
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.master.extraVolumeMounts }}
|
||||||
|
{{- toYaml .Values.master.extraVolumeMounts | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.master.sidecars }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.master.sidecars "context" $ ) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.enabled }}
|
||||||
|
- name: metrics
|
||||||
|
image: {{ template "postgresql.metrics.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
||||||
|
{{- if .Values.metrics.securityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.metrics.securityContext "enabled" | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
{{- $database := required "In order to enable metrics you need to specify a database (.Values.postgresqlDatabase or .Values.global.postgresql.postgresqlDatabase)" (include "postgresql.database" .) }}
|
||||||
|
{{- $sslmode := ternary "require" "disable" .Values.tls.enabled }}
|
||||||
|
{{- if and .Values.tls.enabled .Values.tls.certCAFilename }}
|
||||||
|
- name: DATA_SOURCE_NAME
|
||||||
|
value: {{ printf "host=127.0.0.1 port=%d user=%s sslmode=%s sslcert=%s sslkey=%s" (int (include "postgresql.port" .)) (include "postgresql.username" .) $sslmode (include "postgresql.tlsCert" .) (include "postgresql.tlsCertKey" .) }}
|
||||||
|
{{- else }}
|
||||||
|
- name: DATA_SOURCE_URI
|
||||||
|
value: {{ printf "127.0.0.1:%d/%s?sslmode=%s" (int (include "postgresql.port" .)) $database $sslmode }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: DATA_SOURCE_PASS_FILE
|
||||||
|
value: "/opt/bitnami/postgresql/secrets/postgresql-password"
|
||||||
|
{{- else }}
|
||||||
|
- name: DATA_SOURCE_PASS
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ template "postgresql.secretName" . }}
|
||||||
|
key: postgresql-password
|
||||||
|
{{- end }}
|
||||||
|
- name: DATA_SOURCE_USER
|
||||||
|
value: {{ template "postgresql.username" . }}
|
||||||
|
{{- if .Values.metrics.extraEnvVars }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.livenessProbe.enabled }}
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: http-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.readinessProbe.enabled }}
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: http-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 }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: postgresql-password
|
||||||
|
mountPath: /opt/bitnami/postgresql/secrets/
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
- name: postgresql-certificates
|
||||||
|
mountPath: /opt/bitnami/postgresql/certs
|
||||||
|
readOnly: true
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.customMetrics }}
|
||||||
|
- name: custom-metrics
|
||||||
|
mountPath: /conf
|
||||||
|
readOnly: true
|
||||||
|
args: ["--extend.query-path", "/conf/custom-metrics.yaml"]
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: http-metrics
|
||||||
|
containerPort: 9187
|
||||||
|
{{- if .Values.metrics.resources }}
|
||||||
|
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap}}
|
||||||
|
- name: postgresql-config
|
||||||
|
configMap:
|
||||||
|
name: {{ template "postgresql.configurationCM" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf .Values.extendedConfConfigMap }}
|
||||||
|
- name: postgresql-extended-config
|
||||||
|
configMap:
|
||||||
|
name: {{ template "postgresql.extendedConfigurationCM" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.usePasswordFile }}
|
||||||
|
- name: postgresql-password
|
||||||
|
secret:
|
||||||
|
secretName: {{ template "postgresql.secretName" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap .Values.initdbScripts }}
|
||||||
|
- name: custom-init-scripts
|
||||||
|
configMap:
|
||||||
|
name: {{ template "postgresql.initdbScriptsCM" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.initdbScriptsSecret }}
|
||||||
|
- name: custom-init-scripts-secret
|
||||||
|
secret:
|
||||||
|
secretName: {{ template "postgresql.initdbScriptsSecret" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.enabled }}
|
||||||
|
- name: raw-certificates
|
||||||
|
secret:
|
||||||
|
secretName: {{ required "A secret containing TLS certificates is required when TLS is enabled" .Values.tls.certificatesSecret }}
|
||||||
|
- name: postgresql-certificates
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.master.extraVolumes }}
|
||||||
|
{{- toYaml .Values.master.extraVolumes | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.metrics.enabled .Values.metrics.customMetrics }}
|
||||||
|
- name: custom-metrics
|
||||||
|
configMap:
|
||||||
|
name: {{ template "postgresql.metricsCM" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.shmVolume.enabled }}
|
||||||
|
- name: dshm
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
sizeLimit: 1Gi
|
||||||
|
{{- 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.storageClass" . }}
|
||||||
|
{{- end }}
|
||||||
18
scripts/helm/helm/databases/charts/postgresql/templates/svc-headless.yaml
Executable file
18
scripts/helm/helm/databases/charts/postgresql/templates/svc-headless.yaml
Executable file
|
|
@ -0,0 +1,18 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}-headless
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
clusterIP: None
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
port: {{ template "postgresql.port" . }}
|
||||||
|
targetPort: tcp-postgresql
|
||||||
|
selector:
|
||||||
|
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
||||||
42
scripts/helm/helm/databases/charts/postgresql/templates/svc-read.yaml
Executable file
42
scripts/helm/helm/databases/charts/postgresql/templates/svc-read.yaml
Executable file
|
|
@ -0,0 +1,42 @@
|
||||||
|
{{- if .Values.replication.enabled }}
|
||||||
|
{{- $serviceAnnotations := coalesce .Values.slave.service.annotations .Values.service.annotations -}}
|
||||||
|
{{- $serviceType := coalesce .Values.slave.service.type .Values.service.type -}}
|
||||||
|
{{- $serviceLoadBalancerIP := coalesce .Values.slave.service.loadBalancerIP .Values.service.loadBalancerIP -}}
|
||||||
|
{{- $serviceLoadBalancerSourceRanges := coalesce .Values.slave.service.loadBalancerSourceRanges .Values.service.loadBalancerSourceRanges -}}
|
||||||
|
{{- $serviceClusterIP := coalesce .Values.slave.service.clusterIP .Values.service.clusterIP -}}
|
||||||
|
{{- $serviceNodePort := coalesce .Values.slave.service.nodePort .Values.service.nodePort -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}-read
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if $serviceAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" $serviceAnnotations "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
type: {{ $serviceType }}
|
||||||
|
{{- if and $serviceLoadBalancerIP (eq $serviceType "LoadBalancer") }}
|
||||||
|
loadBalancerIP: {{ $serviceLoadBalancerIP }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (eq $serviceType "LoadBalancer") $serviceLoadBalancerSourceRanges }}
|
||||||
|
loadBalancerSourceRanges: {{- include "common.tplvalues.render" (dict "value" $serviceLoadBalancerSourceRanges "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (eq $serviceType "ClusterIP") $serviceClusterIP }}
|
||||||
|
clusterIP: {{ $serviceClusterIP }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
port: {{ template "postgresql.port" . }}
|
||||||
|
targetPort: tcp-postgresql
|
||||||
|
{{- if $serviceNodePort }}
|
||||||
|
nodePort: {{ $serviceNodePort }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
||||||
|
role: slave
|
||||||
|
{{- end }}
|
||||||
40
scripts/helm/helm/databases/charts/postgresql/templates/svc.yaml
Executable file
40
scripts/helm/helm/databases/charts/postgresql/templates/svc.yaml
Executable file
|
|
@ -0,0 +1,40 @@
|
||||||
|
{{- $serviceAnnotations := coalesce .Values.master.service.annotations .Values.service.annotations -}}
|
||||||
|
{{- $serviceType := coalesce .Values.master.service.type .Values.service.type -}}
|
||||||
|
{{- $serviceLoadBalancerIP := coalesce .Values.master.service.loadBalancerIP .Values.service.loadBalancerIP -}}
|
||||||
|
{{- $serviceLoadBalancerSourceRanges := coalesce .Values.master.service.loadBalancerSourceRanges .Values.service.loadBalancerSourceRanges -}}
|
||||||
|
{{- $serviceClusterIP := coalesce .Values.master.service.clusterIP .Values.service.clusterIP -}}
|
||||||
|
{{- $serviceNodePort := coalesce .Values.master.service.nodePort .Values.service.nodePort -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "postgresql.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if $serviceAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" $serviceAnnotations "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
type: {{ $serviceType }}
|
||||||
|
{{- if and $serviceLoadBalancerIP (eq $serviceType "LoadBalancer") }}
|
||||||
|
loadBalancerIP: {{ $serviceLoadBalancerIP }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (eq $serviceType "LoadBalancer") $serviceLoadBalancerSourceRanges }}
|
||||||
|
loadBalancerSourceRanges: {{- include "common.tplvalues.render" (dict "value" $serviceLoadBalancerSourceRanges "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (eq $serviceType "ClusterIP") $serviceClusterIP }}
|
||||||
|
clusterIP: {{ $serviceClusterIP }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
port: {{ template "postgresql.port" . }}
|
||||||
|
targetPort: tcp-postgresql
|
||||||
|
{{- if $serviceNodePort }}
|
||||||
|
nodePort: {{ $serviceNodePort }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
||||||
|
role: master
|
||||||
711
scripts/helm/helm/databases/charts/postgresql/values-production.yaml
Executable file
711
scripts/helm/helm/databases/charts/postgresql/values-production.yaml
Executable file
|
|
@ -0,0 +1,711 @@
|
||||||
|
## 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 and imagePullSecrets
|
||||||
|
##
|
||||||
|
global:
|
||||||
|
postgresql: {}
|
||||||
|
# imageRegistry: myRegistryName
|
||||||
|
# imagePullSecrets:
|
||||||
|
# - myRegistryKeySecretName
|
||||||
|
# storageClass: myStorageClass
|
||||||
|
|
||||||
|
## Bitnami PostgreSQL image version
|
||||||
|
## ref: https://hub.docker.com/r/bitnami/postgresql/tags/
|
||||||
|
##
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/postgresql
|
||||||
|
tag: 11.9.0-debian-10-r48
|
||||||
|
## 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
|
||||||
|
## It turns BASH and NAMI debugging in minideb
|
||||||
|
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||||
|
##
|
||||||
|
debug: false
|
||||||
|
|
||||||
|
## String to partially override postgresql.fullname template (will maintain the release name)
|
||||||
|
##
|
||||||
|
# nameOverride:
|
||||||
|
|
||||||
|
## String to fully override postgresql.fullname template
|
||||||
|
##
|
||||||
|
# fullnameOverride:
|
||||||
|
|
||||||
|
##
|
||||||
|
## Init containers parameters:
|
||||||
|
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
|
||||||
|
##
|
||||||
|
volumePermissions:
|
||||||
|
enabled: false
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/minideb
|
||||||
|
tag: buster
|
||||||
|
## 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
|
||||||
|
## Init container Security Context
|
||||||
|
## Note: the chown of the data folder is done to securityContext.runAsUser
|
||||||
|
## and not the below volumePermissions.securityContext.runAsUser
|
||||||
|
## When runAsUser is set to special value "auto", init container will try to chwon the
|
||||||
|
## data folder to autodetermined user&group, using commands: `id -u`:`id -G | cut -d" " -f2`
|
||||||
|
## "auto" is especially useful for OpenShift which has scc with dynamic userids (and 0 is not allowed).
|
||||||
|
## You may want to use this volumePermissions.securityContext.runAsUser="auto" in combination with
|
||||||
|
## pod securityContext.enabled=false and shmVolume.chmod.enabled=false
|
||||||
|
##
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
|
||||||
|
## Use an alternate scheduler, e.g. "stork".
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||||
|
##
|
||||||
|
# schedulerName:
|
||||||
|
|
||||||
|
## Pod Security Context
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||||
|
##
|
||||||
|
securityContext:
|
||||||
|
enabled: true
|
||||||
|
fsGroup: 1001
|
||||||
|
|
||||||
|
## Container Security Context
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||||
|
##
|
||||||
|
containerSecurityContext:
|
||||||
|
enabled: true
|
||||||
|
runAsUser: 1001
|
||||||
|
|
||||||
|
## Pod Service Account
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
|
||||||
|
##
|
||||||
|
serviceAccount:
|
||||||
|
enabled: false
|
||||||
|
## Name of an already existing service account. Setting this value disables the automatic service account creation.
|
||||||
|
# name:
|
||||||
|
|
||||||
|
## Pod Security Policy
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/
|
||||||
|
##
|
||||||
|
psp:
|
||||||
|
create: false
|
||||||
|
|
||||||
|
## Creates role for ServiceAccount
|
||||||
|
## Required for PSP
|
||||||
|
##
|
||||||
|
rbac:
|
||||||
|
create: false
|
||||||
|
|
||||||
|
replication:
|
||||||
|
enabled: true
|
||||||
|
user: repl_user
|
||||||
|
password: repl_password
|
||||||
|
slaveReplicas: 2
|
||||||
|
## Set synchronous commit mode: on, off, remote_apply, remote_write and local
|
||||||
|
## ref: https://www.postgresql.org/docs/9.6/runtime-config-wal.html#GUC-WAL-LEVEL
|
||||||
|
##
|
||||||
|
synchronousCommit: "on"
|
||||||
|
## From the number of `slaveReplicas` defined above, set the number of those that will have synchronous replication
|
||||||
|
## NOTE: It cannot be > slaveReplicas
|
||||||
|
##
|
||||||
|
numSynchronousReplicas: 1
|
||||||
|
## Replication Cluster application name. Useful for defining multiple replication policies
|
||||||
|
##
|
||||||
|
applicationName: my_application
|
||||||
|
|
||||||
|
## PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`)
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-user-on-first-run (see note!)
|
||||||
|
# postgresqlPostgresPassword:
|
||||||
|
|
||||||
|
## PostgreSQL user (has superuser privileges if username is `postgres`)
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run
|
||||||
|
##
|
||||||
|
postgresqlUsername: postgres
|
||||||
|
|
||||||
|
## PostgreSQL password
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run
|
||||||
|
##
|
||||||
|
# postgresqlPassword:
|
||||||
|
|
||||||
|
## PostgreSQL password using existing secret
|
||||||
|
## existingSecret: secret
|
||||||
|
##
|
||||||
|
|
||||||
|
## Mount PostgreSQL secret as a file instead of passing environment variable
|
||||||
|
# usePasswordFile: false
|
||||||
|
|
||||||
|
## Create a database
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-on-first-run
|
||||||
|
##
|
||||||
|
# postgresqlDatabase:
|
||||||
|
|
||||||
|
## PostgreSQL data dir
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||||
|
##
|
||||||
|
postgresqlDataDir: /bitnami/postgresql/data
|
||||||
|
|
||||||
|
## An array to add extra environment variables
|
||||||
|
## For example:
|
||||||
|
## extraEnv:
|
||||||
|
## - name: FOO
|
||||||
|
## value: "bar"
|
||||||
|
##
|
||||||
|
# extraEnv:
|
||||||
|
extraEnv: []
|
||||||
|
|
||||||
|
## Name of a ConfigMap containing extra env vars
|
||||||
|
##
|
||||||
|
# extraEnvVarsCM:
|
||||||
|
|
||||||
|
## Specify extra initdb args
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||||
|
##
|
||||||
|
# postgresqlInitdbArgs:
|
||||||
|
|
||||||
|
## Specify a custom location for the PostgreSQL transaction log
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||||
|
##
|
||||||
|
# postgresqlInitdbWalDir:
|
||||||
|
|
||||||
|
## 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://www.postgresql.org/docs/current/static/runtime-config.html
|
||||||
|
##
|
||||||
|
# postgresqlConfiguration:
|
||||||
|
|
||||||
|
## PostgreSQL extended configuration
|
||||||
|
## As above, but _appended_ to the main configuration
|
||||||
|
## Alternatively, you can put your *.conf under the files/conf.d/ directory
|
||||||
|
## https://github.com/bitnami/bitnami-docker-postgresql#allow-settings-to-be-loaded-from-files-other-than-the-default-postgresqlconf
|
||||||
|
##
|
||||||
|
# postgresqlExtendedConf:
|
||||||
|
|
||||||
|
## Configure current cluster's master server to be the standby server in other cluster.
|
||||||
|
## This will allow cross cluster replication and provide cross cluster high availability.
|
||||||
|
## You will need to configure pgHbaConfiguration if you want to enable this feature with local cluster replication enabled.
|
||||||
|
##
|
||||||
|
masterAsStandBy:
|
||||||
|
enabled: false
|
||||||
|
# masterHost:
|
||||||
|
# masterPort:
|
||||||
|
|
||||||
|
## 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
|
||||||
|
# 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 postgresqlConfiguration and pgHbaConfiguration
|
||||||
|
# configurationConfigMap:
|
||||||
|
|
||||||
|
## ConfigMap with PostgreSQL extended configuration
|
||||||
|
# extendedConfConfigMap:
|
||||||
|
|
||||||
|
## 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."
|
||||||
|
|
||||||
|
## Specify the PostgreSQL username and password to execute the initdb scripts
|
||||||
|
# initdbUser:
|
||||||
|
# initdbPassword:
|
||||||
|
|
||||||
|
## ConfigMap with scripts to be run at first boot
|
||||||
|
## NOTE: This will override initdbScripts
|
||||||
|
# initdbScriptsConfigMap:
|
||||||
|
|
||||||
|
## Secret with scripts to be run at first boot (in case it contains sensitive information)
|
||||||
|
## NOTE: This can work along initdbScripts or initdbScriptsConfigMap
|
||||||
|
# initdbScriptsSecret:
|
||||||
|
|
||||||
|
## Optional duration in seconds the pod needs to terminate gracefully.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods
|
||||||
|
##
|
||||||
|
# terminationGracePeriodSeconds: 30
|
||||||
|
|
||||||
|
## LDAP configuration
|
||||||
|
##
|
||||||
|
ldap:
|
||||||
|
enabled: false
|
||||||
|
url: ""
|
||||||
|
server: ""
|
||||||
|
port: ""
|
||||||
|
prefix: ""
|
||||||
|
suffix: ""
|
||||||
|
baseDN: ""
|
||||||
|
bindDN: ""
|
||||||
|
bind_password:
|
||||||
|
search_attr: ""
|
||||||
|
search_filter: ""
|
||||||
|
scheme: ""
|
||||||
|
tls: false
|
||||||
|
|
||||||
|
## Audit settings
|
||||||
|
## https://github.com/bitnami/bitnami-docker-postgresql#auditing
|
||||||
|
##
|
||||||
|
audit:
|
||||||
|
## Log client hostnames
|
||||||
|
##
|
||||||
|
logHostname: false
|
||||||
|
## Log connections to the server
|
||||||
|
##
|
||||||
|
logConnections: false
|
||||||
|
## Log disconnections
|
||||||
|
##
|
||||||
|
logDisconnections: false
|
||||||
|
## Operation to audit using pgAudit (default if not set)
|
||||||
|
##
|
||||||
|
pgAuditLog: ""
|
||||||
|
## Log catalog using pgAudit
|
||||||
|
##
|
||||||
|
pgAuditLogCatalog: "off"
|
||||||
|
## Log level for clients
|
||||||
|
##
|
||||||
|
clientMinMessages: error
|
||||||
|
## Template for log line prefix (default if not set)
|
||||||
|
##
|
||||||
|
logLinePrefix: ""
|
||||||
|
## Log timezone
|
||||||
|
##
|
||||||
|
logTimezone: ""
|
||||||
|
|
||||||
|
## Shared preload libraries
|
||||||
|
##
|
||||||
|
postgresqlSharedPreloadLibraries: "pgaudit"
|
||||||
|
|
||||||
|
## Maximum total connections
|
||||||
|
##
|
||||||
|
postgresqlMaxConnections:
|
||||||
|
|
||||||
|
## Maximum connections for the postgres user
|
||||||
|
##
|
||||||
|
postgresqlPostgresConnectionLimit:
|
||||||
|
|
||||||
|
## Maximum connections for the created user
|
||||||
|
##
|
||||||
|
postgresqlDbUserConnectionLimit:
|
||||||
|
|
||||||
|
## TCP keepalives interval
|
||||||
|
##
|
||||||
|
postgresqlTcpKeepalivesInterval:
|
||||||
|
|
||||||
|
## TCP keepalives idle
|
||||||
|
##
|
||||||
|
postgresqlTcpKeepalivesIdle:
|
||||||
|
|
||||||
|
## TCP keepalives count
|
||||||
|
##
|
||||||
|
postgresqlTcpKeepalivesCount:
|
||||||
|
|
||||||
|
## Statement timeout
|
||||||
|
##
|
||||||
|
postgresqlStatementTimeout:
|
||||||
|
|
||||||
|
## Remove pg_hba.conf lines with the following comma-separated patterns
|
||||||
|
## (cannot be used with custom pg_hba.conf)
|
||||||
|
##
|
||||||
|
postgresqlPghbaRemoveFilters:
|
||||||
|
|
||||||
|
## PostgreSQL service configuration
|
||||||
|
##
|
||||||
|
service:
|
||||||
|
## PosgresSQL service type
|
||||||
|
##
|
||||||
|
type: ClusterIP
|
||||||
|
# clusterIP: None
|
||||||
|
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:
|
||||||
|
|
||||||
|
## Provide any additional annotations which may be required. Evaluated as a template.
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
## Set the LoadBalancer service type to internal only.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||||
|
##
|
||||||
|
# loadBalancerIP:
|
||||||
|
## Load Balancer sources. Evaluated as a template.
|
||||||
|
## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
|
||||||
|
##
|
||||||
|
# loadBalancerSourceRanges:
|
||||||
|
# - 10.10.10.0/24
|
||||||
|
|
||||||
|
## Start master and slave(s) pod(s) without limitations on shm memory.
|
||||||
|
## By default docker and containerd (and possibly other container runtimes)
|
||||||
|
## limit `/dev/shm` to `64M` (see e.g. the
|
||||||
|
## [docker issue](https://github.com/docker-library/postgres/issues/416) and the
|
||||||
|
## [containerd issue](https://github.com/containerd/containerd/issues/3654),
|
||||||
|
## which could be not enough if PostgreSQL uses parallel workers heavily.
|
||||||
|
##
|
||||||
|
shmVolume:
|
||||||
|
## Set `shmVolume.enabled` to `true` to mount a new tmpfs volume to remove
|
||||||
|
## this limitation.
|
||||||
|
##
|
||||||
|
enabled: true
|
||||||
|
## Set to `true` to `chmod 777 /dev/shm` on a initContainer.
|
||||||
|
## This option is ingored if `volumePermissions.enabled` is `false`
|
||||||
|
##
|
||||||
|
chmod:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
## PostgreSQL data 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. (gp2 on AWS, standard on
|
||||||
|
## GKE, AWS & OpenStack)
|
||||||
|
##
|
||||||
|
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, so, for example, the name can depend on .Release or .Chart
|
||||||
|
##
|
||||||
|
# existingClaim:
|
||||||
|
|
||||||
|
## The path the volume will be mounted at, useful when using different
|
||||||
|
## PostgreSQL images.
|
||||||
|
##
|
||||||
|
mountPath: /bitnami/postgresql
|
||||||
|
|
||||||
|
## The subdirectory of the volume to mount to, useful in dev environments
|
||||||
|
## and one PV for multiple services.
|
||||||
|
##
|
||||||
|
subPath: ""
|
||||||
|
|
||||||
|
# storageClass: "-"
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
size: 8Gi
|
||||||
|
annotations: {}
|
||||||
|
|
||||||
|
## updateStrategy for PostgreSQL StatefulSet and its slaves StatefulSets
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
|
||||||
|
##
|
||||||
|
updateStrategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
|
||||||
|
##
|
||||||
|
## PostgreSQL Master parameters
|
||||||
|
##
|
||||||
|
master:
|
||||||
|
## Node, affinity, tolerations, and priorityclass settings for pod assignment
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption
|
||||||
|
##
|
||||||
|
nodeSelector: {}
|
||||||
|
affinity: {}
|
||||||
|
tolerations: []
|
||||||
|
labels: {}
|
||||||
|
annotations: {}
|
||||||
|
podLabels: {}
|
||||||
|
podAnnotations: {}
|
||||||
|
priorityClassName: ""
|
||||||
|
## Additional PostgreSQL Master Volume mounts
|
||||||
|
##
|
||||||
|
extraVolumeMounts: []
|
||||||
|
## Additional PostgreSQL Master Volumes
|
||||||
|
##
|
||||||
|
extraVolumes: []
|
||||||
|
## Add sidecars to the pod
|
||||||
|
##
|
||||||
|
## For example:
|
||||||
|
## sidecars:
|
||||||
|
## - name: your-image-name
|
||||||
|
## image: your-image
|
||||||
|
## imagePullPolicy: Always
|
||||||
|
## ports:
|
||||||
|
## - name: portname
|
||||||
|
## containerPort: 1234
|
||||||
|
##
|
||||||
|
sidecars: []
|
||||||
|
|
||||||
|
## Override the service configuration for master
|
||||||
|
##
|
||||||
|
service: {}
|
||||||
|
# type:
|
||||||
|
# nodePort:
|
||||||
|
# clusterIP:
|
||||||
|
|
||||||
|
##
|
||||||
|
## PostgreSQL Slave parameters
|
||||||
|
##
|
||||||
|
slave:
|
||||||
|
## Node, affinity, tolerations, and priorityclass settings for pod assignment
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption
|
||||||
|
##
|
||||||
|
nodeSelector: {}
|
||||||
|
affinity: {}
|
||||||
|
tolerations: []
|
||||||
|
labels: {}
|
||||||
|
annotations: {}
|
||||||
|
podLabels: {}
|
||||||
|
podAnnotations: {}
|
||||||
|
priorityClassName: ""
|
||||||
|
## Extra init containers
|
||||||
|
## Example
|
||||||
|
##
|
||||||
|
## extraInitContainers:
|
||||||
|
## - name: do-something
|
||||||
|
## image: busybox
|
||||||
|
## command: ['do', 'something']
|
||||||
|
##
|
||||||
|
extraInitContainers: []
|
||||||
|
## Additional PostgreSQL Slave Volume mounts
|
||||||
|
##
|
||||||
|
extraVolumeMounts: []
|
||||||
|
## Additional PostgreSQL Slave Volumes
|
||||||
|
##
|
||||||
|
extraVolumes: []
|
||||||
|
## Add sidecars to the pod
|
||||||
|
##
|
||||||
|
## For example:
|
||||||
|
## sidecars:
|
||||||
|
## - name: your-image-name
|
||||||
|
## image: your-image
|
||||||
|
## imagePullPolicy: Always
|
||||||
|
## ports:
|
||||||
|
## - name: portname
|
||||||
|
## containerPort: 1234
|
||||||
|
##
|
||||||
|
sidecars: []
|
||||||
|
|
||||||
|
## Override the service configuration for slave
|
||||||
|
##
|
||||||
|
service: {}
|
||||||
|
# type:
|
||||||
|
# nodePort:
|
||||||
|
# clusterIP:
|
||||||
|
## Whether to enable PostgreSQL slave replicas data Persistent
|
||||||
|
##
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# Override the resource configuration for slave
|
||||||
|
resources: {}
|
||||||
|
# requests:
|
||||||
|
# memory: 256Mi
|
||||||
|
# cpu: 250m
|
||||||
|
|
||||||
|
## Configure resource requests and limits
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||||
|
##
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 256Mi
|
||||||
|
cpu: 250m
|
||||||
|
|
||||||
|
## Add annotations to all the deployed resources
|
||||||
|
##
|
||||||
|
commonAnnotations: {}
|
||||||
|
|
||||||
|
networkPolicy:
|
||||||
|
## Enable creation of NetworkPolicy resources. Only Ingress traffic is filtered for now.
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
## The Policy model to apply. When set to false, only pods with the correct
|
||||||
|
## client label 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
|
||||||
|
|
||||||
|
## if explicitNamespacesSelector is missing or set to {}, only client Pods that are in the networkPolicy's namespace
|
||||||
|
## and that match other criteria, the ones that have the good label, can reach the DB.
|
||||||
|
## But sometimes, we want the DB to be accessible to clients from other namespaces, in this case, we can use this
|
||||||
|
## LabelSelector to select these namespaces, note that the networkPolicy's namespace should also be explicitly added.
|
||||||
|
##
|
||||||
|
## Example:
|
||||||
|
## explicitNamespacesSelector:
|
||||||
|
## matchLabels:
|
||||||
|
## role: frontend
|
||||||
|
## matchExpressions:
|
||||||
|
## - {key: role, operator: In, values: [frontend]}
|
||||||
|
##
|
||||||
|
explicitNamespacesSelector: {}
|
||||||
|
|
||||||
|
## Configure extra options for liveness and readiness probes
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||||
|
##
|
||||||
|
livenessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
|
||||||
|
readinessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
|
||||||
|
## Custom Liveness probe
|
||||||
|
##
|
||||||
|
customLivenessProbe: {}
|
||||||
|
|
||||||
|
## Custom Rediness probe
|
||||||
|
##
|
||||||
|
customReadinessProbe: {}
|
||||||
|
|
||||||
|
##
|
||||||
|
## TLS configuration
|
||||||
|
##
|
||||||
|
tls:
|
||||||
|
# Enable TLS traffic
|
||||||
|
enabled: false
|
||||||
|
#
|
||||||
|
# Whether to use the server's TLS cipher preferences rather than the client's.
|
||||||
|
preferServerCiphers: true
|
||||||
|
#
|
||||||
|
# Name of the Secret that contains the certificates
|
||||||
|
certificatesSecret: ""
|
||||||
|
#
|
||||||
|
# Certificate filename
|
||||||
|
certFilename: ""
|
||||||
|
#
|
||||||
|
# Certificate Key filename
|
||||||
|
certKeyFilename: ""
|
||||||
|
#
|
||||||
|
# CA Certificate filename
|
||||||
|
# If provided, PostgreSQL will authenticate TLS/SSL clients by requesting them a certificate
|
||||||
|
# ref: https://www.postgresql.org/docs/9.6/auth-methods.html
|
||||||
|
certCAFilename:
|
||||||
|
#
|
||||||
|
# File containing a Certificate Revocation List
|
||||||
|
crlFilename:
|
||||||
|
|
||||||
|
## Configure metrics exporter
|
||||||
|
##
|
||||||
|
metrics:
|
||||||
|
enabled: true
|
||||||
|
# resources: {}
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/port: "9187"
|
||||||
|
loadBalancerIP:
|
||||||
|
serviceMonitor:
|
||||||
|
enabled: false
|
||||||
|
additionalLabels: {}
|
||||||
|
# namespace: monitoring
|
||||||
|
# interval: 30s
|
||||||
|
# scrapeTimeout: 10s
|
||||||
|
## Custom PrometheusRule to be defined
|
||||||
|
## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart
|
||||||
|
## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions
|
||||||
|
##
|
||||||
|
prometheusRule:
|
||||||
|
enabled: false
|
||||||
|
additionalLabels: {}
|
||||||
|
namespace: ""
|
||||||
|
## These are just examples rules, please adapt them to your needs.
|
||||||
|
## Make sure to constraint the rules to the current postgresql service.
|
||||||
|
## rules:
|
||||||
|
## - alert: HugeReplicationLag
|
||||||
|
## expr: pg_replication_lag{service="{{ template "postgresql.fullname" . }}-metrics"} / 3600 > 1
|
||||||
|
## for: 1m
|
||||||
|
## labels:
|
||||||
|
## severity: critical
|
||||||
|
## annotations:
|
||||||
|
## description: replication for {{ template "postgresql.fullname" . }} PostgreSQL is lagging by {{ "{{ $value }}" }} hour(s).
|
||||||
|
## summary: PostgreSQL replication is lagging by {{ "{{ $value }}" }} hour(s).
|
||||||
|
##
|
||||||
|
rules: []
|
||||||
|
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/postgres-exporter
|
||||||
|
tag: 0.8.0-debian-10-r242
|
||||||
|
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
|
||||||
|
## Define additional custom metrics
|
||||||
|
## ref: https://github.com/wrouesnel/postgres_exporter#adding-new-metrics-via-a-config-file
|
||||||
|
# customMetrics:
|
||||||
|
# pg_database:
|
||||||
|
# query: "SELECT d.datname AS name, CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') THEN pg_catalog.pg_database_size(d.datname) ELSE 0 END AS size FROM pg_catalog.pg_database d where datname not in ('template0', 'template1', 'postgres')"
|
||||||
|
# metrics:
|
||||||
|
# - name:
|
||||||
|
# usage: "LABEL"
|
||||||
|
# description: "Name of the database"
|
||||||
|
# - size_bytes:
|
||||||
|
# usage: "GAUGE"
|
||||||
|
# description: "Size of the database in bytes"
|
||||||
|
## An array to add extra env vars to configure postgres-exporter
|
||||||
|
## see: https://github.com/wrouesnel/postgres_exporter#environment-variables
|
||||||
|
## For example:
|
||||||
|
# extraEnvVars:
|
||||||
|
# - name: PG_EXPORTER_DISABLE_DEFAULT_METRICS
|
||||||
|
# value: "true"
|
||||||
|
extraEnvVars: {}
|
||||||
|
|
||||||
|
## Pod Security Context
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||||
|
##
|
||||||
|
securityContext:
|
||||||
|
enabled: false
|
||||||
|
runAsUser: 1001
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||||
|
## Configure extra options for liveness and readiness probes
|
||||||
|
##
|
||||||
|
livenessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
|
||||||
|
readinessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
103
scripts/helm/helm/databases/charts/postgresql/values.schema.json
Executable file
103
scripts/helm/helm/databases/charts/postgresql/values.schema.json
Executable file
|
|
@ -0,0 +1,103 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/schema#",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"postgresqlUsername": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Admin user",
|
||||||
|
"form": true
|
||||||
|
},
|
||||||
|
"postgresqlPassword": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Password",
|
||||||
|
"form": true
|
||||||
|
},
|
||||||
|
"persistence": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"size": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Persistent Volume Size",
|
||||||
|
"form": true,
|
||||||
|
"render": "slider",
|
||||||
|
"sliderMin": 1,
|
||||||
|
"sliderMax": 100,
|
||||||
|
"sliderUnit": "Gi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resources": {
|
||||||
|
"type": "object",
|
||||||
|
"title": "Required Resources",
|
||||||
|
"description": "Configure resource requests",
|
||||||
|
"form": true,
|
||||||
|
"properties": {
|
||||||
|
"requests": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"memory": {
|
||||||
|
"type": "string",
|
||||||
|
"form": true,
|
||||||
|
"render": "slider",
|
||||||
|
"title": "Memory Request",
|
||||||
|
"sliderMin": 10,
|
||||||
|
"sliderMax": 2048,
|
||||||
|
"sliderUnit": "Mi"
|
||||||
|
},
|
||||||
|
"cpu": {
|
||||||
|
"type": "string",
|
||||||
|
"form": true,
|
||||||
|
"render": "slider",
|
||||||
|
"title": "CPU Request",
|
||||||
|
"sliderMin": 10,
|
||||||
|
"sliderMax": 2000,
|
||||||
|
"sliderUnit": "m"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"replication": {
|
||||||
|
"type": "object",
|
||||||
|
"form": true,
|
||||||
|
"title": "Replication Details",
|
||||||
|
"properties": {
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Enable Replication",
|
||||||
|
"form": true
|
||||||
|
},
|
||||||
|
"slaveReplicas": {
|
||||||
|
"type": "integer",
|
||||||
|
"title": "Slave Replicas",
|
||||||
|
"form": true,
|
||||||
|
"hidden": {
|
||||||
|
"value": false,
|
||||||
|
"path": "replication/enabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"volumePermissions": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"form": true,
|
||||||
|
"title": "Enable Init Containers",
|
||||||
|
"description": "Change the owner of the persist volume mountpoint to RunAsUser:fsGroup"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Configure metrics exporter",
|
||||||
|
"form": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
722
scripts/helm/helm/databases/charts/postgresql/values.yaml
Executable file
722
scripts/helm/helm/databases/charts/postgresql/values.yaml
Executable file
|
|
@ -0,0 +1,722 @@
|
||||||
|
## 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 and imagePullSecrets
|
||||||
|
##
|
||||||
|
global:
|
||||||
|
postgresql: {}
|
||||||
|
# imageRegistry: myRegistryName
|
||||||
|
# imagePullSecrets:
|
||||||
|
# - myRegistryKeySecretName
|
||||||
|
# storageClass: myStorageClass
|
||||||
|
|
||||||
|
## Bitnami PostgreSQL image version
|
||||||
|
## ref: https://hub.docker.com/r/bitnami/postgresql/tags/
|
||||||
|
##
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/postgresql
|
||||||
|
tag: 11.9.0-debian-10-r48
|
||||||
|
## 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
|
||||||
|
## It turns BASH and NAMI debugging in minideb
|
||||||
|
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||||
|
##
|
||||||
|
debug: false
|
||||||
|
|
||||||
|
## String to partially override postgresql.fullname template (will maintain the release name)
|
||||||
|
##
|
||||||
|
# nameOverride:
|
||||||
|
|
||||||
|
## String to fully override postgresql.fullname template
|
||||||
|
##
|
||||||
|
# fullnameOverride:
|
||||||
|
|
||||||
|
##
|
||||||
|
## Init containers parameters:
|
||||||
|
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
|
||||||
|
##
|
||||||
|
volumePermissions:
|
||||||
|
enabled: false
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/minideb
|
||||||
|
tag: buster
|
||||||
|
## 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
|
||||||
|
## Init container Security Context
|
||||||
|
## Note: the chown of the data folder is done to securityContext.runAsUser
|
||||||
|
## and not the below volumePermissions.securityContext.runAsUser
|
||||||
|
## When runAsUser is set to special value "auto", init container will try to chwon the
|
||||||
|
## data folder to autodetermined user&group, using commands: `id -u`:`id -G | cut -d" " -f2`
|
||||||
|
## "auto" is especially useful for OpenShift which has scc with dynamic userids (and 0 is not allowed).
|
||||||
|
## You may want to use this volumePermissions.securityContext.runAsUser="auto" in combination with
|
||||||
|
## pod securityContext.enabled=false and shmVolume.chmod.enabled=false
|
||||||
|
##
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
|
||||||
|
## Use an alternate scheduler, e.g. "stork".
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||||
|
##
|
||||||
|
# schedulerName:
|
||||||
|
|
||||||
|
## Pod Security Context
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||||
|
##
|
||||||
|
securityContext:
|
||||||
|
enabled: true
|
||||||
|
fsGroup: 1001
|
||||||
|
|
||||||
|
## Container Security Context
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||||
|
##
|
||||||
|
containerSecurityContext:
|
||||||
|
enabled: true
|
||||||
|
runAsUser: 1001
|
||||||
|
|
||||||
|
## Pod Service Account
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
|
||||||
|
##
|
||||||
|
serviceAccount:
|
||||||
|
enabled: false
|
||||||
|
## Name of an already existing service account. Setting this value disables the automatic service account creation.
|
||||||
|
# name:
|
||||||
|
|
||||||
|
## Pod Security Policy
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/
|
||||||
|
##
|
||||||
|
psp:
|
||||||
|
create: false
|
||||||
|
|
||||||
|
## Creates role for ServiceAccount
|
||||||
|
## Required for PSP
|
||||||
|
##
|
||||||
|
rbac:
|
||||||
|
create: false
|
||||||
|
|
||||||
|
replication:
|
||||||
|
enabled: false
|
||||||
|
user: repl_user
|
||||||
|
password: repl_password
|
||||||
|
slaveReplicas: 1
|
||||||
|
## Set synchronous commit mode: on, off, remote_apply, remote_write and local
|
||||||
|
## ref: https://www.postgresql.org/docs/9.6/runtime-config-wal.html#GUC-WAL-LEVEL
|
||||||
|
##
|
||||||
|
synchronousCommit: 'off'
|
||||||
|
## From the number of `slaveReplicas` defined above, set the number of those that will have synchronous replication
|
||||||
|
## NOTE: It cannot be > slaveReplicas
|
||||||
|
##
|
||||||
|
numSynchronousReplicas: 0
|
||||||
|
## Replication Cluster application name. Useful for defining multiple replication policies
|
||||||
|
##
|
||||||
|
applicationName: my_application
|
||||||
|
|
||||||
|
## PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`)
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-user-on-first-run (see note!)
|
||||||
|
# postgresqlPostgresPassword:
|
||||||
|
|
||||||
|
## PostgreSQL user (has superuser privileges if username is `postgres`)
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run
|
||||||
|
##
|
||||||
|
postgresqlUsername: postgres
|
||||||
|
|
||||||
|
## PostgreSQL password
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run
|
||||||
|
##
|
||||||
|
postgresqlPassword: asayerPostgres
|
||||||
|
|
||||||
|
## PostgreSQL password using existing secret
|
||||||
|
## existingSecret: secret
|
||||||
|
##
|
||||||
|
|
||||||
|
## Mount PostgreSQL secret as a file instead of passing environment variable
|
||||||
|
# usePasswordFile: false
|
||||||
|
|
||||||
|
## Create a database
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-on-first-run
|
||||||
|
##
|
||||||
|
# postgresqlDatabase:
|
||||||
|
|
||||||
|
## PostgreSQL data dir
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||||
|
##
|
||||||
|
postgresqlDataDir: /bitnami/postgresql/data
|
||||||
|
|
||||||
|
## An array to add extra environment variables
|
||||||
|
## For example:
|
||||||
|
## extraEnv:
|
||||||
|
## - name: FOO
|
||||||
|
## value: "bar"
|
||||||
|
##
|
||||||
|
# extraEnv:
|
||||||
|
extraEnv: []
|
||||||
|
|
||||||
|
## Name of a ConfigMap containing extra env vars
|
||||||
|
##
|
||||||
|
# extraEnvVarsCM:
|
||||||
|
|
||||||
|
## Specify extra initdb args
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||||
|
##
|
||||||
|
# postgresqlInitdbArgs:
|
||||||
|
|
||||||
|
## Specify a custom location for the PostgreSQL transaction log
|
||||||
|
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||||
|
##
|
||||||
|
# postgresqlInitdbWalDir:
|
||||||
|
|
||||||
|
## 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://www.postgresql.org/docs/current/static/runtime-config.html
|
||||||
|
##
|
||||||
|
# postgresqlConfiguration:
|
||||||
|
|
||||||
|
## PostgreSQL extended configuration
|
||||||
|
## As above, but _appended_ to the main configuration
|
||||||
|
## Alternatively, you can put your *.conf under the files/conf.d/ directory
|
||||||
|
## https://github.com/bitnami/bitnami-docker-postgresql#allow-settings-to-be-loaded-from-files-other-than-the-default-postgresqlconf
|
||||||
|
##
|
||||||
|
# postgresqlExtendedConf:
|
||||||
|
|
||||||
|
## Configure current cluster's master server to be the standby server in other cluster.
|
||||||
|
## This will allow cross cluster replication and provide cross cluster high availability.
|
||||||
|
## You will need to configure pgHbaConfiguration if you want to enable this feature with local cluster replication enabled.
|
||||||
|
##
|
||||||
|
masterAsStandBy:
|
||||||
|
enabled: false
|
||||||
|
# masterHost:
|
||||||
|
# masterPort:
|
||||||
|
|
||||||
|
## 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
|
||||||
|
# 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 postgresqlConfiguration and pgHbaConfiguration
|
||||||
|
# configurationConfigMap:
|
||||||
|
|
||||||
|
## ConfigMap with PostgreSQL extended configuration
|
||||||
|
# extendedConfConfigMap:
|
||||||
|
|
||||||
|
## 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
|
||||||
|
# initdbScriptsConfigMap:
|
||||||
|
|
||||||
|
## Secret with scripts to be run at first boot (in case it contains sensitive information)
|
||||||
|
## NOTE: This can work along initdbScripts or initdbScriptsConfigMap
|
||||||
|
# initdbScriptsSecret:
|
||||||
|
|
||||||
|
## Specify the PostgreSQL username and password to execute the initdb scripts
|
||||||
|
# initdbUser:
|
||||||
|
# initdbPassword:
|
||||||
|
|
||||||
|
## Audit settings
|
||||||
|
## https://github.com/bitnami/bitnami-docker-postgresql#auditing
|
||||||
|
##
|
||||||
|
audit:
|
||||||
|
## Log client hostnames
|
||||||
|
##
|
||||||
|
logHostname: false
|
||||||
|
## Log connections to the server
|
||||||
|
##
|
||||||
|
logConnections: false
|
||||||
|
## Log disconnections
|
||||||
|
##
|
||||||
|
logDisconnections: false
|
||||||
|
## Operation to audit using pgAudit (default if not set)
|
||||||
|
##
|
||||||
|
pgAuditLog: ""
|
||||||
|
## Log catalog using pgAudit
|
||||||
|
##
|
||||||
|
pgAuditLogCatalog: "off"
|
||||||
|
## Log level for clients
|
||||||
|
##
|
||||||
|
clientMinMessages: error
|
||||||
|
## Template for log line prefix (default if not set)
|
||||||
|
##
|
||||||
|
logLinePrefix: ""
|
||||||
|
## Log timezone
|
||||||
|
##
|
||||||
|
logTimezone: ""
|
||||||
|
|
||||||
|
## Shared preload libraries
|
||||||
|
##
|
||||||
|
postgresqlSharedPreloadLibraries: "pgaudit"
|
||||||
|
|
||||||
|
## Maximum total connections
|
||||||
|
##
|
||||||
|
postgresqlMaxConnections:
|
||||||
|
|
||||||
|
## Maximum connections for the postgres user
|
||||||
|
##
|
||||||
|
postgresqlPostgresConnectionLimit:
|
||||||
|
|
||||||
|
## Maximum connections for the created user
|
||||||
|
##
|
||||||
|
postgresqlDbUserConnectionLimit:
|
||||||
|
|
||||||
|
## TCP keepalives interval
|
||||||
|
##
|
||||||
|
postgresqlTcpKeepalivesInterval:
|
||||||
|
|
||||||
|
## TCP keepalives idle
|
||||||
|
##
|
||||||
|
postgresqlTcpKeepalivesIdle:
|
||||||
|
|
||||||
|
## TCP keepalives count
|
||||||
|
##
|
||||||
|
postgresqlTcpKeepalivesCount:
|
||||||
|
|
||||||
|
## Statement timeout
|
||||||
|
##
|
||||||
|
postgresqlStatementTimeout:
|
||||||
|
|
||||||
|
## Remove pg_hba.conf lines with the following comma-separated patterns
|
||||||
|
## (cannot be used with custom pg_hba.conf)
|
||||||
|
##
|
||||||
|
postgresqlPghbaRemoveFilters:
|
||||||
|
|
||||||
|
## Optional duration in seconds the pod needs to terminate gracefully.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods
|
||||||
|
##
|
||||||
|
# terminationGracePeriodSeconds: 30
|
||||||
|
|
||||||
|
## LDAP configuration
|
||||||
|
##
|
||||||
|
ldap:
|
||||||
|
enabled: false
|
||||||
|
url: ''
|
||||||
|
server: ''
|
||||||
|
port: ''
|
||||||
|
prefix: ''
|
||||||
|
suffix: ''
|
||||||
|
baseDN: ''
|
||||||
|
bindDN: ''
|
||||||
|
bind_password:
|
||||||
|
search_attr: ''
|
||||||
|
search_filter: ''
|
||||||
|
scheme: ''
|
||||||
|
tls: false
|
||||||
|
|
||||||
|
## PostgreSQL service configuration
|
||||||
|
##
|
||||||
|
service:
|
||||||
|
## PosgresSQL service type
|
||||||
|
##
|
||||||
|
type: ClusterIP
|
||||||
|
# clusterIP: None
|
||||||
|
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:
|
||||||
|
|
||||||
|
## Provide any additional annotations which may be required. Evaluated as a template.
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
## Set the LoadBalancer service type to internal only.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||||
|
##
|
||||||
|
# loadBalancerIP:
|
||||||
|
## Load Balancer sources. Evaluated as a template.
|
||||||
|
## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
|
||||||
|
##
|
||||||
|
# loadBalancerSourceRanges:
|
||||||
|
# - 10.10.10.0/24
|
||||||
|
|
||||||
|
## Start master and slave(s) pod(s) without limitations on shm memory.
|
||||||
|
## By default docker and containerd (and possibly other container runtimes)
|
||||||
|
## limit `/dev/shm` to `64M` (see e.g. the
|
||||||
|
## [docker issue](https://github.com/docker-library/postgres/issues/416) and the
|
||||||
|
## [containerd issue](https://github.com/containerd/containerd/issues/3654),
|
||||||
|
## which could be not enough if PostgreSQL uses parallel workers heavily.
|
||||||
|
##
|
||||||
|
shmVolume:
|
||||||
|
## Set `shmVolume.enabled` to `true` to mount a new tmpfs volume to remove
|
||||||
|
## this limitation.
|
||||||
|
##
|
||||||
|
enabled: true
|
||||||
|
## Set to `true` to `chmod 777 /dev/shm` on a initContainer.
|
||||||
|
## This option is ingored if `volumePermissions.enabled` is `false`
|
||||||
|
##
|
||||||
|
chmod:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
## PostgreSQL data 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. (gp2 on AWS, standard on
|
||||||
|
## GKE, AWS & OpenStack)
|
||||||
|
##
|
||||||
|
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, so, for example, the name can depend on .Release or .Chart
|
||||||
|
##
|
||||||
|
# existingClaim:
|
||||||
|
|
||||||
|
## The path the volume will be mounted at, useful when using different
|
||||||
|
## PostgreSQL images.
|
||||||
|
##
|
||||||
|
mountPath: /bitnami/postgresql
|
||||||
|
|
||||||
|
## The subdirectory of the volume to mount to, useful in dev environments
|
||||||
|
## and one PV for multiple services.
|
||||||
|
##
|
||||||
|
subPath: ''
|
||||||
|
|
||||||
|
# storageClass: "-"
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
size: 8Gi
|
||||||
|
annotations: {}
|
||||||
|
|
||||||
|
## updateStrategy for PostgreSQL StatefulSet and its slaves StatefulSets
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
|
||||||
|
##
|
||||||
|
updateStrategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
|
||||||
|
##
|
||||||
|
## PostgreSQL Master parameters
|
||||||
|
##
|
||||||
|
master:
|
||||||
|
## Node, affinity, tolerations, and priorityclass settings for pod assignment
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption
|
||||||
|
##
|
||||||
|
nodeSelector: {}
|
||||||
|
affinity: {}
|
||||||
|
tolerations: []
|
||||||
|
labels: {}
|
||||||
|
annotations: {}
|
||||||
|
podLabels: {}
|
||||||
|
podAnnotations: {}
|
||||||
|
priorityClassName: ''
|
||||||
|
## Extra init containers
|
||||||
|
## Example
|
||||||
|
##
|
||||||
|
## extraInitContainers:
|
||||||
|
## - name: do-something
|
||||||
|
## image: busybox
|
||||||
|
## command: ['do', 'something']
|
||||||
|
##
|
||||||
|
extraInitContainers: []
|
||||||
|
|
||||||
|
## Additional PostgreSQL Master Volume mounts
|
||||||
|
##
|
||||||
|
extraVolumeMounts: []
|
||||||
|
## Additional PostgreSQL Master Volumes
|
||||||
|
##
|
||||||
|
extraVolumes: []
|
||||||
|
## Add sidecars to the pod
|
||||||
|
##
|
||||||
|
## For example:
|
||||||
|
## sidecars:
|
||||||
|
## - name: your-image-name
|
||||||
|
## image: your-image
|
||||||
|
## imagePullPolicy: Always
|
||||||
|
## ports:
|
||||||
|
## - name: portname
|
||||||
|
## containerPort: 1234
|
||||||
|
##
|
||||||
|
sidecars: []
|
||||||
|
|
||||||
|
## Override the service configuration for master
|
||||||
|
##
|
||||||
|
service: {}
|
||||||
|
# type:
|
||||||
|
# nodePort:
|
||||||
|
# clusterIP:
|
||||||
|
|
||||||
|
##
|
||||||
|
## PostgreSQL Slave parameters
|
||||||
|
##
|
||||||
|
slave:
|
||||||
|
## Node, affinity, tolerations, and priorityclass settings for pod assignment
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption
|
||||||
|
##
|
||||||
|
nodeSelector: {}
|
||||||
|
affinity: {}
|
||||||
|
tolerations: []
|
||||||
|
labels: {}
|
||||||
|
annotations: {}
|
||||||
|
podLabels: {}
|
||||||
|
podAnnotations: {}
|
||||||
|
priorityClassName: ''
|
||||||
|
extraInitContainers: |
|
||||||
|
# - name: do-something
|
||||||
|
# image: busybox
|
||||||
|
# command: ['do', 'something']
|
||||||
|
## Additional PostgreSQL Slave Volume mounts
|
||||||
|
##
|
||||||
|
extraVolumeMounts: []
|
||||||
|
## Additional PostgreSQL Slave Volumes
|
||||||
|
##
|
||||||
|
extraVolumes: []
|
||||||
|
## Add sidecars to the pod
|
||||||
|
##
|
||||||
|
## For example:
|
||||||
|
## sidecars:
|
||||||
|
## - name: your-image-name
|
||||||
|
## image: your-image
|
||||||
|
## imagePullPolicy: Always
|
||||||
|
## ports:
|
||||||
|
## - name: portname
|
||||||
|
## containerPort: 1234
|
||||||
|
##
|
||||||
|
sidecars: []
|
||||||
|
|
||||||
|
## Override the service configuration for slave
|
||||||
|
##
|
||||||
|
service: {}
|
||||||
|
# type:
|
||||||
|
# nodePort:
|
||||||
|
# clusterIP:
|
||||||
|
|
||||||
|
## Whether to enable PostgreSQL slave replicas data Persistent
|
||||||
|
##
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# Override the resource configuration for slave
|
||||||
|
resources: {}
|
||||||
|
# requests:
|
||||||
|
# memory: 256Mi
|
||||||
|
# cpu: 250m
|
||||||
|
|
||||||
|
## Configure resource requests and limits
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||||
|
##
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 256Mi
|
||||||
|
cpu: 250m
|
||||||
|
|
||||||
|
## Add annotations to all the deployed resources
|
||||||
|
##
|
||||||
|
commonAnnotations: {}
|
||||||
|
|
||||||
|
networkPolicy:
|
||||||
|
## Enable creation of NetworkPolicy resources. Only Ingress traffic is filtered for now.
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
## The Policy model to apply. When set to false, only pods with the correct
|
||||||
|
## client label 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
|
||||||
|
|
||||||
|
## if explicitNamespacesSelector is missing or set to {}, only client Pods that are in the networkPolicy's namespace
|
||||||
|
## and that match other criteria, the ones that have the good label, can reach the DB.
|
||||||
|
## But sometimes, we want the DB to be accessible to clients from other namespaces, in this case, we can use this
|
||||||
|
## LabelSelector to select these namespaces, note that the networkPolicy's namespace should also be explicitly added.
|
||||||
|
##
|
||||||
|
## Example:
|
||||||
|
## explicitNamespacesSelector:
|
||||||
|
## matchLabels:
|
||||||
|
## role: frontend
|
||||||
|
## matchExpressions:
|
||||||
|
## - {key: role, operator: In, values: [frontend]}
|
||||||
|
##
|
||||||
|
explicitNamespacesSelector: {}
|
||||||
|
|
||||||
|
## Configure extra options for liveness and readiness probes
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||||
|
##
|
||||||
|
livenessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
|
||||||
|
readinessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
|
||||||
|
## Custom Liveness probe
|
||||||
|
##
|
||||||
|
customLivenessProbe: {}
|
||||||
|
|
||||||
|
## Custom Rediness probe
|
||||||
|
##
|
||||||
|
customReadinessProbe: {}
|
||||||
|
|
||||||
|
##
|
||||||
|
## TLS configuration
|
||||||
|
##
|
||||||
|
tls:
|
||||||
|
# Enable TLS traffic
|
||||||
|
enabled: false
|
||||||
|
#
|
||||||
|
# Whether to use the server's TLS cipher preferences rather than the client's.
|
||||||
|
preferServerCiphers: true
|
||||||
|
#
|
||||||
|
# Name of the Secret that contains the certificates
|
||||||
|
certificatesSecret: ''
|
||||||
|
#
|
||||||
|
# Certificate filename
|
||||||
|
certFilename: ''
|
||||||
|
#
|
||||||
|
# Certificate Key filename
|
||||||
|
certKeyFilename: ''
|
||||||
|
#
|
||||||
|
# CA Certificate filename
|
||||||
|
# If provided, PostgreSQL will authenticate TLS/SSL clients by requesting them a certificate
|
||||||
|
# ref: https://www.postgresql.org/docs/9.6/auth-methods.html
|
||||||
|
certCAFilename:
|
||||||
|
#
|
||||||
|
# File containing a Certificate Revocation List
|
||||||
|
crlFilename:
|
||||||
|
|
||||||
|
## Configure metrics exporter
|
||||||
|
##
|
||||||
|
metrics:
|
||||||
|
enabled: false
|
||||||
|
# resources: {}
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: 'true'
|
||||||
|
prometheus.io/port: '9187'
|
||||||
|
loadBalancerIP:
|
||||||
|
serviceMonitor:
|
||||||
|
enabled: false
|
||||||
|
additionalLabels: {}
|
||||||
|
# namespace: monitoring
|
||||||
|
# interval: 30s
|
||||||
|
# scrapeTimeout: 10s
|
||||||
|
## Custom PrometheusRule to be defined
|
||||||
|
## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart
|
||||||
|
## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions
|
||||||
|
##
|
||||||
|
prometheusRule:
|
||||||
|
enabled: false
|
||||||
|
additionalLabels: {}
|
||||||
|
namespace: ''
|
||||||
|
## These are just examples rules, please adapt them to your needs.
|
||||||
|
## Make sure to constraint the rules to the current postgresql service.
|
||||||
|
## rules:
|
||||||
|
## - alert: HugeReplicationLag
|
||||||
|
## expr: pg_replication_lag{service="{{ template "postgresql.fullname" . }}-metrics"} / 3600 > 1
|
||||||
|
## for: 1m
|
||||||
|
## labels:
|
||||||
|
## severity: critical
|
||||||
|
## annotations:
|
||||||
|
## description: replication for {{ template "postgresql.fullname" . }} PostgreSQL is lagging by {{ "{{ $value }}" }} hour(s).
|
||||||
|
## summary: PostgreSQL replication is lagging by {{ "{{ $value }}" }} hour(s).
|
||||||
|
##
|
||||||
|
rules: []
|
||||||
|
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/postgres-exporter
|
||||||
|
tag: 0.8.0-debian-10-r242
|
||||||
|
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
|
||||||
|
## Define additional custom metrics
|
||||||
|
## ref: https://github.com/wrouesnel/postgres_exporter#adding-new-metrics-via-a-config-file
|
||||||
|
# customMetrics:
|
||||||
|
# pg_database:
|
||||||
|
# query: "SELECT d.datname AS name, CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') THEN pg_catalog.pg_database_size(d.datname) ELSE 0 END AS size_bytes FROM pg_catalog.pg_database d where datname not in ('template0', 'template1', 'postgres')"
|
||||||
|
# metrics:
|
||||||
|
# - name:
|
||||||
|
# usage: "LABEL"
|
||||||
|
# description: "Name of the database"
|
||||||
|
# - size_bytes:
|
||||||
|
# usage: "GAUGE"
|
||||||
|
# description: "Size of the database in bytes"
|
||||||
|
#
|
||||||
|
## An array to add extra env vars to configure postgres-exporter
|
||||||
|
## see: https://github.com/wrouesnel/postgres_exporter#environment-variables
|
||||||
|
## For example:
|
||||||
|
# extraEnvVars:
|
||||||
|
# - name: PG_EXPORTER_DISABLE_DEFAULT_METRICS
|
||||||
|
# value: "true"
|
||||||
|
extraEnvVars: {}
|
||||||
|
|
||||||
|
## Pod Security Context
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||||
|
##
|
||||||
|
securityContext:
|
||||||
|
enabled: false
|
||||||
|
runAsUser: 1001
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||||
|
## Configure extra options for liveness and readiness probes
|
||||||
|
##
|
||||||
|
livenessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
|
||||||
|
readinessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
|
||||||
|
## Array with extra yaml to deploy with the chart. Evaluated as a template
|
||||||
|
##
|
||||||
|
extraDeploy: []
|
||||||
21
scripts/helm/helm/databases/charts/redis/.helmignore
Normal file
21
scripts/helm/helm/databases/charts/redis/.helmignore
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# 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
|
||||||
6
scripts/helm/helm/databases/charts/redis/Chart.lock
Normal file
6
scripts/helm/helm/databases/charts/redis/Chart.lock
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
repository: https://charts.bitnami.com/bitnami
|
||||||
|
version: 1.4.2
|
||||||
|
digest: sha256:4e3ec38e0e27e9fc1defb2a13f67a0aa12374bf0b15f06a6c13b1b46df6bffeb
|
||||||
|
generated: "2021-04-05T11:40:59.141264592Z"
|
||||||
29
scripts/helm/helm/databases/charts/redis/Chart.yaml
Normal file
29
scripts/helm/helm/databases/charts/redis/Chart.yaml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
annotations:
|
||||||
|
category: Database
|
||||||
|
apiVersion: v2
|
||||||
|
appVersion: 6.0.12
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
repository: https://charts.bitnami.com/bitnami
|
||||||
|
tags:
|
||||||
|
- bitnami-common
|
||||||
|
version: 1.x.x
|
||||||
|
description: Open source, advanced key-value store. It is often referred to as a data
|
||||||
|
structure server since keys can contain strings, hashes, lists, sets and sorted
|
||||||
|
sets.
|
||||||
|
home: https://github.com/bitnami/charts/tree/master/bitnami/redis
|
||||||
|
icon: https://bitnami.com/assets/stacks/redis/img/redis-stack-220x234.png
|
||||||
|
keywords:
|
||||||
|
- redis
|
||||||
|
- keyvalue
|
||||||
|
- database
|
||||||
|
maintainers:
|
||||||
|
- email: containers@bitnami.com
|
||||||
|
name: Bitnami
|
||||||
|
- email: cedric@desaintmartin.fr
|
||||||
|
name: desaintmartin
|
||||||
|
name: redis
|
||||||
|
sources:
|
||||||
|
- https://github.com/bitnami/bitnami-docker-redis
|
||||||
|
- http://redis.io/
|
||||||
|
version: 12.10.1
|
||||||
738
scripts/helm/helm/databases/charts/redis/README.md
Normal file
738
scripts/helm/helm/databases/charts/redis/README.md
Normal file
|
|
@ -0,0 +1,738 @@
|
||||||
|
# Redis<sup>TM</sup> Chart packaged by Bitnami
|
||||||
|
|
||||||
|
[Redis<sup>TM</sup>](http://redis.io/) is an advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.
|
||||||
|
|
||||||
|
Disclaimer: REDIS® is a registered trademark of Redis Labs Ltd.Any rights therein are reserved to Redis Labs Ltd. Any use by Bitnami is for referential purposes only and does not indicate any sponsorship, endorsement, or affiliation between Redis Labs Ltd.
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||||
|
$ helm install my-release bitnami/redis
|
||||||
|
```
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This chart bootstraps a [Redis<sup>TM</sup>](https://github.com/bitnami/bitnami-docker-redis) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||||
|
|
||||||
|
Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the [BKPR](https://kubeprod.io/).
|
||||||
|
|
||||||
|
### Choose between Redis<sup>TM</sup> Helm Chart and Redis<sup>TM</sup> Cluster Helm Chart
|
||||||
|
|
||||||
|
You can choose any of the two Redis<sup>TM</sup> Helm charts for deploying a Redis<sup>TM</sup> cluster.
|
||||||
|
While [Redis<sup>TM</sup> Helm Chart](https://github.com/bitnami/charts/tree/master/bitnami/redis) will deploy a master-slave cluster using Redis<sup>TM</sup> Sentinel, the [Redis<sup>TM</sup> Cluster Helm Chart](https://github.com/bitnami/charts/tree/master/bitnami/redis-cluster) will deploy a Redis<sup>TM</sup> Cluster topology with sharding.
|
||||||
|
The main features of each chart are the following:
|
||||||
|
|
||||||
|
| Redis<sup>TM</sup> | Redis<sup>TM</sup> Cluster |
|
||||||
|
|--------------------------------------------------------|------------------------------------------------------------------------|
|
||||||
|
| Supports multiple databases | Supports only one database. Better if you have a big dataset |
|
||||||
|
| Single write point (single master) | Multiple write points (multiple masters) |
|
||||||
|
|  |  |
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Kubernetes 1.12+
|
||||||
|
- Helm 3.1.0
|
||||||
|
- PV provisioner support in the underlying infrastructure
|
||||||
|
|
||||||
|
## Installing the Chart
|
||||||
|
|
||||||
|
To install the chart with the release name `my-release`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm install my-release bitnami/redis
|
||||||
|
```
|
||||||
|
|
||||||
|
The command deploys Redis<sup>TM</sup> on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
|
||||||
|
|
||||||
|
> **Tip**: List all releases using `helm list`
|
||||||
|
|
||||||
|
## Uninstalling the Chart
|
||||||
|
|
||||||
|
To uninstall/delete the `my-release` deployment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm delete my-release
|
||||||
|
```
|
||||||
|
|
||||||
|
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
The following table lists the configurable parameters of the Redis<sup>TM</sup> chart and their default values.
|
||||||
|
|
||||||
|
| Parameter | Description | Default |
|
||||||
|
|:------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------|
|
||||||
|
| `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.redis.password` | Redis<sup>TM</sup> password (overrides `password`) | `nil` |
|
||||||
|
| `image.registry` | Redis<sup>TM</sup> Image registry | `docker.io` |
|
||||||
|
| `image.repository` | Redis<sup>TM</sup> Image name | `bitnami/redis` |
|
||||||
|
| `image.tag` | Redis<sup>TM</sup> Image tag | `{TAG_NAME}` |
|
||||||
|
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
||||||
|
| `image.pullSecrets` | Specify docker-registry secret names as an array | `nil` |
|
||||||
|
| `nameOverride` | String to partially override redis.fullname template with a string (will prepend the release name) | `nil` |
|
||||||
|
| `fullnameOverride` | String to fully override redis.fullname template with a string | `nil` |
|
||||||
|
| `cluster.enabled` | Use master-slave topology | `true` |
|
||||||
|
| `cluster.slaveCount` | Number of slaves | `2` |
|
||||||
|
| `existingSecret` | Name of existing secret object (for password authentication) | `nil` |
|
||||||
|
| `existingSecretPasswordKey` | Name of key containing password to be retrieved from the existing secret | `nil` |
|
||||||
|
| `usePassword` | Use password | `true` |
|
||||||
|
| `usePasswordFile` | Mount passwords as files instead of environment variables | `false` |
|
||||||
|
| `password` | Redis<sup>TM</sup> password (ignored if existingSecret set) | Randomly generated |
|
||||||
|
| `configmap` | Additional common Redis<sup>TM</sup> node configuration (this value is evaluated as a template) | See values.yaml |
|
||||||
|
| `clusterDomain` | Kubernetes DNS Domain name to use | `cluster.local` |
|
||||||
|
| `extraVolumes` | Array of extra volumes to be added to master & slave nodes (evaluated as a template) | `[]` |
|
||||||
|
| `extraVolumeMounts` | Array of extra volume mounts to be added to master & slave nodes (evaluated as a template) | `[]` |
|
||||||
|
| `networkPolicy.enabled` | Enable NetworkPolicy | `false` |
|
||||||
|
| `networkPolicy.allowExternal` | Don't require client label for connections | `true` |
|
||||||
|
| `networkPolicy.ingressNSMatchLabels` | Allow connections from other namespaces | `{}` |
|
||||||
|
| `networkPolicy.ingressNSPodMatchLabels` | For other namespaces match by pod labels and namespace labels | `{}` |
|
||||||
|
| `securityContext.*` | Other pod security context to be included as-is in the pod spec | `{}` |
|
||||||
|
| `securityContext.enabled` | Enable security context (both redis master and slave pods) | `true` |
|
||||||
|
| `securityContext.fsGroup` | Group ID for the container (both redis master and slave pods) | `1001` |
|
||||||
|
| `containerSecurityContext.*` | Other container security context to be included as-is in the container spec | `{}` |
|
||||||
|
| `containerSecurityContext.enabled` | Enable security context (both redis master and slave containers) | `true` |
|
||||||
|
| `containerSecurityContext.runAsUser` | User ID for the container (both redis master and slave containers) | `1001` |
|
||||||
|
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `false` |
|
||||||
|
| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the fullname template |
|
||||||
|
| `serviceAccount.annotations` | Specifies annotations to add to ServiceAccount. | `nil` |
|
||||||
|
| `rbac.create` | Specifies whether RBAC resources should be created | `false` |
|
||||||
|
| `rbac.role.rules` | Rules to create | `[]` |
|
||||||
|
| `metrics.enabled` | Start a side-car prometheus exporter | `false` |
|
||||||
|
| `metrics.image.registry` | Redis<sup>TM</sup> exporter image registry | `docker.io` |
|
||||||
|
| `metrics.image.repository` | Redis<sup>TM</sup> exporter image name | `bitnami/redis-exporter` |
|
||||||
|
| `metrics.image.tag` | Redis<sup>TM</sup> exporter image tag | `{TAG_NAME}` |
|
||||||
|
| `metrics.image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
||||||
|
| `metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `nil` |
|
||||||
|
| `metrics.extraArgs` | Extra arguments for the binary; possible values [here](https://github.com/oliver006/redis_exporter#flags) | {} |
|
||||||
|
| `metrics.podLabels` | Additional labels for Metrics exporter pod | {} |
|
||||||
|
| `metrics.podAnnotations` | Additional annotations for Metrics exporter pod | {} |
|
||||||
|
| `metrics.resources` | Exporter resource requests/limit | Memory: `256Mi`, CPU: `100m` |
|
||||||
|
| `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 }` |
|
||||||
|
| `metrics.serviceMonitor.relabelings` | ServiceMonitor relabelings. Value is evaluated as a template | `[]` |
|
||||||
|
| `metrics.serviceMonitor.metricRelabelings` | ServiceMonitor metricRelabelings. Value is evaluated as a template | `[]` |
|
||||||
|
| `metrics.service.type` | Kubernetes Service type (redis metrics) | `ClusterIP` |
|
||||||
|
| `metrics.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
|
||||||
|
| `metrics.service.annotations` | Annotations for the services to monitor (redis master and redis slave service) | {} |
|
||||||
|
| `metrics.service.labels` | Additional labels for the metrics service | {} |
|
||||||
|
| `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` |
|
||||||
|
| `metrics.priorityClassName` | Metrics exporter pod priorityClassName | `nil` |
|
||||||
|
| `metrics.prometheusRule.enabled` | Set this to true to create prometheusRules for Prometheus operator | `false` |
|
||||||
|
| `metrics.prometheusRule.additionalLabels` | Additional labels that can be used so prometheusRules will be discovered by Prometheus | `{}` |
|
||||||
|
| `metrics.prometheusRule.namespace` | namespace where prometheusRules resource should be created | Same namespace as redis |
|
||||||
|
| `metrics.prometheusRule.rules` | [rules](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) to be created, check values for an example. | `[]` |
|
||||||
|
| `metrics.redisTargetHost` | way to specify an alternative redis hostname, if you set a local endpoint in hostAliases to match specific redis server certificate CN/SAN for example.
|
||||||
|
| `localhost` |
|
||||||
|
| `persistence.existingClaim` | Provide an existing PersistentVolumeClaim | `nil` |
|
||||||
|
| `master.persistence.enabled` | Use a PVC to persist data (master node) | `true` |
|
||||||
|
| `master.hostAliases` | Add deployment host aliases | `[]` |
|
||||||
|
| `master.persistence.path` | Path to mount the volume at, to use other images | `/data` |
|
||||||
|
| `master.persistence.subPath` | Subdirectory of the volume to mount at | `""` |
|
||||||
|
| `master.persistence.storageClass` | Storage class of backing PVC | `generic` |
|
||||||
|
| `master.persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` |
|
||||||
|
| `master.persistence.size` | Size of data volume | `8Gi` |
|
||||||
|
| `master.persistence.matchLabels` | matchLabels persistent volume selector | `{}` |
|
||||||
|
| `master.persistence.matchExpressions` | matchExpressions persistent volume selector | `{}` |
|
||||||
|
| `master.persistence.volumes` | Additional volumes without creating PVC | `{}` |
|
||||||
|
| `master.statefulset.labels` | Additional labels for redis master StatefulSet | `{}` |
|
||||||
|
| `master.statefulset.annotations` | Additional annotations for redis master StatefulSet | `{}` |
|
||||||
|
| `master.statefulset.updateStrategy` | Update strategy for StatefulSet | onDelete |
|
||||||
|
| `master.statefulset.rollingUpdatePartition` | Partition update strategy | `nil` |
|
||||||
|
| `master.statefulset.volumeClaimTemplates.labels` | Additional labels for redis master StatefulSet volumeClaimTemplates | `{}` |
|
||||||
|
| `master.statefulset.volumeClaimTemplates.annotations` | Additional annotations for redis master StatefulSet volumeClaimTemplates | `{}` |
|
||||||
|
| `master.podLabels` | Additional labels for Redis<sup>TM</sup> master pod | {} |
|
||||||
|
| `master.podAnnotations` | Additional annotations for Redis<sup>TM</sup> master pod | {} |
|
||||||
|
| `master.extraEnvVars` | Additional Environment Variables passed to the pod of the master's stateful set set | `[]` |
|
||||||
|
| `master.extraEnvVarCMs` | Additional Environment Variables ConfigMappassed to the pod of the master's stateful set set | `[]` |
|
||||||
|
| `master.extraEnvVarsSecret` | Additional Environment Variables Secret passed to the master's stateful set | `[]` |
|
||||||
|
| `master.extraVolumes` | Array of extra volumes to be added to master pod (evaluated as a template) | `[]` |
|
||||||
|
| `master.extraVolumeMounts` | Array of extra volume mounts to be added to master pod (evaluated as a template) | `[]` |
|
||||||
|
| `podDisruptionBudget.enabled` | Pod Disruption Budget toggle | `false` |
|
||||||
|
| `podDisruptionBudget.minAvailable` | Minimum available pods | `1` |
|
||||||
|
| `podDisruptionBudget.maxUnavailable` | Maximum unavailable | `nil` |
|
||||||
|
| `redisPort` | Redis<sup>TM</sup> port (in both master and slaves) | `6379` |
|
||||||
|
| `tls.enabled` | Enable TLS support for replication traffic | `false` |
|
||||||
|
| `tls.authClients` | Require clients to authenticate or not | `true` |
|
||||||
|
| `tls.certificatesSecret` | Name of the secret that contains the certificates | `nil` |
|
||||||
|
| `tls.certFilename` | Certificate filename | `nil` |
|
||||||
|
| `tls.certKeyFilename` | Certificate key filename | `nil` |
|
||||||
|
| `tls.certCAFilename` | CA Certificate filename | `nil` |
|
||||||
|
| `tls.dhParamsFilename` | DH params (in order to support DH based ciphers) | `nil` |
|
||||||
|
| `master.command` | Redis<sup>TM</sup> master entrypoint string. The command `redis-server` is executed if this is not provided. Note this is prepended with `exec` | `/run.sh` |
|
||||||
|
| `master.preExecCmds` | Text to inset into the startup script immediately prior to `master.command`. Use this if you need to run other ad-hoc commands as part of startup | `nil` |
|
||||||
|
| `master.configmap` | Additional Redis<sup>TM</sup> configuration for the master nodes (this value is evaluated as a template) | `nil` |
|
||||||
|
| `master.disableCommands` | Array of Redis<sup>TM</sup> commands to disable (master) | `["FLUSHDB", "FLUSHALL"]` |
|
||||||
|
| `master.extraFlags` | Redis<sup>TM</sup> master additional command line flags | [] |
|
||||||
|
| `master.nodeSelector` | Redis<sup>TM</sup> master Node labels for pod assignment | {"beta.kubernetes.io/arch": "amd64"} |
|
||||||
|
| `master.tolerations` | Toleration labels for Redis<sup>TM</sup> master pod assignment | [] |
|
||||||
|
| `master.affinity` | Affinity settings for Redis<sup>TM</sup> master pod assignment | {} |
|
||||||
|
| `master.schedulerName` | Name of an alternate scheduler | `nil` |
|
||||||
|
| `master.service.type` | Kubernetes Service type (redis master) | `ClusterIP` |
|
||||||
|
| `master.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
|
||||||
|
| `master.service.port` | Kubernetes Service port (redis master) | `6379` |
|
||||||
|
| `master.service.nodePort` | Kubernetes Service nodePort (redis master) | `nil` |
|
||||||
|
| `master.service.annotations` | annotations for redis master service | {} |
|
||||||
|
| `master.service.labels` | Additional labels for redis master service | {} |
|
||||||
|
| `master.service.loadBalancerIP` | loadBalancerIP if redis master service type is `LoadBalancer` | `nil` |
|
||||||
|
| `master.service.loadBalancerSourceRanges` | loadBalancerSourceRanges if redis master service type is `LoadBalancer` | `nil` |
|
||||||
|
| `master.resources` | Redis<sup>TM</sup> master CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m` |
|
||||||
|
| `master.livenessProbe.enabled` | Turn on and off liveness probe (redis master pod) | `true` |
|
||||||
|
| `master.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated (redis master pod) | `5` |
|
||||||
|
| `master.livenessProbe.periodSeconds` | How often to perform the probe (redis master pod) | `5` |
|
||||||
|
| `master.livenessProbe.timeoutSeconds` | When the probe times out (redis master pod) | `5` |
|
||||||
|
| `master.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed (redis master pod) | `1` |
|
||||||
|
| `master.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `5` |
|
||||||
|
| `master.readinessProbe.enabled` | Turn on and off readiness probe (redis master pod) | `true` |
|
||||||
|
| `master.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated (redis master pod) | `5` |
|
||||||
|
| `master.readinessProbe.periodSeconds` | How often to perform the probe (redis master pod) | `5` |
|
||||||
|
| `master.readinessProbe.timeoutSeconds` | When the probe times out (redis master pod) | `1` |
|
||||||
|
| `master.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed (redis master pod) | `1` |
|
||||||
|
| `master.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `5` |
|
||||||
|
| `master.shareProcessNamespace` | Redis<sup>TM</sup> Master pod `shareProcessNamespace` option. Enables /pause reap zombie PIDs. | `false` |
|
||||||
|
| `master.priorityClassName` | Redis<sup>TM</sup> Master pod priorityClassName | `nil` |
|
||||||
|
| `volumePermissions.enabled` | Enable init container that changes volume permissions in the registry (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` |
|
||||||
|
| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` |
|
||||||
|
| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/bitnami-shell` |
|
||||||
|
| `volumePermissions.image.tag` | Init container volume-permissions image tag | `"10"` |
|
||||||
|
| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` |
|
||||||
|
| `volumePermissions.resources ` | Init container volume-permissions CPU/Memory resource requests/limits | {} |
|
||||||
|
| `volumePermissions.securityContext.*` | Security context of the init container | `{}` |
|
||||||
|
| `volumePermissions.securityContext.runAsUser` | UserID for the init container (when facing issues in OpenShift or uid unknown, try value "auto") | 0 |
|
||||||
|
| `slave.hostAliases` | Add deployment host aliases | `[]` |
|
||||||
|
| `slave.service.type` | Kubernetes Service type (redis slave) | `ClusterIP` |
|
||||||
|
| `slave.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
|
||||||
|
| `slave.service.nodePort` | Kubernetes Service nodePort (redis slave) | `nil` |
|
||||||
|
| `slave.service.annotations` | annotations for redis slave service | {} |
|
||||||
|
| `slave.service.labels` | Additional labels for redis slave service | {} |
|
||||||
|
| `slave.service.port` | Kubernetes Service port (redis slave) | `6379` |
|
||||||
|
| `slave.service.loadBalancerIP` | LoadBalancerIP if Redis<sup>TM</sup> slave service type is `LoadBalancer` | `nil` |
|
||||||
|
| `slave.service.loadBalancerSourceRanges` | loadBalancerSourceRanges if Redis<sup>TM</sup> slave service type is `LoadBalancer` | `nil` |
|
||||||
|
| `slave.command` | Redis<sup>TM</sup> slave entrypoint string. The command `redis-server` is executed if this is not provided. Note this is prepended with `exec` | `/run.sh` |
|
||||||
|
| `slave.preExecCmds` | Text to inset into the startup script immediately prior to `slave.command`. Use this if you need to run other ad-hoc commands as part of startup | `nil` |
|
||||||
|
| `slave.configmap` | Additional Redis<sup>TM</sup> configuration for the slave nodes (this value is evaluated as a template) | `nil` |
|
||||||
|
| `slave.disableCommands` | Array of Redis<sup>TM</sup> commands to disable (slave) | `[FLUSHDB, FLUSHALL]` |
|
||||||
|
| `slave.extraFlags` | Redis<sup>TM</sup> slave additional command line flags | `[]` |
|
||||||
|
| `slave.livenessProbe.enabled` | Turn on and off liveness probe (redis slave pod) | `true` |
|
||||||
|
| `slave.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated (redis slave pod) | `5` |
|
||||||
|
| `slave.livenessProbe.periodSeconds` | How often to perform the probe (redis slave pod) | `5` |
|
||||||
|
| `slave.livenessProbe.timeoutSeconds` | When the probe times out (redis slave pod) | `5` |
|
||||||
|
| `slave.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed (redis slave pod) | `1` |
|
||||||
|
| `slave.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `5` |
|
||||||
|
| `slave.readinessProbe.enabled` | Turn on and off slave.readiness probe (redis slave pod) | `true` |
|
||||||
|
| `slave.readinessProbe.initialDelaySeconds` | Delay before slave.readiness probe is initiated (redis slave pod) | `5` |
|
||||||
|
| `slave.readinessProbe.periodSeconds` | How often to perform the probe (redis slave pod) | `5` |
|
||||||
|
| `slave.readinessProbe.timeoutSeconds` | When the probe times out (redis slave pod) | `1` |
|
||||||
|
| `slave.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed (redis slave pod) | `1` |
|
||||||
|
| `slave.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. (redis slave pod) | `5` |
|
||||||
|
| `slave.shareProcessNamespace` | Redis<sup>TM</sup> slave pod `shareProcessNamespace` option. Enables /pause reap zombie PIDs. | `false` |
|
||||||
|
| `slave.persistence.enabled` | Use a PVC to persist data (slave node) | `true` |
|
||||||
|
| `slave.persistence.path` | Path to mount the volume at, to use other images | `/data` |
|
||||||
|
| `slave.persistence.subPath` | Subdirectory of the volume to mount at | `""` |
|
||||||
|
| `slave.persistence.storageClass` | Storage class of backing PVC | `generic` |
|
||||||
|
| `slave.persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` |
|
||||||
|
| `slave.persistence.size` | Size of data volume | `8Gi` |
|
||||||
|
| `slave.persistence.matchLabels` | matchLabels persistent volume selector | `{}` |
|
||||||
|
| `slave.persistence.matchExpressions` | matchExpressions persistent volume selector | `{}` |
|
||||||
|
| `slave.statefulset.labels` | Additional labels for redis slave StatefulSet | `{}` |
|
||||||
|
| `slave.statefulset.annotations` | Additional annotations for redis slave StatefulSet | `{}` |
|
||||||
|
| `slave.statefulset.updateStrategy` | Update strategy for StatefulSet | onDelete |
|
||||||
|
| `slave.statefulset.rollingUpdatePartition` | Partition update strategy | `nil` |
|
||||||
|
| `slave.statefulset.volumeClaimTemplates.labels` | Additional labels for redis slave StatefulSet volumeClaimTemplates | `{}` |
|
||||||
|
| `slave.statefulset.volumeClaimTemplates.annotations` | Additional annotations for redis slave StatefulSet volumeClaimTemplates | `{}` |
|
||||||
|
| `slave.extraEnvVars` | Additional Environment Variables passed to the pod of the slave's stateful set set | `[]` |
|
||||||
|
| `slave.extraEnvVarCMs` | Additional Environment Variables ConfigMappassed to the pod of the slave's stateful set set | `[]` |
|
||||||
|
| `masslaveter.extraEnvVarsSecret` | Additional Environment Variables Secret passed to the slave's stateful set | `[]` |
|
||||||
|
| `slave.extraVolumes` | Array of extra volumes to be added to slave pod (evaluated as a template) | `[]` |
|
||||||
|
| `slave.extraVolumeMounts` | Array of extra volume mounts to be added to slave pod (evaluated as a template) | `[]` |
|
||||||
|
| `slave.podLabels` | Additional labels for Redis<sup>TM</sup> slave pod | `master.podLabels` |
|
||||||
|
| `slave.podAnnotations` | Additional annotations for Redis<sup>TM</sup> slave pod | `master.podAnnotations` |
|
||||||
|
| `slave.schedulerName` | Name of an alternate scheduler | `nil` |
|
||||||
|
| `slave.resources` | Redis<sup>TM</sup> slave CPU/Memory resource requests/limits | `{}` |
|
||||||
|
| `slave.affinity` | Enable node/pod affinity for slaves | {} |
|
||||||
|
| `slave.tolerations` | Toleration labels for Redis<sup>TM</sup> slave pod assignment | [] |
|
||||||
|
| `slave.spreadConstraints` | [Topology Spread Constraints](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) for Redis<sup>TM</sup> slave pod | {} |
|
||||||
|
| `slave.priorityClassName` | Redis<sup>TM</sup> Slave pod priorityClassName | `nil` |
|
||||||
|
| `sentinel.enabled` | Enable sentinel containers | `false` |
|
||||||
|
| `sentinel.usePassword` | Use password for sentinel containers | `true` |
|
||||||
|
| `sentinel.masterSet` | Name of the sentinel master set | `mymaster` |
|
||||||
|
| `sentinel.initialCheckTimeout` | Timeout for querying the redis sentinel service for the active sentinel list | `5` |
|
||||||
|
| `sentinel.quorum` | Quorum for electing a new master | `2` |
|
||||||
|
| `sentinel.downAfterMilliseconds` | Timeout for detecting a Redis<sup>TM</sup> node is down | `60000` |
|
||||||
|
| `sentinel.failoverTimeout` | Timeout for performing a election failover | `18000` |
|
||||||
|
| `sentinel.parallelSyncs` | Number of parallel syncs in the cluster | `1` |
|
||||||
|
| `sentinel.port` | Redis<sup>TM</sup> Sentinel port | `26379` |
|
||||||
|
| `sentinel.cleanDelaySeconds` | Delay seconds before issuing the the cleaning in the next node | `5` |
|
||||||
|
| `sentinel.configmap` | Additional Redis<sup>TM</sup> configuration for the sentinel nodes (this value is evaluated as a template) | `nil` |
|
||||||
|
| `sentinel.staticID` | Enable static IDs for sentinel replicas (If disabled IDs will be randomly generated on startup) | `false` |
|
||||||
|
| `sentinel.service.type` | Kubernetes Service type (redis sentinel) | `ClusterIP` |
|
||||||
|
| `sentinel.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
|
||||||
|
| `sentinel.service.nodePort` | Kubernetes Service nodePort (redis sentinel) | `nil` |
|
||||||
|
| `sentinel.service.annotations` | annotations for redis sentinel service | {} |
|
||||||
|
| `sentinel.service.labels` | Additional labels for redis sentinel service | {} |
|
||||||
|
| `sentinel.service.redisPort` | Kubernetes Service port for Redis<sup>TM</sup> read only operations | `6379` |
|
||||||
|
| `sentinel.service.sentinelPort` | Kubernetes Service port for Redis<sup>TM</sup> sentinel | `26379` |
|
||||||
|
| `sentinel.service.redisNodePort` | Kubernetes Service node port for Redis<sup>TM</sup> read only operations | `` |
|
||||||
|
| `sentinel.service.sentinelNodePort` | Kubernetes Service node port for Redis<sup>TM</sup> sentinel | `` |
|
||||||
|
| `sentinel.service.loadBalancerIP` | LoadBalancerIP if Redis<sup>TM</sup> sentinel service type is `LoadBalancer` | `nil` |
|
||||||
|
| `sentinel.livenessProbe.enabled` | Turn on and off liveness probe (redis sentinel pod) | `true` |
|
||||||
|
| `sentinel.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated (redis sentinel pod) | `5` |
|
||||||
|
| `sentinel.livenessProbe.periodSeconds` | How often to perform the probe (redis sentinel container) | `5` |
|
||||||
|
| `sentinel.livenessProbe.timeoutSeconds` | When the probe times out (redis sentinel container) | `5` |
|
||||||
|
| `sentinel.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed (redis sentinel container) | `1` |
|
||||||
|
| `sentinel.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `5` |
|
||||||
|
| `sentinel.readinessProbe.enabled` | Turn on and off sentinel.readiness probe (redis sentinel pod) | `true` |
|
||||||
|
| `sentinel.readinessProbe.initialDelaySeconds` | Delay before sentinel.readiness probe is initiated (redis sentinel pod) | `5` |
|
||||||
|
| `sentinel.readinessProbe.periodSeconds` | How often to perform the probe (redis sentinel pod) | `5` |
|
||||||
|
| `sentinel.readinessProbe.timeoutSeconds` | When the probe times out (redis sentinel container) | `1` |
|
||||||
|
| `sentinel.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed (redis sentinel container) | `1` |
|
||||||
|
| `sentinel.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. (redis sentinel container) | `5` |
|
||||||
|
| `sentinel.resources` | Redis<sup>TM</sup> sentinel CPU/Memory resource requests/limits | `{}` |
|
||||||
|
| `sentinel.image.registry` | Redis<sup>TM</sup> Sentinel Image registry | `docker.io` |
|
||||||
|
| `sentinel.image.repository` | Redis<sup>TM</sup> Sentinel Image name | `bitnami/redis-sentinel` |
|
||||||
|
| `sentinel.image.tag` | Redis<sup>TM</sup> Sentinel Image tag | `{TAG_NAME}` |
|
||||||
|
| `sentinel.image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
||||||
|
| `sentinel.image.pullSecrets` | Specify docker-registry secret names as an array | `nil` |
|
||||||
|
| `sentinel.extraEnvVars` | Additional Environment Variables passed to the pod of the sentinel node stateful set set | `[]` |
|
||||||
|
| `sentinel.extraEnvVarCMs` | Additional Environment Variables ConfigMappassed to the pod of the sentinel node stateful set set | `[]` |
|
||||||
|
| `sentinel.extraEnvVarsSecret` | Additional Environment Variables Secret passed to the sentinel node statefulset | `[]` |
|
||||||
|
| `sentinel.extraVolumes` | Array of extra volumes to be added to sentinel node (evaluated as a template) | `[]` |
|
||||||
|
| `sentinel.extraVolumeMounts` | Array of extra volume mounts to be added to sentinel node (evaluated as a template) | `[]` |
|
||||||
|
| `sentinel.preExecCmds` | Text to inset into the startup script immediately prior to `sentinel.command`. Use this if you need to run other ad-hoc commands as part of startup | `nil` |
|
||||||
|
| `sentinel.metrics.enabled` | Start a side-car prometheus sentinel exporter | `false` |
|
||||||
|
| `sentinel.metrics.image.registry` | Redis Sentinel exporter image registry | `docker.io` |
|
||||||
|
| `sentinel.metrics.image.repository` | Redis Sentinel exporter image name | `bitnami/redis-sentinel-exporter` |
|
||||||
|
| `sentinel.metrics.image.tag` | Redis Sentinel exporter image tag | `{TAG_NAME}` |
|
||||||
|
| `sentinel.metrics.image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
||||||
|
| `sentinel.metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `[]` |
|
||||||
|
| `sentinel.metrics.extraArgs` | Extra arguments for the binary; possible values [here](https://github.com/leominov/redis_sentinel_exporter#configuration) | `{}` |
|
||||||
|
| `sentinel.metrics.resources` | Exporter resource requests/limit | `{}` |
|
||||||
|
| `sentinel.metrics.serviceMonitor.enabled` | if `true`, creates a Prometheus Operator ServiceMonitor (also requires `sentinel.metrics.enabled` to be `true`) | `false` |
|
||||||
|
| `sentinel.metrics.serviceMonitor.namespace` | Optional namespace which Prometheus is running in | `nil` |
|
||||||
|
| `sentinel.metrics.serviceMonitor.interval` | How frequently to scrape metrics (use by default, falling back to Prometheus' default) | `nil` |
|
||||||
|
| `sentinel.metrics.serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{ prometheus: kube-prometheus }` |
|
||||||
|
| `sentinel.metrics.service.type` | Kubernetes Service type (redis sentinel metrics) | `ClusterIP` |
|
||||||
|
| `sentinel.metrics.service.port` | Kubernetes service port (redis sentinel metrics) | `9355` |
|
||||||
|
| `sentinel.metrics.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
|
||||||
|
| `sentinel.metrics.service.annotations` | Annotations for the services to monitor (redis sentinel metrics service) | {} |
|
||||||
|
| `sentinel.metrics.service.labels` | Additional labels for the Sentinel metrics service | {} |
|
||||||
|
| `sentinel.metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` |
|
||||||
|
| `sentinel.metrics.priorityClassName` | Sentinel metrics exporter pod priorityClassName | `nil` |
|
||||||
|
| `sysctlImage.enabled` | Enable an init container to modify Kernel settings | `false` |
|
||||||
|
| `sysctlImage.command` | sysctlImage command to execute | [] |
|
||||||
|
| `sysctlImage.registry` | sysctlImage Init container registry | `docker.io` |
|
||||||
|
| `sysctlImage.repository` | sysctlImage Init container name | `bitnami/bitnami-shell` |
|
||||||
|
| `sysctlImage.tag` | sysctlImage Init container tag | `"10"` |
|
||||||
|
| `sysctlImage.pullPolicy` | sysctlImage Init container pull policy | `Always` |
|
||||||
|
| `sysctlImage.mountHostSys` | Mount the host `/sys` folder to `/host-sys` | `false` |
|
||||||
|
| `sysctlImage.resources` | sysctlImage Init container CPU/Memory resource requests/limits | {} |
|
||||||
|
| `podSecurityPolicy.create` | Specifies whether a PodSecurityPolicy should be created | `false` |
|
||||||
|
|
||||||
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm install my-release \
|
||||||
|
--set password=secretpassword \
|
||||||
|
bitnami/redis
|
||||||
|
```
|
||||||
|
|
||||||
|
The above command sets the Redis<sup>TM</sup> server password to `secretpassword`.
|
||||||
|
|
||||||
|
> NOTE: Once this chart is deployed, it is not possible to change the application's access credentials, such as usernames or passwords, using Helm. To change these application credentials after deployment, delete any persistent volumes (PVs) used by the chart and re-deploy it, or use the application's built-in administrative tools if available.
|
||||||
|
|
||||||
|
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm install my-release -f values.yaml bitnami/redis
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||||
|
|
||||||
|
> **Note for minikube users**: Current versions of minikube (v0.24.1 at the time of writing) provision `hostPath` persistent volumes that are only writable by root. Using chart defaults cause pod failure for the Redis<sup>TM</sup> pod as it attempts to write to the `/bitnami` directory. Consider installing Redis<sup>TM</sup> with `--set persistence.enabled=false`. See minikube issue [1990](https://github.com/kubernetes/minikube/issues/1990) for more information.
|
||||||
|
|
||||||
|
## Configuration and installation details
|
||||||
|
|
||||||
|
### [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.
|
||||||
|
|
||||||
|
### Change Redis<sup>TM</sup> version
|
||||||
|
|
||||||
|
To modify the Redis<sup>TM</sup> version used in this chart you can specify a [valid image tag](https://hub.docker.com/r/bitnami/redis/tags/) using the `image.tag` parameter. For example, `image.tag=X.Y.Z`. This approach is also applicable to other images like exporters.
|
||||||
|
|
||||||
|
### Cluster topologies
|
||||||
|
|
||||||
|
#### Default: Master-Slave
|
||||||
|
|
||||||
|
When installing the chart with `cluster.enabled=true`, it will deploy a Redis<sup>TM</sup> master StatefulSet (only one master node allowed) and a Redis<sup>TM</sup> slave StatefulSet. The slaves will be read-replicas of the master. Two services will be exposed:
|
||||||
|
|
||||||
|
- Redis<sup>TM</sup> Master service: Points to the master, where read-write operations can be performed
|
||||||
|
- Redis<sup>TM</sup> Slave service: Points to the slaves, where only read operations are allowed.
|
||||||
|
|
||||||
|
In case the master crashes, the slaves will wait until the master node is respawned again by the Kubernetes Controller Manager.
|
||||||
|
|
||||||
|
#### Master-Slave with Sentinel
|
||||||
|
|
||||||
|
When installing the chart with `cluster.enabled=true` and `sentinel.enabled=true`, it will deploy a Redis<sup>TM</sup> master StatefulSet (only one master allowed) and a Redis<sup>TM</sup> slave StatefulSet. In this case, the pods will contain an extra container with Redis<sup>TM</sup> Sentinel. This container will form a cluster of Redis<sup>TM</sup> Sentinel nodes, which will promote a new master in case the actual one fails. In addition to this, only one service is exposed:
|
||||||
|
|
||||||
|
- Redis<sup>TM</sup> service: Exposes port 6379 for Redis<sup>TM</sup> read-only operations and port 26379 for accessing Redis<sup>TM</sup> Sentinel.
|
||||||
|
|
||||||
|
For read-only operations, access the service using port 6379. For write operations, it's necessary to access the Redis<sup>TM</sup> Sentinel cluster and query the current master using the command below (using redis-cli or similar:
|
||||||
|
|
||||||
|
```
|
||||||
|
SENTINEL get-master-addr-by-name <name of your MasterSet. Example: mymaster>
|
||||||
|
```
|
||||||
|
This command will return the address of the current master, which can be accessed from inside the cluster.
|
||||||
|
|
||||||
|
In case the current master crashes, the Sentinel containers will elect a new master node.
|
||||||
|
|
||||||
|
### Using password file
|
||||||
|
To use a password file for Redis<sup>TM</sup> you need to create a secret containing the password.
|
||||||
|
|
||||||
|
> *NOTE*: It is important that the file with the password must be called `redis-password`
|
||||||
|
|
||||||
|
And then deploy the Helm Chart using the secret name as parameter:
|
||||||
|
|
||||||
|
```console
|
||||||
|
usePassword=true
|
||||||
|
usePasswordFile=true
|
||||||
|
existingSecret=redis-password-file
|
||||||
|
sentinels.enabled=true
|
||||||
|
metrics.enabled=true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Securing traffic using TLS
|
||||||
|
|
||||||
|
TLS support can be enabled in the chart by specifying the `tls.` parameters while creating a release. The following parameters should be configured to properly enable the TLS support in the chart:
|
||||||
|
|
||||||
|
- `tls.enabled`: Enable TLS support. Defaults to `false`
|
||||||
|
- `tls.certificatesSecret`: Name of the secret that contains the certificates. No defaults.
|
||||||
|
- `tls.certFilename`: Certificate filename. No defaults.
|
||||||
|
- `tls.certKeyFilename`: Certificate key filename. No defaults.
|
||||||
|
- `tls.certCAFilename`: CA Certificate filename. No defaults.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
First, create the secret with the certificates files:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl create secret generic certificates-tls-secret --from-file=./cert.pem --from-file=./cert.key --from-file=./ca.pem
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, use the following parameters:
|
||||||
|
|
||||||
|
```console
|
||||||
|
tls.enabled="true"
|
||||||
|
tls.certificatesSecret="certificates-tls-secret"
|
||||||
|
tls.certFilename="cert.pem"
|
||||||
|
tls.certKeyFilename="cert.key"
|
||||||
|
tls.certCAFilename="ca.pem"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Metrics
|
||||||
|
|
||||||
|
The chart optionally can start a metrics exporter for [prometheus](https://prometheus.io). The metrics endpoint (port 9121) is exposed in the service. Metrics can be scraped from within the cluster using something similar as the described in the [example Prometheus scrape configuration](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml). If metrics are to be scraped from outside the cluster, the Kubernetes API proxy can be utilized to access the endpoint.
|
||||||
|
|
||||||
|
If you have enabled TLS by specifying `tls.enabled=true` you also need to specify TLS option to the metrics exporter. You can do that via `metrics.extraArgs`. You can find the metrics exporter CLI flags for TLS [here](https://github.com/oliver006/redis_exporter#command-line-flags). For example:
|
||||||
|
|
||||||
|
You can either specify `metrics.extraArgs.skip-tls-verification=true` to skip TLS verification or providing the following values under `metrics.extraArgs` for TLS client authentication:
|
||||||
|
|
||||||
|
```console
|
||||||
|
tls-client-key-file
|
||||||
|
tls-client-cert-file
|
||||||
|
tls-ca-cert-file
|
||||||
|
```
|
||||||
|
|
||||||
|
### Host Kernel Settings
|
||||||
|
|
||||||
|
Redis<sup>TM</sup> may require some changes in the kernel of the host machine to work as expected, in particular increasing the `somaxconn` value and disabling transparent huge pages.
|
||||||
|
To do so, you can set up a privileged initContainer with the `sysctlImage` config values, for example:
|
||||||
|
|
||||||
|
```
|
||||||
|
sysctlImage:
|
||||||
|
enabled: true
|
||||||
|
mountHostSys: true
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |-
|
||||||
|
sysctl -w net.core.somaxconn=10000
|
||||||
|
echo never > /host-sys/kernel/mm/transparent_hugepage/enabled
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, for Kubernetes 1.12+ you can set `securityContext.sysctls` which will configure sysctls for master and slave pods. Example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
securityContext:
|
||||||
|
sysctls:
|
||||||
|
- name: net.core.somaxconn
|
||||||
|
value: "10000"
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that this will not disable transparent huge tables.
|
||||||
|
|
||||||
|
## Persistence
|
||||||
|
|
||||||
|
By default, the chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) at the `/data` path. The volume is created using dynamic volume provisioning. If a Persistent Volume Claim already exists, specify it during installation.
|
||||||
|
|
||||||
|
### Existing PersistentVolumeClaim
|
||||||
|
|
||||||
|
1. Create the PersistentVolume
|
||||||
|
2. Create the PersistentVolumeClaim
|
||||||
|
3. Install the chart
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm install my-release --set persistence.existingClaim=PVC_NAME bitnami/redis
|
||||||
|
```
|
||||||
|
|
||||||
|
## Backup and restore
|
||||||
|
|
||||||
|
### Backup
|
||||||
|
|
||||||
|
To perform a backup you will need to connect to one of the nodes and execute:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ kubectl exec -it my-redis-master-0 bash
|
||||||
|
|
||||||
|
$ redis-cli
|
||||||
|
127.0.0.1:6379> auth your_current_redis_password
|
||||||
|
OK
|
||||||
|
127.0.0.1:6379> save
|
||||||
|
OK
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you will need to get the created dump file form the redis node:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ kubectl cp my-redis-master-0:/data/dump.rdb dump.rdb -c redis
|
||||||
|
```
|
||||||
|
|
||||||
|
### Restore
|
||||||
|
|
||||||
|
To restore in a new cluster, you will need to change a parameter in the redis.conf file and then upload the `dump.rdb` to the volume.
|
||||||
|
|
||||||
|
Follow the following steps:
|
||||||
|
|
||||||
|
- First you will need to set in the `values.yaml` the parameter `appendonly` to `no`, if it is already `no` you can skip this step.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
configmap: |-
|
||||||
|
# Enable AOF https://redis.io/topics/persistence#append-only-file
|
||||||
|
appendonly no
|
||||||
|
# Disable RDB persistence, AOF persistence already enabled.
|
||||||
|
save ""
|
||||||
|
```
|
||||||
|
|
||||||
|
- Start the new cluster to create the PVCs.
|
||||||
|
|
||||||
|
For example, :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm install new-redis -f values.yaml . --set cluster.enabled=true --set cluster.slaveCount=3
|
||||||
|
```
|
||||||
|
|
||||||
|
- Now that the PVC were created, stop it and copy the `dump.rdp` on the persisted data by using a helping pod.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ helm delete new-redis
|
||||||
|
|
||||||
|
$ kubectl run --generator=run-pod/v1 -i --rm --tty volpod --overrides='
|
||||||
|
{
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"kind": "Pod",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redisvolpod"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [{
|
||||||
|
"command": [
|
||||||
|
"tail",
|
||||||
|
"-f",
|
||||||
|
"/dev/null"
|
||||||
|
],
|
||||||
|
"image": "bitnami/minideb",
|
||||||
|
"name": "mycontainer",
|
||||||
|
"volumeMounts": [{
|
||||||
|
"mountPath": "/mnt",
|
||||||
|
"name": "redisdata"
|
||||||
|
}]
|
||||||
|
}],
|
||||||
|
"restartPolicy": "Never",
|
||||||
|
"volumes": [{
|
||||||
|
"name": "redisdata",
|
||||||
|
"persistentVolumeClaim": {
|
||||||
|
"claimName": "redis-data-new-redis-master-0"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}' --image="bitnami/minideb"
|
||||||
|
|
||||||
|
$ kubectl cp dump.rdb redisvolpod:/mnt/dump.rdb
|
||||||
|
$ kubectl delete pod volpod
|
||||||
|
```
|
||||||
|
|
||||||
|
- Start again the cluster:
|
||||||
|
|
||||||
|
```
|
||||||
|
helm install new-redis -f values.yaml . --set cluster.enabled=true --set cluster.slaveCount=3
|
||||||
|
```
|
||||||
|
|
||||||
|
## NetworkPolicy
|
||||||
|
|
||||||
|
To enable network policy for Redis<sup>TM</sup>, install
|
||||||
|
[a networking plugin that implements the Kubernetes NetworkPolicy spec](https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy#before-you-begin),
|
||||||
|
and set `networkPolicy.enabled` to `true`.
|
||||||
|
|
||||||
|
For Kubernetes v1.5 & v1.6, you must also turn on NetworkPolicy by setting
|
||||||
|
the DefaultDeny namespace annotation. Note: this will enforce policy for _all_ pods in the namespace:
|
||||||
|
|
||||||
|
kubectl annotate namespace default "net.beta.kubernetes.io/network-policy={\"ingress\":{\"isolation\":\"DefaultDeny\"}}"
|
||||||
|
|
||||||
|
With NetworkPolicy enabled, only pods with the generated client label will be
|
||||||
|
able to connect to Redis<sup>TM</sup>. This label will be displayed in the output
|
||||||
|
after a successful install.
|
||||||
|
|
||||||
|
With `networkPolicy.ingressNSMatchLabels` pods from other namespaces can connect to redis. Set `networkPolicy.ingressNSPodMatchLabels` to match pod labels in matched namespace. For example, for a namespace labeled `redis=external` and pods in that namespace labeled `redis-client=true` the fields should be set:
|
||||||
|
|
||||||
|
```
|
||||||
|
networkPolicy:
|
||||||
|
enabled: true
|
||||||
|
ingressNSMatchLabels:
|
||||||
|
redis: external
|
||||||
|
ingressNSPodMatchLabels:
|
||||||
|
redis-client: true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
Find more information about how to deal with common errors related to Bitnami’s Helm charts in [this troubleshooting guide](https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues).
|
||||||
|
|
||||||
|
## Upgrading an existing Release to a new major version
|
||||||
|
|
||||||
|
A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an
|
||||||
|
incompatible breaking change needing manual actions.
|
||||||
|
|
||||||
|
### To 11.0.0
|
||||||
|
|
||||||
|
When using sentinel, a new statefulset called `-node` was introduced. This will break upgrading from a previous version where the statefulsets are called master and slave. Hence the PVC will not match the new naming and won't be reused. If you want to keep your data, you will need to perform a backup and then a restore the data in this new version.
|
||||||
|
|
||||||
|
### To 10.0.0
|
||||||
|
|
||||||
|
For releases with `usePassword: true`, the value `sentinel.usePassword` controls whether the password authentication also applies to the sentinel port. This defaults to `true` for a secure configuration, however it is possible to disable to account for the following cases:
|
||||||
|
|
||||||
|
- Using a version of redis-sentinel prior to `5.0.1` where the authentication feature was introduced.
|
||||||
|
- Where redis clients need to be updated to support sentinel authentication.
|
||||||
|
|
||||||
|
If using a master/slave topology, or with `usePassword: false`, no action is required.
|
||||||
|
|
||||||
|
### To 8.0.18
|
||||||
|
|
||||||
|
For releases with `metrics.enabled: true` the default tag for the exporter image is now `v1.x.x`. This introduces many changes including metrics names. You'll want to use [this dashboard](https://github.com/oliver006/redis_exporter/blob/master/contrib/grafana_prometheus_redis_dashboard.json) now. Please see the [redis_exporter github page](https://github.com/oliver006/redis_exporter#upgrading-from-0x-to-1x) for more details.
|
||||||
|
|
||||||
|
### To 7.0.0
|
||||||
|
|
||||||
|
This version causes a change in the Redis<sup>TM</sup> Master StatefulSet definition, so the command helm upgrade would not work out of the box. As an alternative, one of the following could be done:
|
||||||
|
|
||||||
|
- Recommended: Create a clone of the Redis<sup>TM</sup> Master PVC (for example, using projects like [this one](https://github.com/edseymour/pvc-transfer)). Then launch a fresh release reusing this cloned PVC.
|
||||||
|
|
||||||
|
```
|
||||||
|
helm install my-release bitnami/redis --set persistence.existingClaim=<NEW PVC>
|
||||||
|
```
|
||||||
|
|
||||||
|
- Alternative (not recommended, do at your own risk): `helm delete --purge` does not remove the PVC assigned to the Redis<sup>TM</sup> Master StatefulSet. As a consequence, the following commands can be done to upgrade the release
|
||||||
|
|
||||||
|
```
|
||||||
|
helm delete --purge <RELEASE>
|
||||||
|
helm install <RELEASE> bitnami/redis
|
||||||
|
```
|
||||||
|
|
||||||
|
Previous versions of the chart were not using persistence in the slaves, so this upgrade would add it to them. Another important change is that no values are inherited from master to slaves. For example, in 6.0.0 `slaves.readinessProbe.periodSeconds`, if empty, would be set to `master.readinessProbe.periodSeconds`. This approach lacked transparency and was difficult to maintain. From now on, all the slave parameters must be configured just as it is done with the masters.
|
||||||
|
|
||||||
|
Some values have changed as well:
|
||||||
|
|
||||||
|
- `master.port` and `slave.port` have been changed to `redisPort` (same value for both master and slaves)
|
||||||
|
- `master.securityContext` and `slave.securityContext` have been changed to `securityContext`(same values for both master and slaves)
|
||||||
|
|
||||||
|
By default, the upgrade will not change the cluster topology. In case you want to use Redis<sup>TM</sup> Sentinel, you must explicitly set `sentinel.enabled` to `true`.
|
||||||
|
|
||||||
|
### To 6.0.0
|
||||||
|
|
||||||
|
Previous versions of the chart were using an init-container to change the permissions of the volumes. This was done in case the `securityContext` directive in the template was not enough for that (for example, with cephFS). In this new version of the chart, this container is disabled by default (which should not affect most of the deployments). If your installation still requires that init container, execute `helm upgrade` with the `--set volumePermissions.enabled=true`.
|
||||||
|
|
||||||
|
### To 5.0.0
|
||||||
|
|
||||||
|
The default image in this release may be switched out for any image containing the `redis-server`
|
||||||
|
and `redis-cli` binaries. If `redis-server` is not the default image ENTRYPOINT, `master.command`
|
||||||
|
must be specified.
|
||||||
|
|
||||||
|
#### Breaking changes
|
||||||
|
|
||||||
|
- `master.args` and `slave.args` are removed. Use `master.command` or `slave.command` instead in order to override the image entrypoint, or `master.extraFlags` to pass additional flags to `redis-server`.
|
||||||
|
- `disableCommands` is now interpreted as an array of strings instead of a string of comma separated values.
|
||||||
|
- `master.persistence.path` now defaults to `/data`.
|
||||||
|
|
||||||
|
### 4.0.0
|
||||||
|
|
||||||
|
This version removes the `chart` label from the `spec.selector.matchLabels`
|
||||||
|
which is immutable since `StatefulSet apps/v1beta2`. It has been inadvertently
|
||||||
|
added, causing any subsequent upgrade to fail. See https://github.com/helm/charts/issues/7726.
|
||||||
|
|
||||||
|
It also fixes https://github.com/helm/charts/issues/7726 where a deployment `extensions/v1beta1` can not be upgraded if `spec.selector` is not explicitly set.
|
||||||
|
|
||||||
|
Finally, it fixes https://github.com/helm/charts/issues/7803 by removing mutable labels in `spec.VolumeClaimTemplate.metadata.labels` so that it is upgradable.
|
||||||
|
|
||||||
|
In order to upgrade, delete the Redis<sup>TM</sup> StatefulSet before upgrading:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl delete statefulsets.apps --cascade=false my-release-redis-master
|
||||||
|
```
|
||||||
|
|
||||||
|
And edit the Redis<sup>TM</sup> slave (and metrics if enabled) deployment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl patch deployments my-release-redis-slave --type=json -p='[{"op": "remove", "path": "/spec/selector/matchLabels/chart"}]'
|
||||||
|
kubectl patch deployments my-release-redis-metrics --type=json -p='[{"op": "remove", "path": "/spec/selector/matchLabels/chart"}]'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Upgrading
|
||||||
|
|
||||||
|
### To 12.0.0
|
||||||
|
|
||||||
|
[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL.
|
||||||
|
|
||||||
|
**What changes were introduced in this major version?**
|
||||||
|
|
||||||
|
- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field.
|
||||||
|
- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts
|
||||||
|
|
||||||
|
**Considerations when upgrading to this version**
|
||||||
|
|
||||||
|
- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues
|
||||||
|
- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore
|
||||||
|
- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3
|
||||||
|
|
||||||
|
**Useful links**
|
||||||
|
|
||||||
|
- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/
|
||||||
|
- https://helm.sh/docs/topics/v2_v3_migration/
|
||||||
|
- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/
|
||||||
|
|
||||||
|
### To 11.0.0
|
||||||
|
|
||||||
|
When deployed with sentinel enabled, only a group of nodes is deployed and the master/slave role is handled in the group. To avoid breaking the compatibility, the settings for this nodes are given through the `slave.xxxx` parameters in `values.yaml`
|
||||||
|
|
||||||
|
### To 9.0.0
|
||||||
|
|
||||||
|
The metrics exporter has been changed from a separate deployment to a sidecar container, due to the latest changes in the Redis<sup>TM</sup> exporter code. Check the [official page](https://github.com/oliver006/redis_exporter/) for more information. The metrics container image was changed from oliver006/redis_exporter to bitnami/redis-exporter (Bitnami's maintained package of oliver006/redis_exporter).
|
||||||
|
|
||||||
|
### To 7.0.0
|
||||||
|
|
||||||
|
In order to improve the performance in case of slave failure, we added persistence to the read-only slaves. That means that we moved from Deployment to StatefulSets. This should not affect upgrades from previous versions of the chart, as the deployments did not contain any persistence at all.
|
||||||
|
|
||||||
|
This version also allows enabling Redis<sup>TM</sup> Sentinel containers inside of the Redis<sup>TM</sup> Pods (feature disabled by default). In case the master crashes, a new Redis<sup>TM</sup> node will be elected as master. In order to query the current master (no redis master service is exposed), you need to query first the Sentinel cluster. Find more information [in this section](#master-slave-with-sentinel).
|
||||||
|
|
@ -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 @@
|
||||||
|
annotations:
|
||||||
|
category: Infrastructure
|
||||||
|
apiVersion: v2
|
||||||
|
appVersion: 1.4.2
|
||||||
|
description: A Library Helm Chart for grouping common logic between bitnami charts.
|
||||||
|
This chart is not deployable by itself.
|
||||||
|
home: https://github.com/bitnami/charts/tree/master/bitnami/common
|
||||||
|
icon: https://bitnami.com/downloads/logos/bitnami-mark.png
|
||||||
|
keywords:
|
||||||
|
- common
|
||||||
|
- helper
|
||||||
|
- template
|
||||||
|
- function
|
||||||
|
- bitnami
|
||||||
|
maintainers:
|
||||||
|
- email: containers@bitnami.com
|
||||||
|
name: Bitnami
|
||||||
|
name: common
|
||||||
|
sources:
|
||||||
|
- https://github.com/bitnami/charts
|
||||||
|
- http://www.bitnami.com/
|
||||||
|
type: library
|
||||||
|
version: 1.4.2
|
||||||
322
scripts/helm/helm/databases/charts/redis/charts/common/README.md
Normal file
322
scripts/helm/helm/databases/charts/redis/charts/common/README.md
Normal file
|
|
@ -0,0 +1,322 @@
|
||||||
|
# Bitnami Common Library Chart
|
||||||
|
|
||||||
|
A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts.
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
version: 0.x.x
|
||||||
|
repository: https://charts.bitnami.com/bitnami
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm dependency update
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
data:
|
||||||
|
myvalue: "Hello World"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager.
|
||||||
|
|
||||||
|
Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This Helm chart has been tested on top of [Bitnami Kubernetes Production Runtime](https://kubeprod.io/) (BKPR). Deploy BKPR to get automated TLS certificates, logging and monitoring for your applications.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Kubernetes 1.12+
|
||||||
|
- Helm 3.1.0
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
The following table lists the helpers available in the library which are scoped in different sections.
|
||||||
|
|
||||||
|
### Affinities
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|-------------------------------|------------------------------------------------------|------------------------------------------------|
|
||||||
|
| `common.affinities.node.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` |
|
||||||
|
| `common.affinities.node.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` |
|
||||||
|
| `common.affinities.pod.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` |
|
||||||
|
| `common.affinities.pod.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` |
|
||||||
|
|
||||||
|
### Capabilities
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|----------------------------------------------|------------------------------------------------------------------------------------------------|-------------------|
|
||||||
|
| `common.capabilities.kubeVersion` | Return the target Kubernetes version (using client default if .Values.kubeVersion is not set). | `.` Chart context |
|
||||||
|
| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context |
|
||||||
|
| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context |
|
||||||
|
| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context |
|
||||||
|
| `common.capabilities.rbac.apiVersion` | Return the appropriate apiVersion for RBAC resources. | `.` Chart context |
|
||||||
|
| `common.capabilities.crd.apiVersion` | Return the appropriate apiVersion for CRDs. | `.` Chart context |
|
||||||
|
| `common.capabilities.supportsHelmVersion` | Returns true if the used Helm version is 3.3+ | `.` Chart context |
|
||||||
|
|
||||||
|
### Errors
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|
||||||
|
| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` |
|
||||||
|
|
||||||
|
### Images
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|-----------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. |
|
||||||
|
| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` |
|
||||||
|
|
||||||
|
### Ingress
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.ingress.backend` | Generate a proper Ingress backend entry depending on the API version | `dict "serviceName" "foo" "servicePort" "bar"`, see the [Ingress deprecation notice](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for the syntax differences |
|
||||||
|
|
||||||
|
### Labels
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|-----------------------------|------------------------------------------------------|-------------------|
|
||||||
|
| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context |
|
||||||
|
| `common.labels.matchLabels` | Return the proper Docker Image Registry Secret Names | `.` Chart context |
|
||||||
|
|
||||||
|
### Names
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|-------------------------|------------------------------------------------------------|-------------------|
|
||||||
|
| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context |
|
||||||
|
| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context |
|
||||||
|
| `common.names.chart` | Chart name plus version | `.` Chart context |
|
||||||
|
|
||||||
|
### Secrets
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|---------------------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. |
|
||||||
|
| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. |
|
||||||
|
| `common.passwords.manage` | Generate secret password or retrieve one if already created. | `dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $`, length, strong and chartNAme fields are optional. |
|
||||||
|
| `common.secrets.exists` | Returns whether a previous generated secret already exists. | `dict "secret" "secret-name" "context" $` |
|
||||||
|
|
||||||
|
### Storage
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|-------------------------------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.affinities.node.soft` | Return a soft nodeAffinity definition | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. |
|
||||||
|
|
||||||
|
### TplValues
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|---------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frequently is the chart context `$` or `.` |
|
||||||
|
|
||||||
|
### Utils
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
|
||||||
|
| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` |
|
||||||
|
| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` |
|
||||||
|
| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` |
|
||||||
|
| `common.utils.getKeyFromList` | Returns first `.Values` key with a defined value or first of the list if all non-defined | `dict "keys" (list "path.to.key1" "path.to.key2") "context" $` |
|
||||||
|
|
||||||
|
### Validations
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "subchart" "subchart" "context" $` secret, field and subchart are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) |
|
||||||
|
| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) |
|
||||||
|
| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mariadb chart and the helper. |
|
||||||
|
| `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. |
|
||||||
|
| `common.validations.values.redis.passwords` | This helper will ensure required password for Redis<sup>TM</sup> are not empty. It returns a shared error for all the values. | `dict "secret" "redis-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use redis chart and the helper. |
|
||||||
|
| `common.validations.values.cassandra.passwords` | This helper will ensure required password for Cassandra are not empty. It returns a shared error for all the values. | `dict "secret" "cassandra-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use cassandra chart and the helper. |
|
||||||
|
| `common.validations.values.mongodb.passwords` | This helper will ensure required password for MongoDB® are not empty. It returns a shared error for all the values. | `dict "secret" "mongodb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mongodb chart and the helper. |
|
||||||
|
|
||||||
|
### Warnings
|
||||||
|
|
||||||
|
| Helper identifier | Description | Expected Input |
|
||||||
|
|------------------------------|----------------------------------|------------------------------------------------------------|
|
||||||
|
| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. |
|
||||||
|
|
||||||
|
## Special input schemas
|
||||||
|
|
||||||
|
### ImageRoot
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
registry:
|
||||||
|
type: string
|
||||||
|
description: Docker registry where the image is located
|
||||||
|
example: docker.io
|
||||||
|
|
||||||
|
repository:
|
||||||
|
type: string
|
||||||
|
description: Repository and image name
|
||||||
|
example: bitnami/nginx
|
||||||
|
|
||||||
|
tag:
|
||||||
|
type: string
|
||||||
|
description: image tag
|
||||||
|
example: 1.16.1-debian-10-r63
|
||||||
|
|
||||||
|
pullPolicy:
|
||||||
|
type: string
|
||||||
|
description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||||
|
|
||||||
|
pullSecrets:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
description: Optionally specify an array of imagePullSecrets.
|
||||||
|
|
||||||
|
debug:
|
||||||
|
type: boolean
|
||||||
|
description: Set to true if you would like to see extra information on logs
|
||||||
|
example: false
|
||||||
|
|
||||||
|
## An instance would be:
|
||||||
|
# registry: docker.io
|
||||||
|
# repository: bitnami/nginx
|
||||||
|
# tag: 1.16.1-debian-10-r63
|
||||||
|
# pullPolicy: IfNotPresent
|
||||||
|
# debug: false
|
||||||
|
```
|
||||||
|
|
||||||
|
### Persistence
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
enabled:
|
||||||
|
type: boolean
|
||||||
|
description: Whether enable persistence.
|
||||||
|
example: true
|
||||||
|
|
||||||
|
storageClass:
|
||||||
|
type: string
|
||||||
|
description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning.
|
||||||
|
example: "-"
|
||||||
|
|
||||||
|
accessMode:
|
||||||
|
type: string
|
||||||
|
description: Access mode for the Persistent Volume Storage.
|
||||||
|
example: ReadWriteOnce
|
||||||
|
|
||||||
|
size:
|
||||||
|
type: string
|
||||||
|
description: Size the Persistent Volume Storage.
|
||||||
|
example: 8Gi
|
||||||
|
|
||||||
|
path:
|
||||||
|
type: string
|
||||||
|
description: Path to be persisted.
|
||||||
|
example: /bitnami
|
||||||
|
|
||||||
|
## An instance would be:
|
||||||
|
# enabled: true
|
||||||
|
# storageClass: "-"
|
||||||
|
# accessMode: ReadWriteOnce
|
||||||
|
# size: 8Gi
|
||||||
|
# path: /bitnami
|
||||||
|
```
|
||||||
|
|
||||||
|
### ExistingSecret
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: Name of the existing secret.
|
||||||
|
example: mySecret
|
||||||
|
keyMapping:
|
||||||
|
description: Mapping between the expected key name and the name of the key in the existing secret.
|
||||||
|
type: object
|
||||||
|
|
||||||
|
## An instance would be:
|
||||||
|
# name: mySecret
|
||||||
|
# keyMapping:
|
||||||
|
# password: myPasswordKey
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example of use
|
||||||
|
|
||||||
|
When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# templates/secret.yaml
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "common.names.fullname" . }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
password: {{ .Values.password | b64enc | quote }}
|
||||||
|
|
||||||
|
# templates/dpl.yaml
|
||||||
|
---
|
||||||
|
...
|
||||||
|
env:
|
||||||
|
- name: PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }}
|
||||||
|
key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }}
|
||||||
|
...
|
||||||
|
|
||||||
|
# values.yaml
|
||||||
|
---
|
||||||
|
name: mySecret
|
||||||
|
keyMapping:
|
||||||
|
password: myPasswordKey
|
||||||
|
```
|
||||||
|
|
||||||
|
### ValidateValue
|
||||||
|
|
||||||
|
#### NOTES.txt
|
||||||
|
|
||||||
|
```console
|
||||||
|
{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}}
|
||||||
|
{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}}
|
||||||
|
|
||||||
|
{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||||
|
```
|
||||||
|
|
||||||
|
If we force those values to be empty we will see some alerts
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install test mychart --set path.to.value00="",path.to.value01=""
|
||||||
|
'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value:
|
||||||
|
|
||||||
|
export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 --decode)
|
||||||
|
|
||||||
|
'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value:
|
||||||
|
|
||||||
|
export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 --decode)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Upgrading
|
||||||
|
|
||||||
|
### To 1.0.0
|
||||||
|
|
||||||
|
[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL.
|
||||||
|
|
||||||
|
**What changes were introduced in this major version?**
|
||||||
|
|
||||||
|
- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field.
|
||||||
|
- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information.
|
||||||
|
- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts
|
||||||
|
|
||||||
|
**Considerations when upgrading to this version**
|
||||||
|
|
||||||
|
- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues
|
||||||
|
- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore
|
||||||
|
- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3
|
||||||
|
|
||||||
|
**Useful links**
|
||||||
|
|
||||||
|
- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/
|
||||||
|
- https://helm.sh/docs/topics/v2_v3_migration/
|
||||||
|
- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a soft nodeAffinity definition
|
||||||
|
{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.nodes.soft" -}}
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- preference:
|
||||||
|
matchExpressions:
|
||||||
|
- key: {{ .key }}
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
{{- range .values }}
|
||||||
|
- {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
weight: 1
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a hard nodeAffinity definition
|
||||||
|
{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.nodes.hard" -}}
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
nodeSelectorTerms:
|
||||||
|
- matchExpressions:
|
||||||
|
- key: {{ .key }}
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
{{- range .values }}
|
||||||
|
- {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a nodeAffinity definition
|
||||||
|
{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.nodes" -}}
|
||||||
|
{{- if eq .type "soft" }}
|
||||||
|
{{- include "common.affinities.nodes.soft" . -}}
|
||||||
|
{{- else if eq .type "hard" }}
|
||||||
|
{{- include "common.affinities.nodes.hard" . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a soft podAffinity/podAntiAffinity definition
|
||||||
|
{{ include "common.affinities.pods.soft" (dict "component" "FOO" "context" $) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.pods.soft" -}}
|
||||||
|
{{- $component := default "" .component -}}
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }}
|
||||||
|
{{- if not (empty $component) }}
|
||||||
|
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||||
|
{{- end }}
|
||||||
|
namespaces:
|
||||||
|
- {{ .context.Release.Namespace | quote }}
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
weight: 1
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a hard podAffinity/podAntiAffinity definition
|
||||||
|
{{ include "common.affinities.pods.hard" (dict "component" "FOO" "context" $) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.pods.hard" -}}
|
||||||
|
{{- $component := default "" .component -}}
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- labelSelector:
|
||||||
|
matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }}
|
||||||
|
{{- if not (empty $component) }}
|
||||||
|
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||||
|
{{- end }}
|
||||||
|
namespaces:
|
||||||
|
- {{ .context.Release.Namespace | quote }}
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a podAffinity/podAntiAffinity definition
|
||||||
|
{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.pods" -}}
|
||||||
|
{{- if eq .type "soft" }}
|
||||||
|
{{- include "common.affinities.pods.soft" . -}}
|
||||||
|
{{- else if eq .type "hard" }}
|
||||||
|
{{- include "common.affinities.pods.hard" . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the target Kubernetes version
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.kubeVersion" -}}
|
||||||
|
{{- if .Values.global }}
|
||||||
|
{{- if .Values.global.kubeVersion }}
|
||||||
|
{{- .Values.global.kubeVersion -}}
|
||||||
|
{{- else }}
|
||||||
|
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else }}
|
||||||
|
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for deployment.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.deployment.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apps/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for statefulset.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.statefulset.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "apps/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apps/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for ingress.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.ingress.apiVersion" -}}
|
||||||
|
{{- if .Values.ingress -}}
|
||||||
|
{{- if .Values.ingress.apiVersion -}}
|
||||||
|
{{- .Values.ingress.apiVersion -}}
|
||||||
|
{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "networking.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "networking.k8s.io/v1" -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "networking.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "networking.k8s.io/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for RBAC resources.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.rbac.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "rbac.authorization.k8s.io/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for CRDs.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.crd.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "apiextensions.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apiextensions.k8s.io/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Returns true if the used Helm version is 3.3+.
|
||||||
|
A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure.
|
||||||
|
This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error.
|
||||||
|
**To be removed when the catalog's minimun Helm version is 3.3**
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.supportsHelmVersion" -}}
|
||||||
|
{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Through error when upgrading using empty passwords values that must not be empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
|
||||||
|
{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
|
||||||
|
{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
|
||||||
|
|
||||||
|
Required password params:
|
||||||
|
- validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
|
||||||
|
- context - Context - Required. Parent context.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.errors.upgrade.passwords.empty" -}}
|
||||||
|
{{- $validationErrors := join "" .validationErrors -}}
|
||||||
|
{{- if and $validationErrors .context.Release.IsUpgrade -}}
|
||||||
|
{{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}}
|
||||||
|
{{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}}
|
||||||
|
{{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}}
|
||||||
|
{{- $errorString = print $errorString "\n%s" -}}
|
||||||
|
{{- printf $errorString $validationErrors | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Return the proper image name
|
||||||
|
{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.images.image" -}}
|
||||||
|
{{- $registryName := .imageRoot.registry -}}
|
||||||
|
{{- $repositoryName := .imageRoot.repository -}}
|
||||||
|
{{- $tag := .imageRoot.tag | toString -}}
|
||||||
|
{{- if .global }}
|
||||||
|
{{- if .global.imageRegistry }}
|
||||||
|
{{- $registryName = .global.imageRegistry -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if $registryName }}
|
||||||
|
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s:%s" $repositoryName $tag -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper Docker Image Registry Secret Names
|
||||||
|
{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.images.pullSecrets" -}}
|
||||||
|
{{- $pullSecrets := list }}
|
||||||
|
|
||||||
|
{{- if .global }}
|
||||||
|
{{- range .global.imagePullSecrets -}}
|
||||||
|
{{- $pullSecrets = append $pullSecrets . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- range .images -}}
|
||||||
|
{{- range .pullSecrets -}}
|
||||||
|
{{- $pullSecrets = append $pullSecrets . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (not (empty $pullSecrets)) }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- range $pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Generate backend entry that is compatible with all Kubernetes API versions.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- serviceName - String. Name of an existing service backend
|
||||||
|
- servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer.
|
||||||
|
- context - Dict - Required. The context for the template evaluation.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.ingress.backend" -}}
|
||||||
|
{{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}}
|
||||||
|
{{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}}
|
||||||
|
serviceName: {{ .serviceName }}
|
||||||
|
servicePort: {{ .servicePort }}
|
||||||
|
{{- else -}}
|
||||||
|
service:
|
||||||
|
name: {{ .serviceName }}
|
||||||
|
port:
|
||||||
|
{{- if typeIs "string" .servicePort }}
|
||||||
|
name: {{ .servicePort }}
|
||||||
|
{{- else if typeIs "int" .servicePort }}
|
||||||
|
number: {{ .servicePort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Print "true" if the API pathType field is supported
|
||||||
|
Usage:
|
||||||
|
{{ include "common.ingress.supportsPathType" . }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.ingress.supportsPathType" -}}
|
||||||
|
{{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}}
|
||||||
|
{{- print "false" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "true" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Kubernetes standard labels
|
||||||
|
*/}}
|
||||||
|
{{- define "common.labels.standard" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||||
|
helm.sh/chart: {{ include "common.names.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 "common.labels.matchLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | 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 "common.names.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 -}}
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Generate secret name.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||||
|
to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility.
|
||||||
|
+info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret
|
||||||
|
- defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment.
|
||||||
|
- context - Dict - Required. The context for the template evaluation.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.name" -}}
|
||||||
|
{{- $name := (include "common.names.fullname" .context) -}}
|
||||||
|
|
||||||
|
{{- if .defaultNameSuffix -}}
|
||||||
|
{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- with .existingSecret -}}
|
||||||
|
{{- if not (typeIs "string" .) -}}
|
||||||
|
{{- with .name -}}
|
||||||
|
{{- $name = . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $name = . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- printf "%s" $name -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Generate secret key.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||||
|
to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility.
|
||||||
|
+info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret
|
||||||
|
- key - String - Required. Name of the key in the secret.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.key" -}}
|
||||||
|
{{- $key := .key -}}
|
||||||
|
|
||||||
|
{{- if .existingSecret -}}
|
||||||
|
{{- if not (typeIs "string" .existingSecret) -}}
|
||||||
|
{{- if .existingSecret.keyMapping -}}
|
||||||
|
{{- $key = index .existingSecret.keyMapping $.key -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- printf "%s" $key -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Generate secret password or retrieve one if already created.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- secret - String - Required - Name of the 'Secret' resource where the password is stored.
|
||||||
|
- key - String - Required - Name of the key in the secret.
|
||||||
|
- providedValues - List<String> - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value.
|
||||||
|
- length - int - Optional - Length of the generated random password.
|
||||||
|
- strong - Boolean - Optional - Whether to add symbols to the generated random password.
|
||||||
|
- chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart.
|
||||||
|
- context - Context - Required - Parent context.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.passwords.manage" -}}
|
||||||
|
|
||||||
|
{{- $password := "" }}
|
||||||
|
{{- $subchart := "" }}
|
||||||
|
{{- $chartName := default "" .chartName }}
|
||||||
|
{{- $passwordLength := default 10 .length }}
|
||||||
|
{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }}
|
||||||
|
{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }}
|
||||||
|
{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }}
|
||||||
|
{{- if $secret }}
|
||||||
|
{{- if index $secret.data .key }}
|
||||||
|
{{- $password = index $secret.data .key }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else if $providedPasswordValue }}
|
||||||
|
{{- $password = $providedPasswordValue | toString | b64enc | quote }}
|
||||||
|
{{- else }}
|
||||||
|
|
||||||
|
{{- if .context.Values.enabled }}
|
||||||
|
{{- $subchart = $chartName }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}}
|
||||||
|
{{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}}
|
||||||
|
{{- $passwordValidationErrors := list $requiredPasswordError -}}
|
||||||
|
{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}}
|
||||||
|
|
||||||
|
{{- if .strong }}
|
||||||
|
{{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }}
|
||||||
|
{{- $password = randAscii $passwordLength }}
|
||||||
|
{{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }}
|
||||||
|
{{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $password = randAlphaNum $passwordLength | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "%s" $password -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Returns whether a previous generated secret already exists
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- secret - String - Required - Name of the 'Secret' resource where the password is stored.
|
||||||
|
- context - Context - Required - Parent context.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.exists" -}}
|
||||||
|
{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }}
|
||||||
|
{{- if $secret }}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Return the proper Storage Class
|
||||||
|
{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.storage.class" -}}
|
||||||
|
|
||||||
|
{{- $storageClass := .persistence.storageClass -}}
|
||||||
|
{{- if .global -}}
|
||||||
|
{{- if .global.storageClass -}}
|
||||||
|
{{- $storageClass = .global.storageClass -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if $storageClass -}}
|
||||||
|
{{- if (eq "-" $storageClass) -}}
|
||||||
|
{{- printf "storageClassName: \"\"" -}}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "storageClassName: %s" $storageClass -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Renders a value that contains template.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.tplvalues.render" -}}
|
||||||
|
{{- if typeIs "string" .value }}
|
||||||
|
{{- tpl .value .context }}
|
||||||
|
{{- else }}
|
||||||
|
{{- tpl (.value | toYaml) .context }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Print instructions to get a secret value.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.secret.getvalue" -}}
|
||||||
|
{{- $varname := include "common.utils.fieldToEnvVar" . -}}
|
||||||
|
export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 --decode)
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Build env var name given a field
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.fieldToEnvVar" -}}
|
||||||
|
{{- $fieldNameSplit := splitList "-" .field -}}
|
||||||
|
{{- $upperCaseFieldNameSplit := list -}}
|
||||||
|
|
||||||
|
{{- range $fieldNameSplit -}}
|
||||||
|
{{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{ join "_" $upperCaseFieldNameSplit }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Gets a value from .Values given
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.getValueFromKey" -}}
|
||||||
|
{{- $splitKey := splitList "." .key -}}
|
||||||
|
{{- $value := "" -}}
|
||||||
|
{{- $latestObj := $.context.Values -}}
|
||||||
|
{{- range $splitKey -}}
|
||||||
|
{{- if not $latestObj -}}
|
||||||
|
{{- printf "please review the entire path of '%s' exists in values" $.key | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $value = ( index $latestObj . ) -}}
|
||||||
|
{{- $latestObj = $value -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "%v" (default "" $value) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Returns first .Values key with a defined value or first of the list if all non-defined
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.getKeyFromList" -}}
|
||||||
|
{{- $key := first .keys -}}
|
||||||
|
{{- $reverseKeys := reverse .keys }}
|
||||||
|
{{- range $reverseKeys }}
|
||||||
|
{{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }}
|
||||||
|
{{- if $value -}}
|
||||||
|
{{- $key = . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "%s" $key -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Warning about using rolling tag.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.warnings.rollingTag" -}}
|
||||||
|
|
||||||
|
{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||||
|
WARNING: Rolling tag detected ({{ .repository }}:{{ .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 -}}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate Cassandra required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.cassandra.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.cassandra.values.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.cassandra.values.enabled" . -}}
|
||||||
|
{{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}}
|
||||||
|
{{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}}
|
||||||
|
|
||||||
|
{{- if and (not $existingSecret) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.cassandra.values.existingSecret" (dict "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.cassandra.values.existingSecret" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.cassandra.dbUser.existingSecret | quote -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.dbUser.existingSecret | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled cassandra.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.cassandra.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.cassandra.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.cassandra.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key dbUser
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.cassandra.values.key.dbUser" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
cassandra.dbUser
|
||||||
|
{{- else -}}
|
||||||
|
dbUser
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate MariaDB required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.mariadb.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.mariadb.values.enabled" . -}}
|
||||||
|
{{- $architecture := include "common.mariadb.values.architecture" . -}}
|
||||||
|
{{- $authPrefix := include "common.mariadb.values.key.auth" . -}}
|
||||||
|
{{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}}
|
||||||
|
{{- $valueKeyUsername := printf "%s.username" $authPrefix -}}
|
||||||
|
{{- $valueKeyPassword := printf "%s.password" $authPrefix -}}
|
||||||
|
{{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}}
|
||||||
|
|
||||||
|
{{- if and (not $existingSecret) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}}
|
||||||
|
|
||||||
|
{{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }}
|
||||||
|
{{- if not (empty $valueUsername) -}}
|
||||||
|
{{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (eq $architecture "replication") -}}
|
||||||
|
{{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.auth.existingSecret" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mariadb.auth.existingSecret | quote -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.auth.existingSecret | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled mariadb.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.mariadb.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for architecture
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.architecture" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mariadb.architecture -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.architecture -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key auth
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.key.auth" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
mariadb.auth
|
||||||
|
{{- else -}}
|
||||||
|
auth
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate MongoDB(R) required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.mongodb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where MongoDB(R) values are stored, e.g: "mongodb-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether MongoDB(R) is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.mongodb.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.mongodb.values.auth.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.mongodb.values.enabled" . -}}
|
||||||
|
{{- $authPrefix := include "common.mongodb.values.key.auth" . -}}
|
||||||
|
{{- $architecture := include "common.mongodb.values.architecture" . -}}
|
||||||
|
{{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}}
|
||||||
|
{{- $valueKeyUsername := printf "%s.username" $authPrefix -}}
|
||||||
|
{{- $valueKeyDatabase := printf "%s.database" $authPrefix -}}
|
||||||
|
{{- $valueKeyPassword := printf "%s.password" $authPrefix -}}
|
||||||
|
{{- $valueKeyReplicaSetKey := printf "%s.replicaSetKey" $authPrefix -}}
|
||||||
|
{{- $valueKeyAuthEnabled := printf "%s.enabled" $authPrefix -}}
|
||||||
|
|
||||||
|
{{- $authEnabled := include "common.utils.getValueFromKey" (dict "key" $valueKeyAuthEnabled "context" .context) -}}
|
||||||
|
|
||||||
|
{{- if and (not $existingSecret) (eq $enabled "true") (eq $authEnabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mongodb-root-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}}
|
||||||
|
|
||||||
|
{{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }}
|
||||||
|
{{- $valueDatabase := include "common.utils.getValueFromKey" (dict "key" $valueKeyDatabase "context" .context) }}
|
||||||
|
{{- if and $valueUsername $valueDatabase -}}
|
||||||
|
{{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mongodb-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (eq $architecture "replicaset") -}}
|
||||||
|
{{- $requiredReplicaSetKey := dict "valueKey" $valueKeyReplicaSetKey "secret" .secret "field" "mongodb-replica-set-key" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredReplicaSetKey -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mongodb.values.auth.existingSecret" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mongodb.auth.existingSecret | quote -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.auth.existingSecret | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled mongodb.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mongodb.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mongodb.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.mongodb.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key auth
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MongoDB(R) is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mongodb.values.key.auth" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
mongodb.auth
|
||||||
|
{{- else -}}
|
||||||
|
auth
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for architecture
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mongodb.values.architecture" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mongodb.architecture -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.architecture -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate PostgreSQL required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where postgresql values are stored, e.g: "postgresql-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.postgresql.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.postgresql.values.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.postgresql.values.enabled" . -}}
|
||||||
|
{{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}}
|
||||||
|
{{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}}
|
||||||
|
|
||||||
|
{{- if and (not $existingSecret) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}}
|
||||||
|
|
||||||
|
{{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}}
|
||||||
|
{{- if (eq $enabledReplication "true") -}}
|
||||||
|
{{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to decide whether evaluate global values.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- key - String - Required. Field to be evaluated within global, e.g: "existingSecret"
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.use.global" -}}
|
||||||
|
{{- if .context.Values.global -}}
|
||||||
|
{{- if .context.Values.global.postgresql -}}
|
||||||
|
{{- index .context.Values.global.postgresql .key | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.existingSecret" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.existingSecret" -}}
|
||||||
|
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}}
|
||||||
|
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- default (.context.Values.existingSecret | quote) $globalValue -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled postgresql.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.postgresql.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key postgressPassword.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.key.postgressPassword" -}}
|
||||||
|
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}}
|
||||||
|
|
||||||
|
{{- if not $globalValue -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
postgresql.postgresqlPassword
|
||||||
|
{{- else -}}
|
||||||
|
postgresqlPassword
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
global.postgresql.postgresqlPassword
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled.replication.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.enabled.replication" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.postgresql.replication.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" .context.Values.replication.enabled -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key replication.password.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.key.replicationPassword" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
postgresql.replication.password
|
||||||
|
{{- else -}}
|
||||||
|
replication.password
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate Redis(TM) required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.redis.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.redis.values.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.redis.values.enabled" . -}}
|
||||||
|
{{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}}
|
||||||
|
{{- $valueKeyRedisPassword := printf "%s%s" $valueKeyPrefix "password" -}}
|
||||||
|
{{- $valueKeyRedisUsePassword := printf "%s%s" $valueKeyPrefix "usePassword" -}}
|
||||||
|
|
||||||
|
{{- if and (not $existingSecret) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $usePassword := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUsePassword "context" .context) -}}
|
||||||
|
{{- if eq $usePassword "true" -}}
|
||||||
|
{{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Redis Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.redis.values.existingSecret" (dict "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether Redis(TM) is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.redis.values.existingSecret" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.redis.existingSecret | quote -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.existingSecret | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled redis.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.redis.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.redis.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.redis.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right prefix path for the values
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.redis.values.keys.prefix" -}}
|
||||||
|
{{- if .subchart -}}redis.{{- else -}}{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate values must not be empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}}
|
||||||
|
{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}}
|
||||||
|
{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||||
|
|
||||||
|
Validate value params:
|
||||||
|
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||||
|
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||||
|
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.multiple.empty" -}}
|
||||||
|
{{- range .required -}}
|
||||||
|
{{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Validate a value must not be empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }}
|
||||||
|
|
||||||
|
Validate value params:
|
||||||
|
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||||
|
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||||
|
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||||
|
- subchart - String - Optional - Name of the subchart that the validated password is part of.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.single.empty" -}}
|
||||||
|
{{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }}
|
||||||
|
{{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }}
|
||||||
|
|
||||||
|
{{- if not $value -}}
|
||||||
|
{{- $varname := "my-value" -}}
|
||||||
|
{{- $getCurrentValue := "" -}}
|
||||||
|
{{- if and .secret .field -}}
|
||||||
|
{{- $varname = include "common.utils.fieldToEnvVar" . -}}
|
||||||
|
{{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
## bitnami/common
|
||||||
|
## It is required by CI/CD tools and processes.
|
||||||
|
exampleValue: common-chart
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
# Leave this file empty to ensure that CI runs builds against the default configuration in values.yaml.
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue