mirror of
https://github.com/ZwareBear/JFrog-Cloud-Installers.git
synced 2026-01-21 02:06:56 -06:00
Xray Operator v2.0.0 w/ new helm changes
This commit is contained in:
0
Openshift4/operator/xray-operator/helm-charts/openshift-xray/CHANGELOG.md
Executable file → Normal file
0
Openshift4/operator/xray-operator/helm-charts/openshift-xray/CHANGELOG.md
Executable file → Normal file
4
Openshift4/operator/xray-operator/helm-charts/openshift-xray/Chart.yaml
Executable file → Normal file
4
Openshift4/operator/xray-operator/helm-charts/openshift-xray/Chart.yaml
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: 3.17.2
|
||||
appVersion: 3.16.0
|
||||
description: Universal component scan for security and license inventory and impact analysis
|
||||
sources:
|
||||
- https://bintray.com/jfrog/product/xray/view
|
||||
@@ -13,4 +13,4 @@ maintainers:
|
||||
- email: johnp@jfrog.com
|
||||
name: John Peterson
|
||||
name: openshift-xray
|
||||
version: 6.11.0
|
||||
version: 6.10.0
|
||||
|
||||
0
Openshift4/operator/xray-operator/helm-charts/openshift-xray/LICENSE
Executable file → Normal file
0
Openshift4/operator/xray-operator/helm-charts/openshift-xray/LICENSE
Executable file → Normal file
0
Openshift4/operator/xray-operator/helm-charts/openshift-xray/README.md
Executable file → Normal file
0
Openshift4/operator/xray-operator/helm-charts/openshift-xray/README.md
Executable file → Normal 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
|
||||
OWNERS
|
||||
@@ -0,0 +1,535 @@
|
||||
# JFrog Xray Chart Changelog
|
||||
All changes to this chart will be documented in this file
|
||||
|
||||
## [6.8.3] - Dec 29, 2020
|
||||
* Update Xray to version `3.14.3` - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.14.3)
|
||||
|
||||
## [6.8.2] - Dec 28, 2020
|
||||
* Updated Xray application sizing yamls (values-small.yaml, values-medium.yaml, values-large.yaml)
|
||||
|
||||
## [6.8.1] - Dec 24, 2020
|
||||
* Update Xray to version `3.14.1` - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.14.1)
|
||||
|
||||
## [6.8.0] - Dec 18, 2020
|
||||
* Update Xray to version `3.14.0`
|
||||
|
||||
## [6.7.2] - Dec 14, 2020
|
||||
* Added support for passing actualUsername in secrets
|
||||
|
||||
## [6.7.1] - Dec 11, 2020
|
||||
* Added configurable `.Values.global.versions.xray` in values.yaml
|
||||
|
||||
## [6.7.0] - Dec 10, 2020
|
||||
* Update postgresql tag version to `12.5.0-debian-10-r25`
|
||||
* Update rabbitmq tag version to `3.8.9-debian-10-r58`
|
||||
* Update rabbitmq-ha tag version to `3.8.9-alpine`
|
||||
|
||||
## [6.6.0] - Dec 8, 2020
|
||||
* Update Xray to version `3.13.0` - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.13)
|
||||
* Updated chart maintainers email
|
||||
|
||||
## [6.5.2] - Dec 4, 2020
|
||||
* **Important:** Renamed `.Values.systemYaml` to `.Values.systemYamlOverride`
|
||||
|
||||
## [6.5.1] - Nov 30, 2020
|
||||
* Updated port namings on services and pods to allow for istio protocol discovery
|
||||
|
||||
## [6.5.0] - Nov 30, 2020
|
||||
* Update Xray to version `3.12.0` - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.12)
|
||||
* Update router version to `7.11.2`
|
||||
* Update alpine tag version to `3.12.1`
|
||||
|
||||
## [6.4.4] - Nov 20, 2020
|
||||
* Support external rabbitmq credentials to come from existing secret
|
||||
|
||||
## [6.4.3] - Nov 16, 2020
|
||||
* Support actualUsername for Azure
|
||||
* Bugfix - Issue with custom image tags
|
||||
|
||||
## [6.4.2] - Nov 16, 2020
|
||||
* Update Xray to version 3.11.2 - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.11)
|
||||
|
||||
## [6.4.1] - Nov 10, 2020
|
||||
* Pass system.yaml via external secret for advanced usecases
|
||||
* Bugfix - stateful set not picking up changes to database secrets
|
||||
|
||||
## [6.4.0] - Nov 9, 2020
|
||||
* Update Xray to version 3.11.1 - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.11)
|
||||
* Fix values-small,medium,large yaml files
|
||||
|
||||
## [6.3.0] - Nov 3, 2020
|
||||
* Change stable repository location to https://charts.helm.sh/stable
|
||||
* Update bitnami rabbitmq chart to 7.7.1
|
||||
|
||||
## [6.2.1] - Oct 23, 2020
|
||||
* Update router version to `1.4.4`
|
||||
|
||||
## [6.2.0] - Oct 23, 2020
|
||||
* Update Xray to version 3.10.3 - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.10.3)
|
||||
|
||||
## [6.1.2] - Oct 9, 2020
|
||||
* Add global support for customInitContainersBegin
|
||||
|
||||
## [6.1.1] - Oct 5, 2020
|
||||
* Fixed broken joinkey condition
|
||||
* Updated UPGRADE_NOTES.md
|
||||
|
||||
## [6.1.0] - Oct 1, 2020
|
||||
* Update Xray to version 3.9.1
|
||||
|
||||
## [6.0.6] - Sep 30, 2020
|
||||
* Added support for resources in init containers
|
||||
|
||||
## [6.0.5] - Sep 28, 2020
|
||||
* Update Xray to version 3.8.8 - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.8.8)
|
||||
* Added support for labels for STS and pods
|
||||
|
||||
## [6.0.4] - Sep 25, 2020
|
||||
* Update Xray to version `3.8.7` - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.8.7)
|
||||
* Update filebeat version to `7.9.2`
|
||||
|
||||
## [6.0.3] - Sep 22, 2020
|
||||
* Readme Updates
|
||||
|
||||
## [6.0.2] - Sep 17, 2020
|
||||
* Update Xray to version `3.8.6` - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.8.6)
|
||||
|
||||
## [6.0.1] - Sep 16, 2020
|
||||
* Update Xray to version `3.8.5` - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.8.5)
|
||||
* Added additional rabbitmq configuration
|
||||
* Added back `common.xrayVersion` in values.yaml
|
||||
|
||||
## [6.0.0] - Sep 2, 2020
|
||||
* **Breaking change:** Changed `imagePullSecrets` value from string to list.
|
||||
* **Breaking change:** Added `image.registry` and `common.xrayVersion` is changed to `image.tag` under analysis,indexer,persist,server and router sections
|
||||
* Added support for global values
|
||||
* Update postgresql chart version to `9.3.4`
|
||||
* Updated chart maintainers in chart.yaml
|
||||
* Update router version to `1.4.3`
|
||||
|
||||
## [5.0.0] - Aug 24, 2020
|
||||
* Update Xray to version `3.8.2` - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.8.2)
|
||||
* Update postgresql chart version to `9.3.2` - [9.x Upgrade Notes](https://github.com/bitnami/charts/tree/master/bitnami/postgresql#900)
|
||||
* **IMPORTANT**
|
||||
* If this is a new deployment or you already use an external database (`postgresql.enabled=false`), these changes **do not affect you**!
|
||||
* If this is an upgrade and you are using the default PostgreSQL (`postgresql.enabled=true`), you need to pass previous 9.x/10.x's postgresql.image.tag and databaseUpgradeReady=true
|
||||
* Update postgresql tag version to `12.3.0-debian-10-r71`
|
||||
* Update rabbitmq tag version to `3.8.7-debian-10-r3`
|
||||
* Update rabbitmq-ha tag version to `3.8.7-alpine`
|
||||
|
||||
## [4.2.1] - Aug 14, 2020
|
||||
* Added support for external rabbitmq
|
||||
* Added support for Load Definitions for rabbitmq subchart when `rabbitmq.enabled=true` . Please refer [here](https://github.com/bitnami/charts/tree/master/bitnami/rabbitmq#load-definitions)
|
||||
|
||||
## [4.2.0] - Aug 13, 2020
|
||||
* Update Xray to version `3.8.0` - [Release Notes](https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.8)
|
||||
* Update rabbitmq-ha tag version to `3.8.6-alpine`
|
||||
* Update rabbitmq tag version to `3.8.6-debian-10-r1`
|
||||
|
||||
## [4.1.3] - Jul 28, 2020
|
||||
* Add tpl to external database secrets.
|
||||
* Modified `scheme` to `xray.scheme`
|
||||
|
||||
## [4.1.2] - Jul 16, 2020
|
||||
* Added support for `common.customSidecarContainers` to create custom sidecar containers
|
||||
* Added support for `common.configMaps` to create custom configMaps
|
||||
* Added README for Establishing TLS and Adding certificates. Please refer [here](https://github.com/jfrog/charts/blob/master/stable/xray/README.md#establishing-tls-and-adding-certificates)
|
||||
* Update router version to `1.4.2`
|
||||
|
||||
## [4.1.1] - Jul 10, 2020
|
||||
* Move some postgresql values to where they should be according to the subchart.
|
||||
|
||||
## [4.1.0] - Jul 9, 2020
|
||||
* Update Xray to version `3.6.2` - https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.6.2
|
||||
* Update rabbitmq-ha tag version to 3.8.5-alpine
|
||||
* **IMPORTANT**
|
||||
* Added ChartCenter Helm repository in README
|
||||
|
||||
## [4.0.1] - Jul 3, 2020
|
||||
* Added compatability to support latest 7.x rabbitmq subchart when `rabbitmq.enabled=true`
|
||||
* Update RabbitMQ chart to v7.4.3
|
||||
* **IMPORTANT**
|
||||
* RabbitMQ 7.x chart is [not compatible](https://github.com/bitnami/charts/tree/master/bitnami/rabbitmq#to-700) with previous rabbitmq 6.x chart in Xray 3.x chart
|
||||
* Please refer [here](https://github.com/jfrog/charts/blob/master/stable/xray/README.md#special-upgrade-notes) for upgrade notes
|
||||
|
||||
## [4.0.0] - Jun 26, 2020
|
||||
* Update postgresql tag version to `10.13.0-debian-10-r38`
|
||||
* Update alpine tag version to `3.12`
|
||||
* Update rabbitmq tag version to 3.8.5-debian-10-r14
|
||||
* Update RabbitMQ chart to v7.3.3
|
||||
* Update RabbitMQ-HA chart to v1.46.4
|
||||
* **IMPORTANT**
|
||||
* If this is a new deployment or you already use an external database (`postgresql.enabled=false`), these changes **do not affect you**!
|
||||
* If this is an upgrade and you are using the default PostgreSQL (`postgresql.enabled=true`), you need to pass postgresql.image.tag=9.6.18-debian-10-r7 and databaseUpgradeReady=true
|
||||
|
||||
## [3.5.1] - Jun 25, 2020
|
||||
* Added prestartcommand to router container to match same mechanism in all other xray containers
|
||||
|
||||
## [3.5.0] - Jun 22, 2020
|
||||
* Update Xray to version `3.5.2` - https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.5.2
|
||||
* Update alpine to version `3.12`
|
||||
|
||||
## [3.4.2] - Jun 13, 2020
|
||||
* Adding tpl to customVolumeMounts
|
||||
* Fix `replicaCount` in README.md
|
||||
|
||||
## [3.4.1] - Jun 12, 2020
|
||||
* Fix broken customVolumeMounts
|
||||
|
||||
## [3.4.0] - Jun 1, 2020
|
||||
* Update Xray to version `3.4.0` - https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.4
|
||||
* Added Upgrade Notes in README for 3.x upgrades - https://github.com/jfrog/charts/blob/master/stable/mission-control/README.md#special-upgrade-notes
|
||||
* Update router version to `1.4.0`
|
||||
* Update postgresql tag version to `9.6.18-debian-10-r7`
|
||||
* Added tpl to support external database secrets values
|
||||
* Added custom volumes/volumesMounts under `common`
|
||||
* Removed custom volumes from each specific service
|
||||
* Fixes Broken upgrades of charts - use `kubectl delete statefulsets <old_statefulset_xray_name>` and run helm upgrade
|
||||
|
||||
## [3.3.2] - May 20, 2020
|
||||
* Skip warning in NOTES if `xray.masterKeySecretName` is set
|
||||
|
||||
## [3.3.1] - May 01, 2020
|
||||
* Adding tpl to values to support jfrogUrl
|
||||
|
||||
## [3.3.0] - Apr 28, 2020
|
||||
* Update Xray to version `3.3.0` - https://www.jfrog.com/confluence/display/JFROG/Xray+Release+Notes#XrayReleaseNotes-Xray3.3
|
||||
|
||||
## [3.2.4] - Apr 20, 2020
|
||||
* Adding tpl to xray-statefulset for JF_SHARED_PASSWORD
|
||||
|
||||
## [3.2.3] - Apr 15, 2020
|
||||
* Support existingsecrets for rabbitmq/rabbitmq-ha passwords
|
||||
* Bump router version to `1.3.0`
|
||||
* Bump postgresql tag version to `9.6.17-debian-10-r72` in values.yaml
|
||||
|
||||
## [3.2.2] - Apr 15, 2020
|
||||
* Fix broken rabbitmq support when `rabbitmq.enabled=true`
|
||||
|
||||
## [3.2.1] - Apr 14, 2020
|
||||
* customInitContainer identation template fix
|
||||
|
||||
## [3.2.0] - Apr 13, 2020
|
||||
* Bump RabbitMQ chart to v6.25.2
|
||||
* Bump RabbitMQ-HA chart to v1.44.2
|
||||
|
||||
## [3.1.1] - April 13, 2020
|
||||
* Updated helm v3 commands
|
||||
|
||||
## [3.1.0] - April 10, 2020
|
||||
* Use dependency charts from `https://charts.bitnami.com/bitnami`
|
||||
* Bump postgresql chart version to `8.7.3` in requirements.yaml
|
||||
|
||||
## [3.0.28] - April 8, 2020
|
||||
* Support database credentials as secrets
|
||||
|
||||
## [3.0.27] - April 2, 2020
|
||||
* Support masterKey and joinKey as secrets
|
||||
|
||||
## [3.0.26] - Mar 31, 2020
|
||||
* Update Xray to version `3.2.3`
|
||||
* Bump router to version `1.2.1`
|
||||
|
||||
## [3.0.25] - Mar 31, 2020
|
||||
* README fixes
|
||||
|
||||
## [3.0.24] - Mar 27, 2020
|
||||
* Add support for masterKey as secret
|
||||
|
||||
## [3.0.23] - Mar 23, 2020
|
||||
* Use `postgresqlExtendedConf` for setting custom PostgreSQL configuration (instead of `postgresqlConfiguration`)
|
||||
|
||||
## [3.0.22] - Mar 17, 2020
|
||||
* Changed all single quotes to double quotes in values files
|
||||
|
||||
## [3.0.21] - Mar 12, 2020
|
||||
* Fix for xray pvc
|
||||
|
||||
## [3.0.20] - Mar 11, 2020
|
||||
* Unified charts public release
|
||||
|
||||
## [3.0.19] - Mar 9, 2020
|
||||
* Cleanup `ingress` code + fixes
|
||||
|
||||
## [3.0.18] - Mar 9, 2020
|
||||
* Add default `joinKey` value
|
||||
|
||||
## [3.0.17] - Mar 6, 2020
|
||||
* Cleanup of not needed values
|
||||
* Bump PostgreSQL chart to v8.4.1
|
||||
* Bump RabbitMQ chart to v6.18.1
|
||||
* Bump RabbitMQ-HA chart to v1.41.0
|
||||
|
||||
## [3.0.16] - Mar 4, 2020
|
||||
* Add support for disabling `consoleLog` in `system.yaml` file
|
||||
|
||||
## [3.0.15] - Feb 28, 2020
|
||||
* Fix reference of incorrect key to set external database url from documentation
|
||||
|
||||
## [3.0.14] - Feb 27, 2020
|
||||
* Add an annotation with the checksum of the `system.yaml` file to make sure the pods restart after a configuration change
|
||||
|
||||
## [3.0.13] - Feb 26, 2020
|
||||
* Update Xray to version `3.2.0`
|
||||
|
||||
## [3.0.12] - Feb 24, 2020
|
||||
* Update Xray to version `3.0.1`
|
||||
|
||||
## [1.3.8] - Feb 18, 2020
|
||||
* Update Xray version to 2.11.4
|
||||
|
||||
## [1.3.7] - Feb 13, 2020
|
||||
* Fix Xray README `ingerss.additionalRules` description
|
||||
|
||||
## [1.3.6] - Feb 11, 2020
|
||||
* Add support for `preStartCommand`
|
||||
|
||||
## [1.3.5] - Feb 2, 2020
|
||||
* Add a comment stating that it is recommended to use external databases with a static password for production installations
|
||||
|
||||
## [1.3.4] - Jan 30, 2020
|
||||
* Add the option to configure resources for the logger containers
|
||||
|
||||
## [1.3.3] - Dec 31, 2019
|
||||
* Update Xray version to 2.11.3
|
||||
|
||||
## [1.3.2] - Dec 23, 2019
|
||||
* Mark empty map values with `{}`
|
||||
|
||||
## [1.3.1] - Dec 1, 2019
|
||||
* Added custom volume mounts to the server stateful set
|
||||
* Added custom annotations to the server, indexer, analysis, and persist stateful sets
|
||||
|
||||
## [1.3.0] - Dec 3, 2019
|
||||
* Update Xray version to 2.11.0
|
||||
|
||||
## [1.2.9] - Nov 24, 2019
|
||||
* Fix the Xray probes path
|
||||
|
||||
## [1.2.8] - Nov 21, 2019
|
||||
* Make the Xray probes customisable
|
||||
|
||||
## [1.2.7] - Nov 21, 2019
|
||||
* Prevent probes failing on 403 (Forbidden) - fixes
|
||||
|
||||
## [1.2.6] - Nov 20, 2019
|
||||
* Prevent probes failing on 403 (Forbidden)
|
||||
|
||||
## [1.2.5] - Nov 20, 2019
|
||||
* Update Xray logo
|
||||
|
||||
## [1.2.4] - Nov 7, 2019
|
||||
* Update Xray version to 2.10.7
|
||||
|
||||
## [1.2.3] - Oct 28, 2019
|
||||
* Update Xray version to 2.10.5
|
||||
|
||||
## [1.2.2] - Oct 26, 2019
|
||||
* Update Xray version to 2.10.4
|
||||
|
||||
## [1.2.1] - Oct 7, 2019
|
||||
* Update Xray version to 2.10.1
|
||||
|
||||
## [1.2.0] - Oct 3, 2019
|
||||
* Update Xray version to 2.10.0
|
||||
|
||||
## [1.1.1] - Sep 26, 2019
|
||||
* Add support for running custom init containers before the predefined init containers using `common.customInitContainersBegin`
|
||||
|
||||
## [1.1.0] - Sep 3, 2019
|
||||
* Update Xray version to 2.9.0
|
||||
|
||||
## [1.0.5] - Aug 13, 2019
|
||||
* Add the option to provide a precreated secret for XRAY_MASTER_KEY
|
||||
|
||||
## [1.0.4] - Aug 11, 2019
|
||||
* Add information about Xray ingress additionalRules
|
||||
|
||||
## [1.0.3] - Jul 22, 2019
|
||||
* Change Ingress API to be compatible with recent kubernetes versions
|
||||
|
||||
## [1.0.2] - Jul 15, 2019
|
||||
* Add the option to provide ingress additional rules
|
||||
|
||||
## [1.0.1] - Jul 15, 2019
|
||||
* Updated README.md to the new defaults.
|
||||
|
||||
## [1.0.0] - Jul 9, 2019
|
||||
* Set default server and indexer services persistence to `true`.
|
||||
* **IMPORTANT:**
|
||||
* To upgrade from a previous Xray deployment, you have to pass the `--force` flag to the `helm upgrade` command.
|
||||
* This is mandatory to force the change services persistence to `true`.
|
||||
* This change will recreate the server and indexer pods!
|
||||
* **NOTE:** Don't forget to pass the DBs passwords to the `helm upgrade` if these were auto generated. See [README.md](README.md) for details in the **Upgrade** section.
|
||||
|
||||
## [0.12.17] - Jul 1, 2019
|
||||
* Update Xray version to 2.8.9
|
||||
|
||||
## [0.12.16] - June 25, 2019
|
||||
* Update Xray version to 2.8.8
|
||||
|
||||
## [0.12.15] - June 24, 2019
|
||||
* Update chart maintainers
|
||||
|
||||
## [0.12.14] - June 23, 2019
|
||||
* Add values files for small, medium and large installations
|
||||
|
||||
## [0.12.13] - June 20, 2019
|
||||
* Document the mongoDB resources values suggestion
|
||||
* Fix xray-server service annotation
|
||||
|
||||
## [0.12.12] - June 17, 2019
|
||||
* Optional support for PostgreSQL with TLS
|
||||
|
||||
## [0.12.11] - June 7, 2019
|
||||
* Update Xray version to 2.8.7
|
||||
* Add persistence to Server and Indexer
|
||||
|
||||
## [0.12.10] - May 28, 2019
|
||||
* Update Xray version to 2.8.6
|
||||
|
||||
## [0.12.9] - May 24, 2019
|
||||
* Update stateful set api and add serviceName spec
|
||||
|
||||
## [0.12.8] - May 20, 2019
|
||||
* Fix missing logger image tag
|
||||
|
||||
## [0.12.7] - Apr 16, 2019
|
||||
* Updated Xray version to 2.8.3
|
||||
|
||||
## [0.12.6] - Apr 15, 2019
|
||||
* Updated Xray version to 2.8.2
|
||||
|
||||
## [0.12.5] - May 12, 2019
|
||||
* Updated rabbitmq-ha chart version to 1.26.0
|
||||
|
||||
## [0.12.4] - Apr 15, 2019
|
||||
* Simplify handling connection strings setup in `xray_config.yaml` to better support ampersand in external connection strings
|
||||
* **IMPORTANT:** If using an external connection string for PostgreSQL or MongoDB, **do not escape** the ampersand with `\`
|
||||
|
||||
## [0.12.3] - Apr 15, 2019
|
||||
* Move `skipEntLicCheckForCloud: true` config to be part of default Xray config
|
||||
|
||||
## [0.12.2] - Apr 10, 2019
|
||||
* Added support for customizing the xray_config.yaml file using a configmap
|
||||
|
||||
## [0.12.1] - Apr 9, 2019
|
||||
* Added Xray server service annotations
|
||||
|
||||
## [0.12.0] - Apr 9, 2019
|
||||
* Updated Xray version to 2.8.0
|
||||
|
||||
## [0.11.2] - Apr 7, 2019
|
||||
* Add network policy support
|
||||
|
||||
## [0.11.1] - Mar 26, 2019
|
||||
* Add information about upgrading Xray with auto-generated postgres password
|
||||
|
||||
## [0.11.0] - Mar 26, 2019
|
||||
* Switched to StatefulSets to preserve micro-service Ids
|
||||
|
||||
## [0.10.5] - Mar 18, 2019
|
||||
* Added label selector for Xray ingress
|
||||
|
||||
## [0.10.4] - March 15, 2019
|
||||
* Revert securityContext change that was causing issues
|
||||
|
||||
## [0.10.3] - March 13, 2019
|
||||
* Move securityContext to container level
|
||||
|
||||
## [0.10.2] - March 12, 2019
|
||||
* Updated Xray version to 2.7.3
|
||||
|
||||
## [0.10.1] - March 10, 2019
|
||||
* Updated values.yaml added an important comment for the MongoDB requirements.
|
||||
|
||||
## [0.10.0] - Mar 3, 2019
|
||||
* Support loggers sidecars to tail a configured log
|
||||
|
||||
## [0.9.0] - Feb 14, 2019
|
||||
* Updated Xray version to 2.7.0
|
||||
|
||||
## [0.8.5] - Feb 11, 2019
|
||||
* Add an option to set the indexAllBuilds configuration option in order to index all the builds in artifactory
|
||||
|
||||
## [0.8.4] - Feb 6, 2019
|
||||
* Updated Postgres version to 9.6.11
|
||||
|
||||
## [0.8.3] - Feb 4, 2019
|
||||
* Updated Xray version to 2.6.3
|
||||
|
||||
## [0.8.2] - Jan 24, 2019
|
||||
* Added missing documentation about using `mongodb.enabled=false` when using external MongoDB
|
||||
|
||||
## [0.8.1] - Jan 22, 2019
|
||||
* Added support for `common.customInitContainers` to create custom init containers
|
||||
|
||||
## [0.8.0] - Jan 1, 2019
|
||||
* Updated Xray version to 2.6.0
|
||||
|
||||
## [0.7.8] - Dec 18, 2018
|
||||
* Fix for 0.7.7 (Improve server health probes to support GKE ingress controller. Fixes https://github.com/jfrog/charts/issues/149)
|
||||
|
||||
## [0.7.7] - Dec 18, 2018
|
||||
* Improve server health probes to support GKE ingress controller. Fixes https://github.com/jfrog/charts/issues/149
|
||||
|
||||
## [0.7.6] - Dec 11, 2018
|
||||
* Using secret for external databases. Fixes https://github.com/jfrog/charts/issues/73
|
||||
|
||||
## [0.7.5] - Nov 14, 2018
|
||||
* Fix bad example in [README.md]. Fixes https://github.com/jfrog/charts/issues/127.
|
||||
|
||||
## [0.7.4] - Nov 14, 2018
|
||||
* Fix indent of `nodeSelector`, `affinity` and `tolerations` in the templates
|
||||
|
||||
## [0.7.3] - Nov 11, 2018
|
||||
* Updated Xray version to 2.4.6
|
||||
|
||||
## [0.7.2] - Nov 4, 2018
|
||||
* Replace POSTGRESS_ with POSTGRES_ (remove double S)
|
||||
|
||||
## [0.7.1] - Oct 30, 2018
|
||||
* Updated Xray version to 2.4.2
|
||||
|
||||
## [0.7.0] - Oct 29, 2018
|
||||
* Update postgresql chart to version 0.9.5 to be able and use `postgresConfig` options
|
||||
|
||||
## [0.6.3] - Oct 17, 2018
|
||||
* Add Apache 2.0 license
|
||||
|
||||
## [0.6.2] - Oct 16, 2018
|
||||
* Updated Xray version to 2.4.1
|
||||
|
||||
## [0.6.1] - Oct 11, 2018
|
||||
* Allows ingress default `backend` to be enabled or disabled (defaults to enabled)
|
||||
* Allows rabbitmq to be used instead of rabbitmq-ha by settings rabbitmq-ha.enabled: false and rabbitmq.enabled: true
|
||||
|
||||
## [0.6.0] - Oct 11, 2018
|
||||
* Updated Xray version to 2.4.0
|
||||
|
||||
## [0.5.6] - Oct 9, 2018
|
||||
* Quote ingress hosts to support wildcard names
|
||||
|
||||
## [0.5.5] - Oct 2, 2018
|
||||
* Add `helm repo add jfrog https://charts.jfrog.io` to README
|
||||
|
||||
## [0.5.4] - Sep 30, 2018
|
||||
* Add pods nodeSelector, affinity and tolerations
|
||||
|
||||
## [0.5.3] - Sep 26, 2018
|
||||
* Updated Xray version to 2.3.3
|
||||
|
||||
## [0.5.1] - Sep 13, 2018
|
||||
* Per service replica count
|
||||
|
||||
## [0.5.0] - Sep 3, 2018
|
||||
* New RabbitMQ HA helm chart version 1.9.1
|
||||
* Updated Xray version to 2.3.2
|
||||
|
||||
## [0.4.1] - Aug 22, 2018
|
||||
* Updated Xray version to 2.3.0
|
||||
|
||||
## [0.4.0] - Aug 22, 2018
|
||||
* Enabled RBAC support
|
||||
* Added ingress support
|
||||
* Updated Xray version to 2.2.4
|
||||
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
appVersion: 3.14.3
|
||||
description: Universal component scan for security and license inventory and impact
|
||||
analysis
|
||||
home: https://www.jfrog.com/xray/
|
||||
icon: https://raw.githubusercontent.com/jfrog/charts/master/stable/xray/logo/xray-logo.png
|
||||
keywords:
|
||||
- xray
|
||||
- jfrog
|
||||
maintainers:
|
||||
- email: installers@jfrog.com
|
||||
name: Chart Maintainers at JFrog
|
||||
name: xray
|
||||
sources:
|
||||
- https://bintray.com/jfrog/product/xray/view
|
||||
- https://github.com/jfrog/charts
|
||||
version: 6.8.3
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,349 @@
|
||||
# JFrog Xray HA on Kubernetes Helm Chart
|
||||
|
||||
**Heads up: Our Helm Chart docs are moving to our main documentation site. For Xray installers, see [Installing Xray](https://www.jfrog.com/confluence/display/JFROG/Installing+Xray).**
|
||||
|
||||
## Prerequisites Details
|
||||
|
||||
* Kubernetes 1.12+
|
||||
|
||||
## Chart Details
|
||||
|
||||
This chart will do the following:
|
||||
|
||||
* Optionally deploy PostgreSQL (**NOTE:** For production grade installations it is recommended to use an external PostgreSQL)
|
||||
* Deploy RabbitMQ (optionally as an HA cluster)
|
||||
* Deploy JFrog Xray micro-services
|
||||
|
||||
## Requirements
|
||||
|
||||
- A running Kubernetes cluster
|
||||
- Dynamic storage provisioning enabled
|
||||
- Default StorageClass set to allow services using the default StorageClass for persistent storage
|
||||
- A running Artifactory
|
||||
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed and setup to use the cluster
|
||||
- [Helm](https://helm.sh/) v2 or v3 installed
|
||||
|
||||
|
||||
## Install JFrog Xray
|
||||
|
||||
### Add ChartCenter Helm repository
|
||||
|
||||
Before installing JFrog helm charts, you need to add the [ChartCenter helm repository](https://chartcenter.io) to your helm client.
|
||||
|
||||
```bash
|
||||
helm repo add center https://repo.chartcenter.io
|
||||
helm repo update
|
||||
```
|
||||
|
||||
### Install Chart
|
||||
|
||||
#### Artifactory Connection Details
|
||||
|
||||
In order to connect Xray to your Artifactory installation, you have to use a Join Key, hence it is *MANDATORY* to provide a Join Key and Jfrog Url to your Xray installation. Here's how you do that:
|
||||
|
||||
Retrieve the connection details of your Artifactory installation, from the UI - https://www.jfrog.com/confluence/display/JFROG/General+Security+Settings#GeneralSecuritySettings-ViewingtheJoinKey.
|
||||
|
||||
#### Initiate Installation
|
||||
|
||||
Provide join key and jfrog url as a parameter to the Xray chart installation:
|
||||
|
||||
```bash
|
||||
helm upgrade --install xray --set xray.joinKey=<YOUR_PREVIOUSLY_RETIREVED_JOIN_KEY> \
|
||||
--set xray.jfrogUrl=<YOUR_PREVIOUSLY_RETIREVED_BASE_URL> --namespace xray center/jfrog/xray
|
||||
```
|
||||
|
||||
Alternatively, you can create a secret containing the join key manually and pass it to the template at install/upgrade time.
|
||||
```bash
|
||||
|
||||
# Create a secret containing the key. The key in the secret must be named join-key
|
||||
kubectl create secret generic my-secret --from-literal=join-key=<YOUR_PREVIOUSLY_RETIREVED_JOIN_KEY>
|
||||
|
||||
# Pass the created secret to helm
|
||||
helm upgrade --install --set xray.joinKeySecretName=my-secret --namespace xray center/jfrog/xray
|
||||
```
|
||||
**NOTE:** In either case, make sure to pass the same join key on all future calls to `helm install` and `helm upgrade`! This means always passing `--set xray.joinKey=<YOUR_PREVIOUSLY_RETIREVED_JOIN_KEY>`. In the second, this means always passing `--set xray.joinKeySecretName=my-secret` and ensuring the contents of the secret remain unchanged.
|
||||
|
||||
### Special Upgrade Notes
|
||||
Xray 2.x to 3.x (App Version) is not directly supported.For manual upgrade, Please refer [here](https://github.com/jfrog/charts/blob/master/stable/xray/UPGRADE_NOTES.md). If this is an upgrade over an existing Xray 3.x (App Version), explicitly pass `--set unifiedUpgradeAllowed=true` to upgrade.
|
||||
|
||||
While upgrading from Xray 3.x to 3.x charts due to breaking changes, use `kubectl delete statefulsets <old_statefulset_xray_name>` and run helm upgrade
|
||||
|
||||
Also, While upgrading from Xray 3.x to 4.x charts due to breaking rabbitmq (when `rabbitmq.enabled=true`) subchart changes,
|
||||
|
||||
```bash
|
||||
$ kubectl delete statefulsets <old_statefulset_xray_name>
|
||||
$ kubectl delete statefulsets <old_statefulset_rabbitmq_name>
|
||||
$ kubectl delete pvc <old_PVC_rabbitmq_name>
|
||||
$ helm upgrade --install xray --namespace xray center/jfrog/xray
|
||||
```
|
||||
|
||||
### System Configuration
|
||||
|
||||
Xray uses a common system configuration file - `system.yaml`. See [official documentation](https://www.jfrog.com/confluence/display/JFROG/System+YAML+Configuration+File) on its usage.
|
||||
|
||||
## Status
|
||||
|
||||
See the status of your deployed **helm** releases
|
||||
|
||||
```bash
|
||||
helm status xray
|
||||
```
|
||||
|
||||
## Upgrade
|
||||
To upgrade an existing Xray, you still use **helm**
|
||||
|
||||
```bash
|
||||
# Update existing deployed version to 3.6.2
|
||||
helm upgrade --set common.xrayVersion=3.6.2 center/jfrog/xray
|
||||
```
|
||||
|
||||
If Xray was installed without providing a value to postgresql.postgresqlPassword (a password was autogenerated), follow these instructions:
|
||||
1. Get the current password by running:
|
||||
|
||||
```bash
|
||||
POSTGRES_PASSWORD=$(kubectl get secret -n <namespace> <myrelease>-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
|
||||
```
|
||||
|
||||
2. Upgrade the release by passing the previously auto-generated secret:
|
||||
|
||||
```bash
|
||||
helm upgrade <myrelease> center/jfrog/xray --set postgresql.postgresqlPassword=${POSTGRES_PASSWORD}
|
||||
```
|
||||
|
||||
If Xray was installed without providing a value to rabbitmq.rabbitmqPassword/rabbitmq-ha.rabbitmqPassword (a password was autogenerated), follow these instructions:
|
||||
1. Get the current password by running:
|
||||
|
||||
```bash
|
||||
RABBITMQ_PASSWORD=$(kubectl get secret -n <namespace> <myrelease>-rabbitmq -o jsonpath="{.data.rabbitmq-password}" | base64 --decode)
|
||||
```
|
||||
|
||||
2. Upgrade the release by passing the previously auto-generated secret:
|
||||
|
||||
```bash
|
||||
helm upgrade <myrelease> center/jfrog/xray --set rabbitmq.rabbitmqPassword=${RABBITMQ_PASSWORD}/rabbitmq-ha.rabbitmqPassword=${RABBITMQ_PASSWORD}
|
||||
```
|
||||
|
||||
If Xray was installed with all of the default values (e.g. with no user-provided values for rabbit/postgres), follow these steps:
|
||||
1. Retrieve all current passwords (rabbitmq/postgresql) as explained in the above section.
|
||||
2. Upgrade the release by passing the previously auto-generated secrets:
|
||||
|
||||
```bash
|
||||
helm upgrade --install xray --namespace xray center/jfrog/xray --set rabbitmq-ha.rabbitmqPassword=<rabbit-password> --set postgresql.postgresqlPassword=<postgresql-password>
|
||||
```
|
||||
|
||||
## Remove
|
||||
|
||||
Removing a **helm** release is done with
|
||||
|
||||
```bash
|
||||
# Remove the Xray services and data tools
|
||||
|
||||
#On helm v2:
|
||||
helm delete --purge xray
|
||||
|
||||
#On helm v3:
|
||||
helm delete xray --namespace xray
|
||||
|
||||
# Remove the data disks
|
||||
kubectl delete pvc -l release=xray
|
||||
```
|
||||
|
||||
### Deploying Xray for small/medium/large instllations
|
||||
In the chart directory, we have added three values files, one for each installation type - small/medium/large. These values files are recommendations for setting resources requests and limits for your installation. The values are derived from the following [documentation](https://www.jfrog.com/confluence/display/EP/Installing+on+Kubernetes#InstallingonKubernetes-Systemrequirements). You can find them in the corresponding chart directory - values-small.yaml, values-medium.yaml and values-large.yaml
|
||||
|
||||
### Create a unique Master Key
|
||||
|
||||
JFrog Xray requires a unique master key to be used by all micro-services in the same cluster. By default the chart has one set in values.yaml (`xray.masterKey`).
|
||||
|
||||
**This key is for demo purpose and should not be used in a production environment!**
|
||||
|
||||
You should generate a unique one and pass it to the template at install/upgrade time.
|
||||
|
||||
```bash
|
||||
# Create a key
|
||||
export MASTER_KEY=$(openssl rand -hex 32)
|
||||
echo ${MASTER_KEY}
|
||||
|
||||
# Pass the created master key to helm
|
||||
helm upgrade --install xray --set xray.masterKey=${MASTER_KEY} --namespace xray center/jfrog/xray
|
||||
|
||||
```
|
||||
|
||||
Alternatively, you can create a secret containing the master key manually and pass it to the template at install/upgrade time.
|
||||
```bash
|
||||
# Create a key
|
||||
export MASTER_KEY=$(openssl rand -hex 32)
|
||||
echo ${MASTER_KEY}
|
||||
|
||||
# Create a secret containing the key. The key in the secret must be named master-key
|
||||
kubectl create secret generic my-secret --from-literal=master-key=${MASTER_KEY}
|
||||
|
||||
# Pass the created secret to helm
|
||||
helm upgrade --install xray --set xray.masterKeySecretName=my-secret --namespace xray center/jfrog/xray
|
||||
```
|
||||
**NOTE:** In either case, make sure to pass the same master key on all future calls to `helm install` and `helm upgrade`! In the first case, this means always passing `--set xray.masterKey=${MASTER_KEY}`. In the second, this means always passing `--set xray.masterKeySecretName=my-secret` and ensuring the contents of the secret remain unchanged.
|
||||
|
||||
|
||||
## Special deployments
|
||||
This is a list of special use cases for non-standard deployments
|
||||
|
||||
### High Availability
|
||||
|
||||
For **high availability** of Xray, set the replica count to be equal or higher than **2**. Recommended is **3**.
|
||||
> It is highly recommended to also set **RabbitMQ** to run as an HA cluster.
|
||||
|
||||
```bash
|
||||
# Start Xray with 3 replicas per service and 3 replicas for RabbitMQ
|
||||
helm upgrade --install xray --namespace xray --set replicaCount=3 --set rabbitmq-ha.replicaCount=3 center/jfrog/xray
|
||||
```
|
||||
|
||||
### External Databases
|
||||
There is an option to use external PostgreSQL database for your Xray.
|
||||
|
||||
#### PostgreSQL
|
||||
|
||||
##### PostgreSQL without TLS
|
||||
|
||||
To use an external **PostgreSQL**, you need to disable the use of the bundled **PostgreSQL** and set a custom **PostgreSQL** connection URL.
|
||||
|
||||
For this, pass the parameters: `postgresql.enabled=false` and `database.url=${XRAY_POSTGRESQL_CONN_URL}`.
|
||||
|
||||
**IMPORTANT:** Make sure the DB is already created before deploying Xray services
|
||||
|
||||
```bash
|
||||
# Passing a custom PostgreSQL to Xray
|
||||
|
||||
# Example
|
||||
export POSTGRESQL_HOST=custom-postgresql-host
|
||||
export POSTGRESQL_PORT=5432
|
||||
export POSTGRESQL_USER=xray
|
||||
export POSTGRESQL_PASSWORD=password2_X
|
||||
export POSTGRESQL_DATABASE=xraydb
|
||||
|
||||
export XRAY_POSTGRESQL_CONN_URL="postgres://${POSTGRESQL_HOST}:${POSTGRESQL_PORT}/${POSTGRESQL_DATABASE}?sslmode=disable"
|
||||
helm upgrade --install xray --namespace xray \
|
||||
--set postgresql.enabled=false \
|
||||
--set database.url="${XRAY_POSTGRESQL_CONN_URL}" \
|
||||
--set database.user="${POSTGRESQL_USER}" \
|
||||
--set database.password="${POSTGRESQL_PASSWORD}" \
|
||||
jfrog/xray
|
||||
```
|
||||
|
||||
##### PostgreSQL with TLS
|
||||
If external **PostgreSQL** is set with TLS, you need to disable the use of the bundled **PostgreSQL**, set a custom **PostgreSQL** connection URL and provide a secret with **PostgreSQL** TLS certificates.
|
||||
|
||||
Create the Kubernetes secret (assuming the local files are `client-cert.pem client-key.pem server-ca.pem`)
|
||||
|
||||
```bash
|
||||
kubectl create secret generic postgres-tls --from-file=client-key.pem --from-file=client-cert.pem --from-file=server-ca.pem
|
||||
|
||||
```
|
||||
|
||||
**IMPORTANT:** `PostgreSQL` connection URL needs to have listed TLS files with the path `/var/opt/jfrog/xray/data/tls/`
|
||||
and `sslmode==verify-ca` otherwise Xray will fail to connect to Postgres.
|
||||
|
||||
```bash
|
||||
# Passing a custom PostgreSQL with TLS to Xray
|
||||
|
||||
# Example
|
||||
export POSTGRESQL_HOST=custom-postgresql-host
|
||||
export POSTGRESQL_PORT=5432
|
||||
export POSTGRESQL_USER=xray
|
||||
export POSTGRESQL_PASSWORD=password2_X
|
||||
export POSTGRESQL_DATABASE=xraydb
|
||||
export POSTGRESQL_SERVER_CA=server-ca.pem
|
||||
export POSTGRESQL_CLIENT_CERT=client-key.pem
|
||||
export POSTGRESQL_CLIENT_KEY=client-cert.pem
|
||||
export POSTGRESQL_TLS_SECRET=postgres-tls
|
||||
|
||||
export XRAY_POSTGRESQL_CONN_URL="postgres://${POSTGRESQL_HOST}:${POSTGRESQL_PORT}/${POSTGRESQL_DATABASE}?sslrootcert=/var/opt/jfrog/xray/data/tls/${POSTGRESQL_SERVER_CA}&sslkey=/var/opt/jfrog/xray/data/tls/${POSTGRESQL_CLIENT_KEY}&sslcert=/var/opt/jfrog/xray/data/tls/${POSTGRESQL_CLIENT_CERT}&sslmode=verify-ca"
|
||||
helm upgrade --install xray --namespace xray \
|
||||
--set postgresql.enabled=false \
|
||||
--set database.url="${XRAY_POSTGRESQL_CONN_URL}" \
|
||||
--set database.user="${POSTGRESQL_USER}" \
|
||||
--set database.password="${POSTGRESQL_PASSWORD}" \
|
||||
jfrog/xray
|
||||
```
|
||||
|
||||
### Custom init containers
|
||||
|
||||
There are cases where a special, unsupported init processes is needed like checking something on the file system or testing something before spinning up the main container.
|
||||
|
||||
For this, there is a section for writing custom init containers before and after the predefined init containers in the [values.yaml](values.yaml) . By default it's commented out
|
||||
|
||||
```yaml
|
||||
common:
|
||||
## Add custom init containers executed before predefined init containers
|
||||
customInitContainersBegin: |
|
||||
## Init containers template goes here ##
|
||||
|
||||
## Add custom init containers executed after predefined init containers
|
||||
customInitContainers: |
|
||||
## Init containers template goes here ##
|
||||
```
|
||||
|
||||
### Custom sidecar containers
|
||||
There are cases where an extra sidecar container is needed. For example monitoring agents or log collection.
|
||||
|
||||
For this, there is a section for writing a custom sidecar container in the [values.yaml](values.yaml). By default it's commented out
|
||||
```yaml
|
||||
common:
|
||||
## Add custom sidecar containers
|
||||
customSidecarContainers: |
|
||||
## Sidecar containers template goes here ##
|
||||
```
|
||||
|
||||
### Establishing TLS and Adding certificates
|
||||
Create trust between the nodes by copying the ca.crt from the Artifactory server under $JFROG_HOME/artifactory/var/etc/access/keys to of the nodes you would like to set trust with under $JFROG_HOME/<product>/var/etc/security/keys/trusted. For more details, Please refer [here](https://www.jfrog.com/confluence/display/JFROG/Managing+TLS+Certificates).
|
||||
|
||||
|
||||
To add this certificate to xray, Create a configmaps.yaml file with the following content:
|
||||
|
||||
```yaml
|
||||
common:
|
||||
configMaps: |
|
||||
ca.crt: |
|
||||
-----BEGIN CERTIFICATE-----
|
||||
<certificate content>
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
customVolumeMounts: |
|
||||
- name: xray-configmaps
|
||||
mountPath: /tmp/ca.crt
|
||||
subPath: ca.crt
|
||||
|
||||
server:
|
||||
preStartCommand: "mkdir -p {{ .Values.xray.persistence.mountPath }}/etc/security/keys/trusted && cp -fv /tmp/ca.crt {{ .Values.xray.persistence.mountPath }}/etc/security/keys/trusted/ca.crt"
|
||||
router:
|
||||
tlsEnabled: true
|
||||
```
|
||||
|
||||
and use it with you helm install/upgrade:
|
||||
```bash
|
||||
helm upgrade --install xray -f configmaps.yaml --namespace xray center/jfrog/xray
|
||||
```
|
||||
|
||||
This will, in turn:
|
||||
* Create a configMap with the files you specified above
|
||||
* Create a volume pointing to the configMap with the name `xray-configmaps`
|
||||
* Mount said configMap onto `/tmp` using a `customVolumeMounts`
|
||||
* Using preStartCommand copy the `ca.crt` file to xray trusted keys folder `/etc/security/keys/trusted/ca.crt`
|
||||
* `router.tlsEnabled` is set to true to add HTTPS scheme in liveness and readiness probes.
|
||||
|
||||
### Custom volumes
|
||||
|
||||
If you need to use a custom volume in a custom init or sidecar container, you can use this option.
|
||||
|
||||
For this, there is a section for defining custom volumes in the [values.yaml](values.yaml). By default it's commented out
|
||||
|
||||
```yaml
|
||||
server:
|
||||
## Add custom volumes
|
||||
customVolumes: |
|
||||
## Custom volume comes here ##
|
||||
```
|
||||
|
||||
## Useful links
|
||||
- https://www.jfrog.com/confluence/display/XRAY/Xray+High+Availability
|
||||
- https://www.jfrog.com/confluence/display/EP/Getting+Started
|
||||
- https://www.jfrog.com/confluence/
|
||||
@@ -0,0 +1,181 @@
|
||||
# JFrog Xray Chart Upgrade Notes
|
||||
This file describes special upgrade notes needed at specific versions
|
||||
|
||||
## Upgrade from 1.x/2.x to 3.x and above (Chart Versions)
|
||||
* JFrog Xray v3.x is only compatible with JFrog Artifactory v7.x To upgrade, you must first install JFrog Artifactory 7.x
|
||||
* To upgrade from a version prior to 1.x, you first need to upgrade to latest version of 1.x as described in https://github.com/jfrog/charts/blob/master/stable/xray/CHANGELOG.md.
|
||||
* To upgrade from a version of 2.x, you first need to upgrade to the latest version of 2.x as described in https://github.com/jfrog/charts/blob/pre-unified-platform/stable/xray/CHANGELOG.md.
|
||||
|
||||
**DOWNTIME IS REQUIRED FOR AN UPGRADE!**
|
||||
### For 1.x to 3.x and above
|
||||
* PostgreSQL sub chart was upgraded to version `8.x.x`. This version is not backward compatible with the old version (`0.9.5`)!
|
||||
* Note the following **PostgreSQL** Helm chart changes
|
||||
* The chart configuration has changed! See [values.yaml](values.yaml) for the new keys used
|
||||
* **PostgreSQL** is deployed as a StatefulSet
|
||||
* See [PostgreSQL helm chart](https://hub.helm.sh/charts/stable/postgresql) for all available configurations
|
||||
* Due to breaking changes in the **PostgreSQL** Helm chart, a migration of the database is needed from the old to the new database
|
||||
* Follow the upgrade process to proceed with the upgrade
|
||||
|
||||
### For 2.x to 3.x and above
|
||||
* From version 3.x, the MongoDB is not used by Xray. Helm upgrade is not possible as mongodb subchart is not there in xray 3.x charts. The solution is to create a new release of xray 3.x and do the migration steps.
|
||||
* Follow the upgrade process to proceed with the upgrade
|
||||
|
||||
## Upgrade process
|
||||
* The recommended migration process has 2 Main steps 1.Existing MongoDB data to Existing Postgresql 2.Full DB export and import of Postgresql
|
||||
* Upgrade steps:
|
||||
1. Prerequisite step to get details of existing chart\
|
||||
a. Block user access to Xray (do not shutdown).\
|
||||
b. Obtain the service names (OLD_PG_SERVICE_NAME, OLD_MONGO_SERVICE_NAME) using below command\
|
||||
Example: OLD_PG_SERVICE_NAME and OLD_MONGO_SERVICE_NAME values are `<OLD_RELEASE_NAME>-postgresql` and `<OLD_RELEASE_NAME>-mongodb` respectively
|
||||
```bash
|
||||
$ kubectl get svc
|
||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
<OLD_RELEASE_NAME>-mongodb ClusterIP 10.101.56.69 <none> 27017/TCP 114m
|
||||
<OLD_RELEASE_NAME>-postgresql ClusterIP 10.101.250.74 <none> 5432/TCP 114m
|
||||
<OLD_RELEASE_NAME>-rabbitmq-ha ClusterIP None <none> 15672/TCP,5672/TCP,4369/TCP 114m
|
||||
<OLD_RELEASE_NAME>-rabbitmq-ha-discovery ClusterIP None <none> 15672/TCP,5672/TCP,4369/TCP 114m
|
||||
<OLD_RELEASE_NAME>-xray-analysis ClusterIP 10.104.138.63 <none> 7000/TCP 114m
|
||||
<OLD_RELEASE_NAME>-xray-indexer ClusterIP 10.106.72.163 <none> 7002/TCP 114m
|
||||
<OLD_RELEASE_NAME>-xray-persist ClusterIP 10.103.20.33 <none> 7003/TCP 114m
|
||||
<OLD_RELEASE_NAME>-xray-server LoadBalancer 10.105.121.175 <pending> 80:32326/TCP 114m
|
||||
```
|
||||
c. Keep the previous passwords (OLD_PG_PASSWORD, OLD_MONGO_PASSWORD) or Extract them from the secret of the existing postgresql and mongoDB pods
|
||||
Example:
|
||||
```bash
|
||||
OLD_PG_PASSWORD=$(kubectl get secret -n <namespace> <OLD_RELEASE_NAME>-postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode)
|
||||
OLD_MONGO_PASSWORD=$(kubectl get secret -n <namespace> <OLD_RELEASE_NAME>-mongodb -o jsonpath="{.data.mongodb-password}" | base64 --decode)
|
||||
```
|
||||
d. Stop old Xray pods (scale down replicas to 0). Postgresql and MongoDB pods still exists
|
||||
```bash
|
||||
$ kubectl scale statefulsets <REPLACE_OLD_RELEASE_NAME>-rabbitmq-ha <REPLACE_OLD_RELEASE_NAME>-xray-analysis <REPLACE_OLD_RELEASE_NAME>-xray-indexer <REPLACE_OLD_RELEASE_NAME>-xray-persist <REPLACE_OLD_RELEASE_NAME>-xray-server --replicas=0
|
||||
```
|
||||
2. To Migrate MongoDB data to Postgres - Run the `helm install` (not upgrade) with the `new version`say `xray-new` with\
|
||||
a. All Probes disabled
|
||||
```bash
|
||||
--set router.livenessProbe.enabled=false --set router.readinessProbe.enabled=false --set indexer.livenessProbe.enabled=false --set analysis.livenessProbe.enabled=false --set server.livenessProbe.enabled=false --set persist.livenessProbe.enabled=false --set indexer.readinessProbe.enabled=false --set analysis.readinessProbe.enabled=false --set server.readinessProbe.enabled=false --set persist.readinessProbe.enabled=false
|
||||
```
|
||||
b. Pointing to previous PostgreSQL pod (user, password,DATABASE)
|
||||
```bash
|
||||
--set postgresql.enabled=false --set database.user=<OLD_PG_USERNAME> --set database.password=<OLD_PG_PASSWORD> --set database.url="postgres://<SERVICE_NAME_POSTGRES>:5432/xraydb?sslmode=disable"
|
||||
```
|
||||
c. Pointing to previous MongoDB (user, password,DATABASE) pod
|
||||
```bash
|
||||
--set xray.mongoUsername=<OLD_MONGO_USERNAME> --set xray.mongoPassword=<OLD_MONGO_PASSWORD> --set xray.mongoUrl="mongodb://<SERVICE_NAME_MONGODB>:27017/?authSource=xray&authMechanism=SCRAM-SHA-1"
|
||||
```
|
||||
d. It will trigger the migration process\
|
||||
Example:
|
||||
```yaml
|
||||
# Create a customvalues.yaml file
|
||||
router:
|
||||
livenessProbe:
|
||||
enabled: false
|
||||
readinessProbe:
|
||||
enabled: false
|
||||
indexer:
|
||||
livenessProbe:
|
||||
enabled: false
|
||||
readinessProbe:
|
||||
enabled: false
|
||||
analysis:
|
||||
livenessProbe:
|
||||
enabled: false
|
||||
readinessProbe:
|
||||
enabled: false
|
||||
server:
|
||||
livenessProbe:
|
||||
enabled: false
|
||||
readinessProbe:
|
||||
enabled: false
|
||||
persist:
|
||||
livenessProbe:
|
||||
enabled: false
|
||||
readinessProbe:
|
||||
enabled: false
|
||||
postgresql:
|
||||
enabled: false
|
||||
database:
|
||||
user: <OLD_PG_USERNAME>
|
||||
password: <OLD_PG_PASSWORD>
|
||||
url: "postgres://<SERVICE_NAME_POSTGRES>:5432/xraydb?sslmode=disable"
|
||||
xray:
|
||||
mongoUsername: <OLD_MONGO_USERNAME>
|
||||
mongoPassword: <OLD_MONGO_PASSWORD>
|
||||
mongoUrl: "mongodb://<SERVICE_NAME_MONGODB>:27017/?authSource=xray&authMechanism=SCRAM-SHA-1"
|
||||
masterKey: <PREVIOUS_MASTER_KEY>
|
||||
jfrogUrl: <NEW_ARTIFACTORY_URL>
|
||||
joinKey: <JOIN_KEY>
|
||||
rabbitmq:
|
||||
enabled: true
|
||||
auth:
|
||||
password: <PASSWORD>
|
||||
rabbitmq-ha:
|
||||
enabled: false
|
||||
```
|
||||
```bash
|
||||
# Apply the values file during install
|
||||
helm upgrade --install xray-new center/jfrog/xray -f customvalues.yaml
|
||||
```
|
||||
3. Stop new Xray pods (scale down replicas to 0). Both Postgresql pods still exists
|
||||
```yaml
|
||||
# Create a customvalues.yaml file
|
||||
replicaCount: 0
|
||||
postgresql:
|
||||
postgresqlPassword: <NEW_PG_PASSWORD>
|
||||
rabbitmq:
|
||||
enabled: true
|
||||
auth:
|
||||
password: <PASSWORD>
|
||||
rabbitmq-ha:
|
||||
enabled: false
|
||||
xray:
|
||||
masterKey: <PREVIOUS_MASTER_KEY>
|
||||
jfrogUrl: <NEW_ARTIFACTORY_URL>
|
||||
joinKey: <JOIN_KEY>
|
||||
unifiedUpgradeAllowed: true
|
||||
databaseUpgradeReady: true
|
||||
```
|
||||
```bash
|
||||
# Apply the values file during install
|
||||
helm upgrade --install xray-new center/jfrog/xray -f customvalues.yaml
|
||||
```
|
||||
4. To Migrate Postgresql data between old and new pods\
|
||||
a. Connect to the new PostgreSQL pod (you can obtain the name by running kubectl get pods)
|
||||
```bash
|
||||
$ kubectl exec -it <NAME> bash
|
||||
```
|
||||
b. Once logged in, create a dump file from the previous database using pg_dump, connect to previous postgresql chart:\
|
||||
```bash
|
||||
$ pg_dump -h <OLD_PG_SERVICE_NAME> -U xray DATABASE_NAME > /tmp/backup.sql
|
||||
```
|
||||
c. After you ran above command you should be prompted for a password, this password is the previous chart password (OLD_PG_PASSWORD). This operation could take some time depending on the database size.\
|
||||
d. Once you have the backup file, you can restore it with a command like the one below:\
|
||||
```bash
|
||||
$ psql -U xray DATABASE_NAME < /tmp/backup.sql
|
||||
```
|
||||
e. After run above command you should be prompted for a password, this is current chart password.This operation could take some time depending on the database size.
|
||||
5. Run the Upgrade final time which would start xray.\
|
||||
Example :
|
||||
```yaml
|
||||
# Create a customvalues.yaml file
|
||||
xray:
|
||||
masterKey: <PREVIOUS_MASTER_KEY>
|
||||
jfrogUrl: <NEW_ARTIFACTORY_URL>
|
||||
joinKey: <JOIN_KEY>
|
||||
rabbitmq:
|
||||
enabled: true
|
||||
auth:
|
||||
password: <PASSWORD>
|
||||
rabbitmq-ha:
|
||||
enabled: false
|
||||
postgresql:
|
||||
postgresqlPassword: <NEW_PG_PASSWORD>
|
||||
unifiedUpgradeAllowed: true
|
||||
databaseUpgradeReady: true
|
||||
```
|
||||
```bash
|
||||
# Apply the values file during install
|
||||
helm upgrade --install xray-new center/jfrog/xray -f customvalues.yaml
|
||||
```
|
||||
6. Restore access to new Xray
|
||||
7. Run `helm delete <OLD_RELEASE_NAME>` which will remove remove old Xray deployment and Helm release.
|
||||
* Xray should now be ready to get back to normal operation
|
||||
@@ -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
|
||||
@@ -0,0 +1,24 @@
|
||||
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.
|
||||
home: https://www.postgresql.org/
|
||||
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
|
||||
version: 9.3.4
|
||||
@@ -0,0 +1,680 @@
|
||||
# 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.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-postgres-password` which is the password for `postgresqlUsername` when it is different of `postgres`, `postgresql-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)` |
|
||||
| `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` |
|
||||
| `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.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.enabled` | Enable security context | `true` |
|
||||
| `securityContext.fsGroup` | Group ID for the container | `1001` |
|
||||
| `securityContext.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.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` |
|
||||
|
||||
|
||||
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 `securityContext.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,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;
|
||||
```
|
||||
@@ -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,21 @@
|
||||
annotations:
|
||||
category: Infrastructure
|
||||
apiVersion: v1
|
||||
appVersion: 0.6.2
|
||||
description: A Library Helm Chart for grouping common logic between bitnami charts.
|
||||
This chart is not deployable by itself.
|
||||
home: http://www.bitnami.com/
|
||||
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
|
||||
version: 0.6.2
|
||||
@@ -0,0 +1,274 @@
|
||||
# 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.
|
||||
|
||||
**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 |
|
||||
|
||||
**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 |
|
||||
|
||||
**Storage**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.storage.class` | Return the proper Storage Class | `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 `.` |
|
||||
|
||||
**Capabilities**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context |
|
||||
| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart 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` | When a chart is using `bitnami/mariadb` as subchart you should use this to validate required password are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "context" $` |
|
||||
| `common.validations.values.postgresql.passwords` | This helper will ensure required password 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. |
|
||||
|
||||
**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" $` |
|
||||
|
||||
**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" $` |
|
||||
|
||||
**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. |
|
||||
|
||||
## 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 possiblity 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**
|
||||
|
||||
```
|
||||
{{- $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,22 @@
|
||||
{{/* 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 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 = cat $name .defaultNameSuffix -}}
|
||||
{{- 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,26 @@
|
||||
{{/* 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 -}}
|
||||
@@ -0,0 +1,219 @@
|
||||
{{/* 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" -}}
|
||||
{{- $valueKeyArray := splitList "." .valueKey -}}
|
||||
{{- $value := "" -}}
|
||||
{{- $latestObj := $.context.Values -}}
|
||||
{{- range $valueKeyArray -}}
|
||||
{{- if not $latestObj -}}
|
||||
{{- printf "please review the entire path of '%s' exists in values" $.valueKey | fail -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $value = ( index $latestObj . ) -}}
|
||||
{{- $latestObj = $value -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- 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 a mariadb required password must not be empty.
|
||||
|
||||
Usage:
|
||||
{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "context" $) }}
|
||||
|
||||
Validate value params:
|
||||
- secret - String - Required. Name of the secret where mysql values are stored, e.g: "mysql-passwords-secret"
|
||||
*/}}
|
||||
{{- define "common.validations.values.mariadb.passwords" -}}
|
||||
{{- if and (not .context.Values.mariadb.existingSecret) .context.Values.mariadb.enabled -}}
|
||||
{{- $requiredPasswords := list -}}
|
||||
|
||||
{{- if .context.Values.mariadb.secret.requirePasswords -}}
|
||||
{{- $requiredRootMariadbPassword := dict "valueKey" "mariadb.rootUser.password" "secret" .secretName "field" "mariadb-root-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredRootMariadbPassword -}}
|
||||
|
||||
{{- if not (empty .context.Values.mariadb.db.user) -}}
|
||||
{{- $requiredMariadbPassword := dict "valueKey" "mariadb.db.password" "secret" .secretName "field" "mariadb-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredMariadbPassword -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .context.Values.mariadb.replication.enabled -}}
|
||||
{{- $requiredReplicationPassword := dict "valueKey" "mariadb.replication.password" "secret" .secretName "field" "mariadb-replication-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate a postgresql required password must not be 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) $enabled -}}
|
||||
{{- $requiredPasswords := list -}}
|
||||
|
||||
{{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}}
|
||||
|
||||
{{- if $enabledReplication -}}
|
||||
{{- $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 -}}
|
||||
{{- .context.Values.postgresql.enabled | quote -}}
|
||||
{{- else -}}
|
||||
true
|
||||
{{- 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 -}}
|
||||
{{- .context.Values.postgresql.replication.enabled | quote -}}
|
||||
{{- else -}}
|
||||
{{- .context.Values.replication.enabled | quote -}}
|
||||
{{- 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 -}}
|
||||
@@ -0,0 +1,3 @@
|
||||
## bitnami/common
|
||||
## It is required by CI/CD tools and processes.
|
||||
exampleValue: common-chart
|
||||
@@ -0,0 +1,3 @@
|
||||
commonAnnotations:
|
||||
helm.sh/hook: 'pre-install, pre-upgrade'
|
||||
helm.sh/hook-weight: '-1'
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
Copy here your postgresql.conf and/or pg_hba.conf files to use it as a config map.
|
||||
@@ -0,0 +1,4 @@
|
||||
If you don't want to provide the whole configuration file and only specify certain parameters, you can copy here your extended `.conf` files.
|
||||
These files will be injected as a config maps and add/overwrite the default configuration using the `include_dir` directive that allows settings to be loaded from files other than the default `postgresql.conf`.
|
||||
|
||||
More info in the [bitnami-docker-postgresql 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.
|
||||
@@ -0,0 +1,6 @@
|
||||
dependencies:
|
||||
- name: common
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 0.6.2
|
||||
digest: sha256:740783295d301fdd168fafdbaa760de27ab54b0ff36b513589a5a2515072b885
|
||||
generated: "2020-09-01T17:40:02.795096189Z"
|
||||
@@ -0,0 +1,4 @@
|
||||
dependencies:
|
||||
- name: common
|
||||
version: 0.x.x
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
@@ -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" $) -}}
|
||||
@@ -0,0 +1,501 @@
|
||||
{{/* 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 -}}
|
||||
|
||||
{{/*
|
||||
Renders a value that contains template.
|
||||
Usage:
|
||||
{{ include "postgresql.tplValue" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||
*/}}
|
||||
{{- define "postgresql.tplValue" -}}
|
||||
{{- if typeIs "string" .value }}
|
||||
{{- tpl .value .context }}
|
||||
{{- else }}
|
||||
{{- tpl (.value | toYaml) .context }}
|
||||
{{- 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 -}}
|
||||
@@ -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 "postgresql.tplValue" ( 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 "postgresql.tplValue" ( 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 }}
|
||||
@@ -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 "postgresql.tplValue" ( 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 "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
custom-metrics.yaml: {{ toYaml .Values.metrics.customMetrics | quote }}
|
||||
{{- end }}
|
||||
@@ -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 "postgresql.tplValue" ( 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 }}
|
||||
@@ -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 "postgresql.tplValue" ( 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 "postgresql.tplValue" ( 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 }}
|
||||
@@ -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 "postgresql.tplValue" ( 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 }}
|
||||
@@ -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 "postgresql.tplValue" ( 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 }}
|
||||
@@ -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 "postgresql.tplValue" ( 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 }}
|
||||
@@ -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 "postgresql.tplValue" ( 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 -}}
|
||||
@@ -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 "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -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 "postgresql.tplValue" ( 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 }}
|
||||
@@ -0,0 +1,345 @@
|
||||
{{- if .Values.replication.enabled }}
|
||||
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 "postgresql.tplValue" ( 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:
|
||||
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||
{{- 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.securityContext.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.securityContext.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.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /opt/bitnami/postgresql/certs/
|
||||
{{- end }}
|
||||
chmod 600 {{ template "postgresql.tlsCertKey" . }}
|
||||
{{- end }}
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
securityContext:
|
||||
{{- else }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.volumePermissions.securityContext.runAsUser }}
|
||||
{{- 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 .Values.resources }}
|
||||
resources: {{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- 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 }}
|
||||
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 }}
|
||||
{{- 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 }}
|
||||
{{- 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 "postgresql.tplValue" ( 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 }}
|
||||
@@ -0,0 +1,514 @@
|
||||
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 "postgresql.tplValue" ( 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:
|
||||
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||
{{- 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.securityContext.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.securityContext.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.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /opt/bitnami/postgresql/certs/
|
||||
{{- end }}
|
||||
chmod 600 {{ template "postgresql.tlsCertKey" . }}
|
||||
{{- end }}
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
securityContext:
|
||||
{{- else }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.volumePermissions.securityContext.runAsUser }}
|
||||
{{- 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 "postgresql.tplValue" ( 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.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- 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.replication.enabled }}
|
||||
- name: POSTGRES_REPLICATION_MODE
|
||||
value: "master"
|
||||
- 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 "postgresql.tplValue" (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 }}
|
||||
{{- 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 }}
|
||||
{{- 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 }}
|
||||
{{- 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 "postgresql.tplValue" ( 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:
|
||||
runAsUser: {{ .Values.metrics.securityContext.runAsUser }}
|
||||
{{- 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 "postgresql.tplValue" (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 }}
|
||||
@@ -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 "postgresql.tplValue" ( 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 }}
|
||||
@@ -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 "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $serviceAnnotations }}
|
||||
{{- include "postgresql.tplValue" (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 "postgresql.tplValue" (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 }}
|
||||
@@ -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 "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $serviceAnnotations }}
|
||||
{{- include "postgresql.tplValue" (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 "postgresql.tplValue" (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
|
||||
@@ -0,0 +1,594 @@
|
||||
## 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-r1
|
||||
## 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
|
||||
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:
|
||||
|
||||
## 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
|
||||
|
||||
## 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
|
||||
|
||||
## 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
|
||||
|
||||
##
|
||||
## 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-r188
|
||||
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
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,600 @@
|
||||
## 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-r1
|
||||
## 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
|
||||
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:
|
||||
|
||||
## 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:
|
||||
|
||||
## 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:
|
||||
|
||||
## 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
|
||||
|
||||
## 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
|
||||
|
||||
##
|
||||
## 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-r188
|
||||
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
|
||||
@@ -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
|
||||
@@ -0,0 +1,20 @@
|
||||
apiVersion: v1
|
||||
appVersion: 3.8.5
|
||||
description: Highly available RabbitMQ cluster, the open source message broker software
|
||||
that implements the Advanced Message Queuing Protocol (AMQP).
|
||||
home: https://www.rabbitmq.com
|
||||
icon: https://bitnami.com/assets/stacks/rabbitmq/img/rabbitmq-stack-220x234.png
|
||||
keywords:
|
||||
- rabbitmq
|
||||
- message queue
|
||||
- AMQP
|
||||
- AMQPS
|
||||
- MQTT
|
||||
- STOMP
|
||||
maintainers:
|
||||
- name: steven-sheehy
|
||||
name: rabbitmq-ha
|
||||
sources:
|
||||
- https://github.com/rabbitmq/rabbitmq
|
||||
- https://github.com/docker-library/rabbitmq
|
||||
version: 1.46.4
|
||||
@@ -0,0 +1,5 @@
|
||||
approvers:
|
||||
- steven-sheehy
|
||||
reviewers:
|
||||
- steven-sheehy
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
# RabbitMQ High Available
|
||||
|
||||
[RabbitMQ](https://www.rabbitmq.com) is an open source message broker software
|
||||
that implements the Advanced Message Queuing Protocol (AMQP).
|
||||
|
||||
## TL;DR;
|
||||
|
||||
```bash
|
||||
$ helm install stable/rabbitmq-ha
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a [RabbitMQ](https://hub.docker.com/r/_/rabbitmq)
|
||||
deployment on a [Kubernetes](http://kubernetes.io) cluster using the
|
||||
[Helm](https://helm.sh) package manager.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.9+ with Beta APIs enabled
|
||||
- PV provisioner support in the underlying infrastructure
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release stable/rabbitmq-ha
|
||||
```
|
||||
|
||||
The command deploys RabbitMQ on the Kubernetes cluster in the default
|
||||
configuration. The [configuration](#configuration) section lists the parameters
|
||||
that can be configured during installation.
|
||||
|
||||
> **Tip**: List all releases using `helm list`
|
||||
|
||||
## Upgrading the Chart
|
||||
|
||||
To upgrade the chart, you need to make sure that you are using the same value
|
||||
of the `rabbitmqErlangCookie` amongst the releases. If you didn't define it at
|
||||
the first place, you can upgrade using the following command:
|
||||
|
||||
```
|
||||
$ export ERLANGCOOKIE=$(kubectl get secrets -n <NAMESPACE> <HELM_RELEASE_NAME>-rabbitmq-ha -o jsonpath="{.data.rabbitmq-erlang-cookie}" | base64 --decode)
|
||||
$ helm upgrade \
|
||||
--set rabbitmqErlangCookie=$ERLANGCOOKIE \
|
||||
<HELM_RELEASE_NAME> stable/rabbitmq-ha
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the RabbitMQ chart
|
||||
and their default values.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| `existingConfigMap` | Use an existing ConfigMap | `false` |
|
||||
| `existingSecret` | Use an existing secret for password, managementPassword & erlang cookie | `""` |
|
||||
| `extraPlugins` | Additional plugins to add to the default configmap | `rabbitmq_shovel, rabbitmq_shovel_management, rabbitmq_federation, rabbitmq_federation_management,` |
|
||||
| `extraConfig` | Additional configuration to add to default configmap | `{}` |
|
||||
| `extraContainers` | Additional containers passed through the tpl | `[]` |
|
||||
| `extraInitContainers` | Additional init containers passed through the tpl | `[]` |
|
||||
| `env` | Environment variables to set for Rabbitmq container | `{}` |
|
||||
| `advancedConfig` | Additional configuration in classic config format | `""` |
|
||||
| `definitions.globalParameters` | Pre-configured global parameters | `""` |
|
||||
| `definitions.users` | Additional users | `""` |
|
||||
| `definitions.vhosts` | Additional vhosts | `""` |
|
||||
| `definitions.parameters` | Additional parameters | `""` |
|
||||
| `definitions.permissions` | Additional permissions | `""` |
|
||||
| `definitions.topicPermissions` | Additional permissions for topic management | `""` |
|
||||
| `definitions.queues` | Pre-created queues | `""` |
|
||||
| `definitions.exchanges` | Pre-created exchanges | `""` |
|
||||
| `definitions.bindings` | Pre-created bindings | `""` |
|
||||
| `definitions.policies` | HA policies to add to definitions.json | `""` |
|
||||
| `definitionsSource` | Use this key within an existing secret to reference the definitions specification | `"definitions.json"` |
|
||||
| `forceBoot` | [Force](https://www.rabbitmq.com/rabbitmqctl.8.html#force_boot) the cluster to start even if it was shutdown in an unexpected order, preferring availability over integrity | `false` |
|
||||
| `lifecycle` | RabbitMQ container lifecycle hooks | `{}` |
|
||||
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
||||
| `image.repository` | RabbitMQ container image repository | `rabbitmq` |
|
||||
| `image.tag` | RabbitMQ container image tag | `3.8.5-alpine` |
|
||||
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` |
|
||||
| `managementPassword` | Management user password. | _random 24 character long alphanumeric string_ |
|
||||
| `managementUsername` | Management user with minimal permissions used for health checks | `management` |
|
||||
| `nodeSelector` | Node labels for pod assignment | `{}` |
|
||||
| `persistentVolume.accessMode` | Persistent volume access modes | `[ReadWriteOnce]` |
|
||||
| `persistentVolume.annotations` | Persistent volume annotations | `{}` |
|
||||
| `persistentVolume.labels` | Persistent volume labels | `{}` |
|
||||
| `persistentVolume.enabled` | If `true`, persistent volume claims are created | `false` |
|
||||
| `persistentVolume.name` | Persistent volume name | `data` |
|
||||
| `persistentVolume.size` | Persistent volume size | `8Gi` |
|
||||
| `persistentVolume.storageClass` | Persistent volume storage class | `-` |
|
||||
| `persistentVolume.selector` | Persistent volume selector | `{}` |
|
||||
| `podAntiAffinity` | Pod anti-affinity, `hard` or `soft` | `soft` |
|
||||
| `podAntiAffinityTopologyKey` | TopologyKey for anti-affinity, default is hostname | `"kubernetes.io/hostname"` |
|
||||
| `affinity` | Affinity settings. If specified, this will disable `podAntiAffinity` settings. If you still need anti-affinity, you must include the configuration here. | `{}` |
|
||||
| `podDisruptionBudget` | Pod Disruption Budget rules | `{}` |
|
||||
| `podManagementPolicy` | Whether the pods should be restarted in parallel or one at a time. Either `OrderedReady` or `Parallel`. | `OrderedReady` |
|
||||
| `prometheus.exporter.enabled` | Configures Prometheus Exporter to expose and scrape stats | `false` |
|
||||
| `prometheus.exporter.env` | Environment variables to set for Exporter container | `{}` |
|
||||
| `prometheus.exporter.image.repository` | Prometheus Exporter repository | `kbudde/rabbitmq-exporter` |
|
||||
| `prometheus.exporter.image.tag` | Image Tag | `v0.29.0` |
|
||||
| `prometheus.exporter.image.pullPolicy` | Image Pull Policy | `IfNotPresent` |
|
||||
| `prometheus.exporter.port` | Port Prometheus scrapes for metrics | `9090` |
|
||||
| `prometheus.exporter.capabilities` | Comma-separated list of extended scraping capabilities supported by the target RabbitMQ server. [Click here for details.](https://github.com/kbudde/rabbitmq_exporter#extended-rabbitmq-capabilities) | `bert,no_sort` |
|
||||
| `prometheus.exporter.resources` | Resource Limits for Prometheus Exporter | `{}` |
|
||||
| `prometheus.operator.enabled` | Are you using Prometheus Operator? [Blog Post](https://coreos.com/blog/the-prometheus-operator.html) | `true` |
|
||||
| `prometheus.operator.alerts.enabled` | Create default Alerts for RabbitMQ | `true` |
|
||||
| `prometheus.operator.alerts.selector` | Selector to find ConfigMaps and create Prometheus Alerts | `alert-rules` |
|
||||
| `prometheus.operator.alerts.labels` | Labels to add to Alerts | `{}` |
|
||||
| `prometheus.operator.serviceMonitor.interval` | How often Prometheus Scrapes metrics | `10s` |
|
||||
| `prometheus.operator.serviceMonitor.scrapeTimeout` | Specify the timeout after which the scrape is ended | `nil` |
|
||||
| `prometheus.operator.serviceMonitor.namespace` | Namespace which Prometheus is installed | `monitoring` |
|
||||
| `prometheus.operator.serviceMonitor.selector` | Label Selector for Prometheus to find ServiceMonitors | `{ prometheus: kube-prometheus }` |
|
||||
| `rabbitmqCert.enabled` | Mount a Secret container certificates | `false` |
|
||||
| `rabbitmqCert.cacertfile` | base64 encoded CA certificate (overwrites existing Secret) | `` |
|
||||
| `rabbitmqCert.certfile` | base64 encoded server certificate (overwrites existing Secret) | `` |
|
||||
| `rabbitmqCert.existingSecret` | Name of an existing `Secret` to mount for amqps | `""` |
|
||||
| `rabbitmqCert.keyfile` | base64 encoded server private key (overwrites existing Secret) | `` |
|
||||
| `rabbitmqClusterPartitionHandling` | [Automatic Partition Handling Strategy (split brain handling)](https://www.rabbitmq.com/partitions.html#automatic-handling) | `autoheal` |
|
||||
| `extraVolumes` | Extra volumes to attach to the statefulset | `[]` |
|
||||
| `extraVolumeMounts` | Extra volume mounts to mount to the statefulset | `[]` |
|
||||
| `rabbitmqEpmdPort` | EPMD port used for cross cluster replication | `4369` |
|
||||
| `rabbitmqErlangCookie` | Erlang cookie | _random 32 character long alphanumeric string_ |
|
||||
| `rabbitmqHipeCompile` | Precompile parts of RabbitMQ using HiPE | `false` |
|
||||
| `rabbitmqMQTTPlugin.config` | MQTT configuration | `` |
|
||||
| `rabbitmqMQTTPlugin.enabled` | Enable MQTT plugin | `false` |
|
||||
| `rabbitmqManagerPort` | RabbitMQ Manager port | `15672` |
|
||||
| `rabbitmqMemoryHighWatermark` | Memory high watermark | `256MB` |
|
||||
| `rabbitmqMemoryHighWatermarkType` | Memory high watermark type. Either absolute or relative | `absolute` |
|
||||
| `rabbitmqNodePort` | Node port | `5672` |
|
||||
| `rabbitmqPassword` | RabbitMQ application password | _random 24 character long alphanumeric string_ |
|
||||
| `rabbitmqSTOMPPlugin.config` | STOMP configuration | `` |
|
||||
| `rabbitmqSTOMPPlugin.enabled` | Enable STOMP plugin | `false` |
|
||||
| `rabbitmqUsername` | RabbitMQ application username | `guest` |
|
||||
| `rabbitmqVhost` | RabbitMQ application vhost | `/` |
|
||||
| `rabbitmqWebMQTTPlugin.config` | MQTT over websocket configuration | `` |
|
||||
| `rabbitmqWebMQTTPlugin.enabled` | Enable MQTT over websocket plugin | `false` |
|
||||
| `rabbitmqWebSTOMPPlugin.config` | STOMP over websocket configuration | `` |
|
||||
| `rabbitmqWebSTOMPPlugin.enabled` | Enable STOMP over websocket plugin | `false` |
|
||||
| `rabbitmqPrometheusPlugin.enabled` | Enable native RabbitMQ prometheus plugin. (Available in RabbitMQ 3.8) | `false` |
|
||||
| `rabbitmqPrometheusPlugin.nodePort` | Exposes the native prometheus metrics port on the given NodePort | `null` |
|
||||
| `rabbitmqPrometheusPlugin.port` | The port RabbitMQ prometheus plugin will use | `15692` |
|
||||
| `rabbitmqPrometheusPlugin.path` | The path RabbitMQ prometheus plugin will use | `/metrics` |
|
||||
| `rabbitmqPrometheusPlugin.config` | RabbitMQ prometheus plugin additional configuration | `` |
|
||||
| `rbac.create` | If true, create & use RBAC resources | `true` |
|
||||
| `replicaCount` | Number of replica | `3` |
|
||||
| `resources` | CPU/Memory resource requests/limits | `{}` |
|
||||
| `initContainer.enabled` | Enable the default initContainer | `true` |
|
||||
| `initContainer.securityContext.runAsGroup` | Group ID for the initContainer | `0` |
|
||||
| `initContainer.securityContext.runAsUser` | User ID for the initContainer | `0` |
|
||||
| `initContainer.securityContext.runAsNonRoot` | Enforce non-root user ID for the initContainer | `false` |
|
||||
| `initContainer.chownFiles` | Enforce file permissions to `/var/lib/rabbitmq/` and `/etc/rabbitmq` | `true` |
|
||||
| `initContainer.resources` | CPU/Memory resource requests/limits for init container | `{}` |
|
||||
| `schedulerName` | alternate scheduler name | `nil` |
|
||||
| `securityContext.fsGroup` | Group ID for the container's volumes | `101` |
|
||||
| `securityContext.runAsGroup` | Group ID for the container | `101` |
|
||||
| `securityContext.runAsNonRoot` | Enforce non-root user ID for the container | `true` |
|
||||
| `securityContext.runAsUser` | User ID for the container | `100` |
|
||||
| `serviceAccount.create` | Create service account | `true` |
|
||||
| `serviceAccount.automountServiceAccountToken` | Automount API credentials for a service account | `true` |
|
||||
| `serviceAccount.name` | Service account name to use | _name of the release_ |
|
||||
| `service.annotations` | Annotations to add to the service | `{}` |
|
||||
| `service.clusterIP` | IP address to assign to the service | None |
|
||||
| `service.externalIPs` | Service external IP addresses | `[]` |
|
||||
| `service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` |
|
||||
| `service.externalTrafficPolicy` | Sets the external traffic policy for the service | `""` |
|
||||
| `service.loadBalancerSourceRanges` | List of IP CIDRs allowed access to load balancer (if supported) | `[]` |
|
||||
| `service.type` | Type of service to create | `ClusterIP` |
|
||||
| `service.discovery.separateAnnotations` | Control if discovery service should have it's own annotations instead of `service.annotations` | `false` |
|
||||
| `service.discovery.annotations` | Annotations to add to the discovery service | `{}` |
|
||||
| `ingress.enabled` | Enable Ingress | `false` |
|
||||
| `ingress.path` | Ingress path | `/` |
|
||||
| `ingress.hostName` | Ingress hostname | |
|
||||
| `ingress.tls` | Enable Ingress TLS | `false` |
|
||||
| `ingress.tlsSecret` | Ingress TLS secret name | `myTlsSecret` |
|
||||
| `ingress.annotations` | Ingress annotations | `{}` |
|
||||
| `tolerations` | Toleration labels for pod assignment | `[]` |
|
||||
| `podAnnotations` | Extra annotations to add to pod | `{}` |
|
||||
| `statefulSetAnnotations` | Extra annotations to add the statefulSet | `{}` |
|
||||
| `terminationGracePeriodSeconds` | Duration pod needs to terminate gracefully | `10` |
|
||||
| `updateStrategy` | Statefulset update strategy | `OnDelete` |
|
||||
| `priorityClassName` | Statefulsets Pod Priority | `` |
|
||||
| `extraLabels` | Labels to add to the Resources | `{}` |
|
||||
| `busyboxImage.repository` | Busybox initContainer image repo | `busybox` |
|
||||
| `busyboxImage.tag` | Busybox initContainer image tag | `1.30.1` |
|
||||
| `busyboxImage.pullPolicy` | Busybox initContainer image pullPolicy | `IfNotPresent` |
|
||||
| `clusterDomain` | The internal Kubernetes cluster domain | `cluster.local` |
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release \
|
||||
--set rabbitmqUsername=admin,rabbitmqPassword=secretpassword,managementPassword=anothersecretpassword,rabbitmqErlangCookie=secretcookie \
|
||||
stable/rabbitmq-ha
|
||||
```
|
||||
|
||||
The above command sets the RabbitMQ admin username and password to `admin` and
|
||||
`secretpassword` respectively. Additionally the management user password is set
|
||||
to `anothersecretpassword` and the secure erlang cookie is set to
|
||||
`secretcookie`.
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the parameters can be
|
||||
provided while installing the chart. For example,
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release -f values.yaml stable/rabbitmq-ha
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
### Custom ConfigMap
|
||||
|
||||
When creating a new chart with this chart as a dependency, `existingConfigMap`
|
||||
can be used to override the default [configmap.yaml](templates/configmap.yaml)
|
||||
provided. It also allows for providing additional configuration files that will
|
||||
be mounted into `/etc/definitions`. In the parent chart's values.yaml, set the
|
||||
value to true and provide the file [templates/configmap.yaml][] for your use
|
||||
case.
|
||||
|
||||
Example of using RabbitMQ definition to setup users, permissions or policies:
|
||||
|
||||
```
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: my-release-rabbitmq-ha
|
||||
data:
|
||||
enabled_plugins: |
|
||||
[
|
||||
rabbitmq_consistent_hash_exchange,
|
||||
rabbitmq_federation,
|
||||
rabbitmq_federation_management,
|
||||
rabbitmq_management,
|
||||
rabbitmq_peer_discovery_k8s,
|
||||
rabbitmq_shovel,
|
||||
rabbitmq_shovel_management
|
||||
].
|
||||
rabbitmq.conf: |
|
||||
# ....
|
||||
management.load_definitions = /etc/definitions/definitions.json
|
||||
definitions.json: |
|
||||
{
|
||||
"permissions": [],
|
||||
"users": [],
|
||||
"policies: []
|
||||
}
|
||||
```
|
||||
|
||||
Then, install the chart with the above configuration:
|
||||
|
||||
```
|
||||
$ helm install --name my-release --set existingConfigMap=true stable/rabbitmq-ha
|
||||
```
|
||||
|
||||
### Custom Secret
|
||||
|
||||
Similar to custom ConfigMap, `existingSecret` can be used to override the default secret.yaml provided, and
|
||||
`rabbitmqCert.existingSecret` can be used to override the default certificates. The custom secret must provide
|
||||
the following keys:
|
||||
|
||||
- `rabbitmq-username`
|
||||
- `rabbitmq-password`
|
||||
- `rabbitmq-management-username`
|
||||
- `rabbitmq-management-password`
|
||||
- `rabbitmq-erlang-cookie`
|
||||
- `definitions.json` (the name can be altered by setting the `definitionsSource`)
|
||||
|
||||
### Prometheus Monitoring & Alerts
|
||||
|
||||
As of RabbitMQ 3.8.0, it is possible to enable Prometheus metrics natively, no need to run an external exporter. To enable native Prometheus metrics, set `rabbitmqPrometheusPlugin.enabled` to `true`. This will expose all RabbitMQ node metrics via the `<<rabbitmqhost>>:15692/metrics` URL. Since all metrics are node local, they add the least pressure on RabbitMQ and will be available for as long as RabbitMQ is running, regardless of inter-node pressure or other nodes in the cluster going away.
|
||||
|
||||
To learn more about RabbitMQ's native support for Prometheus, please refer to the official [Monitoring with Prometheus & Grafana guide](https://www.rabbitmq.com/prometheus.html).
|
||||
|
||||
Team RabbitMQ manages Grafana dashboards that are meant to be used with the native Prometheus support. They are publicly available at [grafana.com/orgs/rabbitmq](https://grafana.com/orgs/rabbitmq).
|
||||
|
||||
To enable metrics via the traditional [rabbitmq_exporter](https://github.com/kbudde/rabbitmq_exporter) sidecar container, set `prometheus.enabled` to `true`. See `values.yaml` file for more details and configuration options.
|
||||
|
||||
### Usage of the `tpl` Function
|
||||
|
||||
The `tpl` function allows us to pass values from `values.yaml` through the templating engine. It is used for the following values:
|
||||
|
||||
- `extraContainers`
|
||||
- `extraInitContainers`
|
||||
- `persistentVolume.annotations`
|
||||
- `persistentVolume.labels`
|
||||
- `service.annotations`
|
||||
@@ -0,0 +1,8 @@
|
||||
# Testing Prometheus exporter
|
||||
|
||||
prometheus:
|
||||
exporter:
|
||||
enabled: true
|
||||
|
||||
operator:
|
||||
enabled: false
|
||||
@@ -0,0 +1,8 @@
|
||||
# Testing native Prometheus plugin
|
||||
|
||||
rabbitmqPrometheusPlugin:
|
||||
enabled: true
|
||||
|
||||
prometheus:
|
||||
operator:
|
||||
enabled: false
|
||||
@@ -0,0 +1,107 @@
|
||||
** Please be patient while the chart is being deployed **
|
||||
|
||||
Credentials:
|
||||
|
||||
Username : {{ .Values.rabbitmqUsername }}
|
||||
Password : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "rabbitmq-ha.secretName" . }} -o jsonpath="{.data.rabbitmq-password}" | base64 --decode)
|
||||
Management username : {{ .Values.managementUsername }}
|
||||
Management password : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "rabbitmq-ha.secretName" . }} -o jsonpath="{.data.rabbitmq-management-password}" | base64 --decode)
|
||||
ErLang Cookie : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "rabbitmq-ha.secretName" . }} -o jsonpath="{.data.rabbitmq-erlang-cookie}" | base64 --decode)
|
||||
|
||||
RabbitMQ can be accessed within the cluster on port {{ .Values.rabbitmqNodePort }} at {{ template "rabbitmq-ha.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
|
||||
|
||||
To access the cluster externally 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[?(@.type=='ExternalIP')].address}")
|
||||
export NODE_PORT_AMQP=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath='{.spec.ports[?(@.name=="amqp")].nodePort}' services {{ template "rabbitmq-ha.fullname" . }})
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
export NODE_PORT_AMQPS=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath='{.spec.ports[?(@.name=="amqps")].nodePort}' services {{ template "rabbitmq-ha.fullname" . }})
|
||||
{{- end }}
|
||||
export NODE_PORT_STATS=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath='{.spec.ports[?(@.name=="http")].nodePort}' services {{ template "rabbitmq-ha.fullname" . }})
|
||||
{{- if .Values.prometheus.exporter.enabled }}
|
||||
export NODE_PORT_RABBITMQ_EXPORTER=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath='{.spec.ports[?(@.name=="exporter")].nodePort}' services {{ template "rabbitmq-ha.fullname" . }})
|
||||
{{- end }}
|
||||
To Access the RabbitMQ AMQP port:
|
||||
|
||||
amqp://$NODE_IP:$NODE_PORT_AMQP/
|
||||
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
To Access the RabbitMQ AMQPS port:
|
||||
|
||||
amqps://$NODE_IP:$NODE_PORT_AMQPS/
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.prometheus.exporter.enabled }}
|
||||
To Access the RabbitMQ Exporter metrics port:
|
||||
http://$NODE_IP:$NODE_PORT_RABBITMQ_EXPORTER/
|
||||
{{- end }}
|
||||
|
||||
To Access the RabbitMQ Management interface:
|
||||
|
||||
http://$NODE_IP:$NODE_PORT_STATS/
|
||||
|
||||
{{- 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 "rabbitmq-ha.name" . }}'
|
||||
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "rabbitmq-ha.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "rabbitmq-ha.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[1].ip}')
|
||||
{{- end }}
|
||||
|
||||
To Access the RabbitMQ AMQP port:
|
||||
|
||||
amqp://$SERVICE_IP:{{ .Values.rabbitmqNodePort }}/
|
||||
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
To Access the RabbitMQ AMQPS port:
|
||||
|
||||
amqps://$SERVICE_IP:{{ .Values.rabbitmqAmqpsSupport.amqpsNodePort }}/
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.prometheus.exporter.enabled }}
|
||||
To Access the RabbitMQ Exporter metrics port:
|
||||
|
||||
http://$SERVICE_IP:{{ .Values.prometheus.exporter.port }}/
|
||||
{{- end }}
|
||||
|
||||
To Access the RabbitMQ Management interface:
|
||||
|
||||
http://$SERVICE_IP:{{ .Values.rabbitmqManagerPort }}/
|
||||
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rabbitmq-ha.name" . }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
kubectl port-forward $POD_NAME --namespace {{ .Release.Namespace }} {{ .Values.rabbitmqNodePort }}:{{ .Values.rabbitmqNodePort }} {{ .Values.rabbitmqManagerPort }}:{{ .Values.rabbitmqManagerPort }}
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
kubectl port-forward $POD_NAME --namespace {{ .Release.Namespace }} {{ .Values.rabbitmqAmqpsSupport.amqpsNodePort }}:{{ .Values.rabbitmqAmqpsSupport.amqpsNodePort }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.prometheus.exporter.enabled }}
|
||||
kubectl port-forward $POD_NAME --namespace {{ .Release.Namespace }} {{ .Values.prometheus.exporter.port }}:{{ .Values.prometheus.exporter.port }}
|
||||
{{- end }}
|
||||
|
||||
To Access the RabbitMQ AMQP port:
|
||||
|
||||
amqp://127.0.0.1:{{ .Values.rabbitmqNodePort }}/
|
||||
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
To Access the RabbitMQ AMQPS port:
|
||||
|
||||
amqps://127.0.0.1:{{ .Values.rabbitmqAmqpsSupport.amqpsNodePort }}/
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.prometheus.exporter.enabled }}
|
||||
To Access the RabbitMQ Exporter metrics port:
|
||||
|
||||
http://127.0.0.1:{{ .Values.prometheus.exporter.port }}/
|
||||
{{- end }}
|
||||
|
||||
To Access the RabbitMQ Management interface:
|
||||
|
||||
URL : http://127.0.0.1:{{ .Values.rabbitmqManagerPort }}
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "rabbitmq-ha.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "rabbitmq-ha.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "rabbitmq-ha.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "rabbitmq-ha.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "rabbitmq-ha.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Generate chart secret name
|
||||
*/}}
|
||||
{{- define "rabbitmq-ha.secretName" -}}
|
||||
{{ default (include "rabbitmq-ha.fullname" .) .Values.existingSecret }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Generate chart ssl secret name
|
||||
*/}}
|
||||
{{- define "rabbitmq-ha.certSecretName" -}}
|
||||
{{ default (print (include "rabbitmq-ha.fullname" .) "-cert") .Values.rabbitmqCert.existingSecret }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Defines a JSON file containing definitions of all broker objects (queues, exchanges, bindings,
|
||||
users, virtual hosts, permissions and parameters) to load by the management plugin.
|
||||
*/}}
|
||||
{{- define "rabbitmq-ha.definitions" -}}
|
||||
{
|
||||
"global_parameters": [
|
||||
{{ .Values.definitions.globalParameters | indent 4 }}
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"name": {{ .Values.managementUsername | quote }},
|
||||
"password": {{ .Values.managementPassword | quote }},
|
||||
"tags": "management"
|
||||
},
|
||||
{
|
||||
"name": {{ .Values.rabbitmqUsername | quote }},
|
||||
"password": {{ .Values.rabbitmqPassword | quote }},
|
||||
"tags": "administrator"
|
||||
}{{- if .Values.definitions.users -}},
|
||||
{{ .Values.definitions.users | indent 4 }}
|
||||
{{- end }}
|
||||
],
|
||||
"vhosts": [
|
||||
{
|
||||
"name": {{ .Values.rabbitmqVhost | quote }}
|
||||
}{{- if .Values.definitions.vhosts -}},
|
||||
{{ .Values.definitions.vhosts | indent 4 }}
|
||||
{{- end }}
|
||||
],
|
||||
"permissions": [
|
||||
{
|
||||
"user": {{ .Values.rabbitmqUsername | quote }},
|
||||
"vhost": {{ .Values.rabbitmqVhost | quote }},
|
||||
"configure": ".*",
|
||||
"read": ".*",
|
||||
"write": ".*"
|
||||
}{{- if .Values.definitions.permissions -}},
|
||||
{{ .Values.definitions.permissions | indent 4 }}
|
||||
{{- end }}
|
||||
],
|
||||
"topic_permissions": [
|
||||
{{ .Values.definitions.topicPermissions | indent 4 }}
|
||||
],
|
||||
"parameters": [
|
||||
{{ .Values.definitions.parameters| indent 4 }}
|
||||
],
|
||||
"policies": [
|
||||
{{ .Values.definitions.policies | indent 4 }}
|
||||
],
|
||||
"queues": [
|
||||
{{ .Values.definitions.queues | indent 4 }}
|
||||
],
|
||||
"exchanges": [
|
||||
{{ .Values.definitions.exchanges | indent 4 }}
|
||||
],
|
||||
"bindings": [
|
||||
{{ .Values.definitions.bindings| indent 4 }}
|
||||
]
|
||||
}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,104 @@
|
||||
{{ if and .Values.prometheus.operator.enabled .Values.prometheus.operator.alerts.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-rabbitmq-alerts
|
||||
namespace: {{ .Values.prometheus.operator.serviceMonitor.namespace }}
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- if .Values.prometheus.operator.serviceMonitor.selector }}
|
||||
{{ toYaml .Values.prometheus.operator.serviceMonitor.selector | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.prometheus.operator.alerts.selector }}
|
||||
{{ toYaml .Values.prometheus.operator.alerts.selector | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
groups:
|
||||
- name: {{ template "rabbitmq-ha.fullname" . }}.rules
|
||||
rules:
|
||||
- alert: RabbitMqClusterNodeDown
|
||||
expr: rabbitmq_up{service="{{ template "rabbitmq-ha.fullname" . }}"} == 0
|
||||
for: 5m
|
||||
labels:
|
||||
installed_by: {{ .Release.Name }}
|
||||
severity: critical
|
||||
{{- if .Values.prometheus.operator.alerts.labels }}
|
||||
{{ toYaml .Values.prometheus.operator.alerts.labels | indent 10 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
description: RabbitMQ {{`{{ $labels.namespace }}`}}/{{`{{ $labels.pod}}`}} is down
|
||||
summary: RabbitMQ Node Is Down
|
||||
- alert: RabbitMqClusterNotAllNodesRunning
|
||||
expr: sum(rabbitmq_up{service="{{ template "rabbitmq-ha.fullname" . }}"}) by (service) < {{ .Values.replicaCount }}
|
||||
for: 5m
|
||||
labels:
|
||||
installed_by: {{ .Release.Name }}
|
||||
severity: critical
|
||||
team: devops
|
||||
annotations:
|
||||
description: Some RabbitMQ Cluster Nodes Are Down in Service {{`{{ $labels.namespace }}`}}/{{`{{ $labels.service}}`}}
|
||||
summary: Some RabbitMQ Cluster Nodes Are Down in Service {{`{{ $labels.namespace }}`}}/{{`{{ $labels.service}}`}}
|
||||
- alert: RabbitMqDiskSpaceAlarm
|
||||
expr: rabbitmq_node_disk_free_alarm{service="{{ template "rabbitmq-ha.fullname" . }}"} == 1
|
||||
for: 1m
|
||||
labels:
|
||||
installed_by: {{ .Release.Name }}
|
||||
severity: critical
|
||||
{{- if .Values.prometheus.operator.alerts.labels }}
|
||||
{{ toYaml .Values.prometheus.operator.alerts.labels | indent 10 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
description: RabbitMQ {{`{{ $labels.namespace }}`}}/{{`{{ $labels.pod}}`}} Disk Space Alarm is going off. Which means the node hit highwater mark and has cut off network connectivity, see RabbitMQ WebUI
|
||||
summary: RabbitMQ is Out of Disk Space
|
||||
- alert: RabbitMqMemoryAlarm
|
||||
expr: rabbitmq_node_mem_alarm{service="{{ template "rabbitmq-ha.fullname" . }}"} == 1
|
||||
for: 1m
|
||||
labels:
|
||||
installed_by: {{ .Release.Name }}
|
||||
severity: critical
|
||||
{{- if .Values.prometheus.operator.alerts.labels }}
|
||||
{{ toYaml .Values.prometheus.operator.alerts.labels | indent 10 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
description: RabbitMQ {{`{{ $labels.namespace }}`}}/{{`{{ $labels.pod}}`}} High Memory Alarm is going off. Which means the node hit highwater mark and has cut off network connectivity, see RabbitMQ WebUI
|
||||
summary: RabbitMQ is Out of Memory
|
||||
- alert: RabbitMqMemoryUsageHigh
|
||||
expr: (rabbitmq_node_mem_used{service="{{ template "rabbitmq-ha.fullname" . }}"} / rabbitmq_node_mem_limit{service="{{ template "rabbitmq-ha.fullname" . }}"}) > .9
|
||||
for: 1m
|
||||
labels:
|
||||
installed_by: {{ .Release.Name }}
|
||||
severity: critical
|
||||
{{- if .Values.prometheus.operator.alerts.labels }}
|
||||
{{ toYaml .Values.prometheus.operator.alerts.labels | indent 10 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
description: RabbitMQ {{`{{ $labels.namespace }}`}}/{{`{{ $labels.pod}}`}} Memory Usage > 90%
|
||||
summary: RabbitMQ Node > 90% Memory Usage
|
||||
- alert: RabbitMqFileDescriptorsLow
|
||||
expr: (rabbitmq_fd_used{service="{{ template "rabbitmq-ha.fullname" . }}"} / rabbitmq_fd_total{service="{{ template "rabbitmq-ha.fullname" . }}"}) > .9
|
||||
for: 5m
|
||||
labels:
|
||||
installed_by: {{ .Release.Name }}
|
||||
severity: critical
|
||||
{{- if .Values.prometheus.operator.alerts.labels }}
|
||||
{{ toYaml .Values.prometheus.operator.alerts.labels | indent 10 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
description: RabbitMQ {{`{{ $labels.namespace }}`}}/{{`{{ $labels.pod}}`}} File Descriptor Usage > 90%
|
||||
summary: RabbitMQ Low File Descriptor Available
|
||||
- alert: RabbitMqDiskSpaceLow
|
||||
expr: predict_linear(rabbitmq_node_disk_free{service="{{ template "rabbitmq-ha.fullname" . }}"}[15m], 1 * 60 * 60) < rabbitmq_node_disk_free_limit{service="{{ template "rabbitmq-ha.fullname" . }}"}
|
||||
for: 5m
|
||||
labels:
|
||||
installed_by: {{ .Release.Name }}
|
||||
severity: critical
|
||||
{{- if .Values.prometheus.operator.alerts.labels }}
|
||||
{{ toYaml .Values.prometheus.operator.alerts.labels | indent 10 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
description: RabbitMQ {{`{{ $labels.namespace }}`}}/{{`{{ $labels.pod}}`}} will hit disk limit in the next hr based on last 15 mins trend.
|
||||
summary: RabbitMQ is Low on Disk Space and will Run Out in the next hour
|
||||
{{ end }}
|
||||
@@ -0,0 +1,136 @@
|
||||
{{- if not .Values.existingConfigMap }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
enabled_plugins: |
|
||||
[
|
||||
{{ .Values.extraPlugins | indent 6 }}
|
||||
{{- if .Values.rabbitmqLDAPPlugin.enabled }}
|
||||
rabbitmq_auth_backend_ldap,
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.rabbitmqMQTTPlugin.enabled }}
|
||||
rabbitmq_mqtt,
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.rabbitmqWebMQTTPlugin.enabled }}
|
||||
rabbitmq_web_mqtt,
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.rabbitmqSTOMPPlugin.enabled }}
|
||||
rabbitmq_stomp,
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.rabbitmqWebSTOMPPlugin.enabled }}
|
||||
rabbitmq_web_stomp,
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.rabbitmqAuth.enabled }}
|
||||
rabbitmq_auth_mechanism_ssl,
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.rabbitmqAuthHTTP.enabled }}
|
||||
rabbitmq_auth_backend_http,
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.rabbitmqPrometheusPlugin.enabled }}
|
||||
rabbitmq_prometheus,
|
||||
{{- end }}
|
||||
|
||||
rabbitmq_consistent_hash_exchange,
|
||||
rabbitmq_management,
|
||||
rabbitmq_peer_discovery_k8s
|
||||
|
||||
].
|
||||
|
||||
rabbitmq.conf: |
|
||||
## RabbitMQ configuration
|
||||
## Ref: https://github.com/rabbitmq/rabbitmq-server/blob/master/docs/rabbitmq.conf.example
|
||||
|
||||
## Authentification
|
||||
{{- if .Values.rabbitmqAuth.enabled }}
|
||||
{{ .Values.rabbitmqAuth.config | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
## Clustering
|
||||
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_k8s
|
||||
cluster_formation.k8s.host = kubernetes.default.svc.{{ .Values.clusterDomain }}
|
||||
cluster_formation.k8s.address_type = hostname
|
||||
cluster_formation.node_cleanup.interval = 10
|
||||
# Set to false if automatic cleanup of absent nodes is desired.
|
||||
# This can be dangerous, see http://www.rabbitmq.com/cluster-formation.html#node-health-checks-and-cleanup.
|
||||
cluster_formation.node_cleanup.only_log_warning = true
|
||||
cluster_partition_handling = {{ .Values.rabbitmqClusterPartitionHandling }}
|
||||
|
||||
{{- if eq .Values.rabbitmqUsername "guest" }}
|
||||
## The default "guest" user is only permitted to access the server
|
||||
## via a loopback interface (e.g. localhost)
|
||||
loopback_users.guest = false
|
||||
{{- end }}
|
||||
|
||||
management.load_definitions = /etc/definitions/definitions.json
|
||||
|
||||
## Memory-based Flow Control threshold
|
||||
vm_memory_high_watermark.{{ .Values.rabbitmqMemoryHighWatermarkType }} = {{ .Values.rabbitmqMemoryHighWatermark }}
|
||||
|
||||
## Auth HTTP Backend Plugin
|
||||
{{- if .Values.rabbitmqAuthHTTP.enabled }}
|
||||
{{ .Values.rabbitmqAuthHTTP.config | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
## LDAP Plugin
|
||||
{{- if .Values.rabbitmqLDAPPlugin.enabled }}
|
||||
{{ .Values.rabbitmqLDAPPlugin.config | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
## MQTT Plugin
|
||||
{{- if .Values.rabbitmqMQTTPlugin.enabled }}
|
||||
{{ .Values.rabbitmqMQTTPlugin.config | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
## Web MQTT Plugin
|
||||
{{- if .Values.rabbitmqWebMQTTPlugin.enabled }}
|
||||
{{ .Values.rabbitmqWebMQTTPlugin.config | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
## STOMP Plugin
|
||||
{{- if .Values.rabbitmqSTOMPPlugin.enabled }}
|
||||
{{ .Values.rabbitmqSTOMPPlugin.config | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
## Web STOMP Plugin
|
||||
{{- if .Values.rabbitmqWebSTOMPPlugin.enabled }}
|
||||
{{ .Values.rabbitmqWebSTOMPPlugin.config | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
## Prometheus Plugin
|
||||
{{- if .Values.rabbitmqPrometheusPlugin.enabled }}
|
||||
{{ .Values.rabbitmqPrometheusPlugin.config | indent 4 }}
|
||||
prometheus.path = {{ .Values.rabbitmqPrometheusPlugin.path }}
|
||||
prometheus.tcp.port = {{ .Values.rabbitmqPrometheusPlugin.port }}
|
||||
{{- end }}
|
||||
|
||||
## AMQPS support
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
{{ .Values.rabbitmqAmqpsSupport.config | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{ .Values.extraConfig | indent 4 }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.advancedConfig }}
|
||||
advanced.config: |
|
||||
{{ .Values.advancedConfig | indent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,40 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.ingress.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
rules:
|
||||
{{- if .Values.ingress.hostName }}
|
||||
- host: {{ .Values.ingress.hostName }}
|
||||
http:
|
||||
{{- else }}
|
||||
- http:
|
||||
{{- end }}
|
||||
paths:
|
||||
- path: {{ .Values.ingress.path }}
|
||||
backend:
|
||||
serviceName: {{ template "rabbitmq-ha.fullname" . }}
|
||||
servicePort: {{ .Values.rabbitmqManagerPort }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
- secretName: {{ .Values.ingress.tlsSecret }}
|
||||
{{- if .Values.ingress.hostName }}
|
||||
hosts:
|
||||
- {{ .Values.ingress.hostName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if .Values.podDisruptionBudget -}}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{ toYaml .Values.podDisruptionBudget | indent 2 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 4 }}
|
||||
{{- end }}
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["endpoints"]
|
||||
verbs: ["get"]
|
||||
{{- end }}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 4 }}
|
||||
{{- end }}
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "rabbitmq-ha.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,47 @@
|
||||
{{ if not .Values.existingSecret }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 4 }}
|
||||
{{- end }}
|
||||
type: Opaque
|
||||
data:
|
||||
{{- $password := .Values.rabbitmqPassword | default (randAlphaNum 24 | nospace) -}}
|
||||
{{- $_ := set .Values "rabbitmqPassword" $password }}
|
||||
{{- $managementPassword := .Values.managementPassword | default (randAlphaNum 24 | nospace) -}}
|
||||
{{- $_ := set .Values "managementPassword" $managementPassword }}
|
||||
rabbitmq-username: {{ .Values.rabbitmqUsername | b64enc | quote }}
|
||||
rabbitmq-password: {{ .Values.rabbitmqPassword | b64enc | quote }}
|
||||
rabbitmq-management-username: {{ .Values.managementUsername | b64enc | quote }}
|
||||
rabbitmq-management-password: {{ .Values.managementPassword | b64enc | quote }}
|
||||
rabbitmq-erlang-cookie: {{ .Values.rabbitmqErlangCookie | default (randAlphaNum 32) | b64enc | quote }}
|
||||
{{ .Values.definitionsSource }}: {{ include "rabbitmq-ha.definitions" . | b64enc | quote }}
|
||||
{{ end }}
|
||||
{{- if and .Values.rabbitmqCert.enabled (not .Values.rabbitmqCert.existingSecret) }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}-cert
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 4 }}
|
||||
{{- end }}
|
||||
type: Opaque
|
||||
data:
|
||||
cacert.pem: {{ .Values.rabbitmqCert.cacertfile | quote }}
|
||||
cert.pem: {{ .Values.rabbitmqCert.certfile | quote }}
|
||||
key.pem: {{ .Values.rabbitmqCert.keyfile | quote }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,75 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
{{- if .Values.service.discovery.annotations }}
|
||||
annotations:
|
||||
{{ tpl (toYaml .Values.discovery.annotations) . | indent 4 }}
|
||||
{{- else if and (.Values.service.annotations) (not .Values.service.discovery.separateAnnotations) }}
|
||||
annotations:
|
||||
{{ tpl (toYaml .Values.service.annotations) . | indent 4 }}
|
||||
{{- end }}
|
||||
name: {{ printf "%s-discovery" (include "rabbitmq-ha.fullname" .) | trunc 63 | trimSuffix "-" }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: {{ .Values.rabbitmqManagerPort }}
|
||||
targetPort: http
|
||||
- name: amqp
|
||||
protocol: TCP
|
||||
port: {{ .Values.rabbitmqNodePort }}
|
||||
targetPort: amqp
|
||||
- name: epmd
|
||||
protocol: TCP
|
||||
port: {{ .Values.rabbitmqEpmdPort }}
|
||||
targetPort: epmd
|
||||
{{- if .Values.rabbitmqSTOMPPlugin.enabled }}
|
||||
- name: stomp-tcp
|
||||
protocol: TCP
|
||||
port: 61613
|
||||
targetPort: stomp-tcp
|
||||
- name: stomp-ssl
|
||||
protocol: TCP
|
||||
port: 61614
|
||||
targetPort: stomp-ssl
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqWebSTOMPPlugin.enabled }}
|
||||
- name: stomp-ws
|
||||
protocol: TCP
|
||||
port: 15674
|
||||
targetPort: stomp-ws
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqMQTTPlugin.enabled }}
|
||||
- name: mqtt-tcp
|
||||
protocol: TCP
|
||||
port: 1883
|
||||
targetPort: mqtt-tcp
|
||||
- name: mqtt-ssl
|
||||
protocol: TCP
|
||||
port: 8883
|
||||
targetPort: mqtt-ssl
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqWebMQTTPlugin.enabled }}
|
||||
- name: mqtt-ws
|
||||
protocol: TCP
|
||||
port: 15675
|
||||
targetPort: mqtt-ws
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
- name: amqps
|
||||
protocol: TCP
|
||||
port: {{ .Values.rabbitmqAmqpsSupport.amqpsNodePort }}
|
||||
targetPort: amqps
|
||||
{{- end }}
|
||||
publishNotReadyAddresses: true
|
||||
selector:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
type: ClusterIP
|
||||
@@ -0,0 +1,116 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
{{- if .Values.service.annotations }}
|
||||
annotations:
|
||||
{{ tpl (toYaml .Values.service.annotations) . | indent 4 }}
|
||||
{{- end }}
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if ne .Values.service.type "NodePort" }}
|
||||
{{- if and (eq .Values.service.type "LoadBalancer") (ne .Values.service.clusterIP "None") }}
|
||||
clusterIP: "{{ .Values.service.clusterIP }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.externalIPs }}
|
||||
externalIPs:
|
||||
{{ toYaml .Values.service.externalIPs | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.loadBalancerIP }}
|
||||
loadBalancerIP: "{{ .Values.service.loadBalancerIP }}"
|
||||
{{- end }}
|
||||
{{- if .Values.service.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: "{{ .Values.service.externalTrafficPolicy }}"
|
||||
{{- end }}
|
||||
{{- if .Values.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
- name: amqps
|
||||
protocol: TCP
|
||||
port: {{ .Values.rabbitmqAmqpsSupport.amqpsNodePort }}
|
||||
targetPort: amqps
|
||||
{{- end }}
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: {{ .Values.rabbitmqManagerPort }}
|
||||
{{- if eq .Values.service.type "NodePort" "LoadBalancer" }}
|
||||
nodePort: {{ .Values.service.managerNodePort }}
|
||||
{{- end }}
|
||||
targetPort: http
|
||||
- name: amqp
|
||||
protocol: TCP
|
||||
port: {{ .Values.rabbitmqNodePort }}
|
||||
{{- if eq .Values.service.type "NodePort" "LoadBalancer" }}
|
||||
nodePort: {{ .Values.service.amqpNodePort }}
|
||||
{{- end }}
|
||||
targetPort: amqp
|
||||
- name: epmd
|
||||
protocol: TCP
|
||||
port: {{ .Values.rabbitmqEpmdPort }}
|
||||
{{- if eq .Values.service.type "NodePort" "LoadBalancer" }}
|
||||
nodePort: {{ .Values.service.epmdNodePort }}
|
||||
{{- end }}
|
||||
targetPort: epmd
|
||||
{{- if .Values.rabbitmqSTOMPPlugin.enabled }}
|
||||
- name: stomp-tcp
|
||||
protocol: TCP
|
||||
port: 61613
|
||||
targetPort: stomp-tcp
|
||||
- name: stomp-ssl
|
||||
protocol: TCP
|
||||
port: 61614
|
||||
targetPort: stomp-ssl
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqWebSTOMPPlugin.enabled }}
|
||||
- name: stomp-ws
|
||||
protocol: TCP
|
||||
port: 15674
|
||||
targetPort: stomp-ws
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqMQTTPlugin.enabled }}
|
||||
- name: mqtt-tcp
|
||||
protocol: TCP
|
||||
port: 1883
|
||||
targetPort: mqtt-tcp
|
||||
- name: mqtt-ssl
|
||||
protocol: TCP
|
||||
port: 8883
|
||||
targetPort: mqtt-ssl
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqWebMQTTPlugin.enabled }}
|
||||
- name: mqtt-ws
|
||||
protocol: TCP
|
||||
port: 15675
|
||||
targetPort: mqtt-ws
|
||||
{{- end }}
|
||||
{{ if .Values.prometheus.exporter.enabled }}
|
||||
- name: exporter
|
||||
protocol: TCP
|
||||
port: {{ .Values.prometheus.exporter.port }}
|
||||
targetPort: exporter
|
||||
{{ end }}
|
||||
{{- if .Values.rabbitmqPrometheusPlugin.enabled }}
|
||||
- name: metrics
|
||||
protocol: TCP
|
||||
{{- if eq .Values.service.type "NodePort" "LoadBalancer" }}
|
||||
nodePort: {{ .Values.rabbitmqPrometheusPlugin.nodePort }}
|
||||
{{- end }}
|
||||
port: {{ .Values.rabbitmqPrometheusPlugin.port }}
|
||||
targetPort: metrics
|
||||
{{- end }}
|
||||
selector:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
type: {{ .Values.service.type }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 4 }}
|
||||
{{- end }}
|
||||
name: {{ template "rabbitmq-ha.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,29 @@
|
||||
{{ if and (or .Values.prometheus.exporter.enabled .Values.rabbitmqPrometheusPlugin.enabled) .Values.prometheus.operator.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
namespace: {{ .Values.prometheus.operator.serviceMonitor.namespace }}
|
||||
labels:
|
||||
{{- if .Values.prometheus.operator.serviceMonitor.selector }}
|
||||
{{ toYaml .Values.prometheus.operator.serviceMonitor.selector | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
endpoints:
|
||||
- interval: {{ .Values.prometheus.operator.serviceMonitor.interval }}
|
||||
{{- if .Values.prometheus.operator.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.prometheus.operator.serviceMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqPrometheusPlugin.enabled }}
|
||||
port: metrics
|
||||
path: {{ .Values.rabbitmqPrometheusPlugin.path }}
|
||||
{{- else }}
|
||||
port: exporter
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
any: true
|
||||
{{- end }}
|
||||
@@ -0,0 +1,358 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
chart: {{ template "rabbitmq-ha.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.statefulSetAnnotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.statefulSetAnnotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
podManagementPolicy: {{ .Values.podManagementPolicy }}
|
||||
serviceName: {{ template "rabbitmq-ha.fullname" . }}-discovery
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
updateStrategy:
|
||||
type: {{ .Values.updateStrategy }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- if .Values.extraLabels }}
|
||||
{{ toYaml .Values.extraLabels | indent 8 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if not .Values.existingConfigMap }}
|
||||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||
{{- end }}
|
||||
{{- if not .Values.existingSecret }}
|
||||
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
|
||||
{{- end }}
|
||||
{{- if and .Values.prometheus.exporter.enabled (not .Values.prometheus.operator.enabled) }}
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: {{ .Values.prometheus.exporter.port | quote }}
|
||||
{{- end }}
|
||||
{{- if and .Values.rabbitmqPrometheusPlugin.enabled (not .Values.prometheus.operator.enabled) }}
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: {{ .Values.rabbitmqPrometheusPlugin.port | quote }}
|
||||
prometheus.io/path: {{ .Values.rabbitmqPrometheusPlugin.path | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.podAnnotations }}
|
||||
{{ toYaml .Values.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
securityContext:
|
||||
{{ toYaml .Values.securityContext | indent 10 }}
|
||||
serviceAccountName: {{ template "rabbitmq-ha.serviceAccountName" . }}
|
||||
initContainers:
|
||||
{{- if .Values.initContainer.enabled }}
|
||||
- name: bootstrap
|
||||
image: {{ .Values.busyboxImage.repository}}:{{ .Values.busyboxImage.tag}}
|
||||
imagePullPolicy: {{ .Values.busyboxImage.pullPolicy }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.initContainer.securityContext | nindent 12 }}
|
||||
command: ['sh']
|
||||
args:
|
||||
- "-c"
|
||||
- |
|
||||
set -ex
|
||||
cp /configmap/* /etc/rabbitmq
|
||||
echo "${RABBITMQ_ERLANG_COOKIE}" > /var/lib/rabbitmq/.erlang.cookie
|
||||
{{- if .Values.forceBoot }}
|
||||
if [ -d "${RABBITMQ_MNESIA_DIR}" ]; then
|
||||
touch "${RABBITMQ_MNESIA_DIR}/force_load"
|
||||
fi
|
||||
{{- end }}
|
||||
{{- if and (.Values.securityContext.runAsUser) (.Values.securityContext.fsGroup) (.Values.initContainer.chownFiles) }}
|
||||
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /var/lib/rabbitmq/
|
||||
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /etc/rabbitmq
|
||||
{{- end }}
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.name
|
||||
- name: RABBITMQ_MNESIA_DIR
|
||||
value: /var/lib/rabbitmq/mnesia/rabbit@$(POD_NAME).{{ template "rabbitmq-ha.fullname" . }}-discovery.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
|
||||
- name: RABBITMQ_ERLANG_COOKIE
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "rabbitmq-ha.secretName" . }}
|
||||
key: rabbitmq-erlang-cookie
|
||||
resources:
|
||||
{{ toYaml .Values.initContainer.resources | indent 12 }}
|
||||
volumeMounts:
|
||||
- name: configmap
|
||||
mountPath: /configmap
|
||||
- name: config
|
||||
mountPath: /etc/rabbitmq
|
||||
- name: {{ .Values.persistentVolume.name }}
|
||||
mountPath: /var/lib/rabbitmq
|
||||
{{- end}}
|
||||
{{- if .Values.extraInitContainers }}
|
||||
{{ tpl (toYaml .Values.extraInitContainers) . | indent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: epmd
|
||||
protocol: TCP
|
||||
containerPort: 4369
|
||||
- name: amqp
|
||||
protocol: TCP
|
||||
containerPort: 5672
|
||||
- name: http
|
||||
protocol: TCP
|
||||
containerPort: 15672
|
||||
{{- if .Values.rabbitmqSTOMPPlugin.enabled }}
|
||||
- name: stomp-tcp
|
||||
protocol: TCP
|
||||
containerPort: 61613
|
||||
- name: stomp-ssl
|
||||
protocol: TCP
|
||||
containerPort: 61614
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqWebSTOMPPlugin.enabled }}
|
||||
- name: stomp-ws
|
||||
protocol: TCP
|
||||
containerPort: 15674
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqMQTTPlugin.enabled }}
|
||||
- name: mqtt-tcp
|
||||
protocol: TCP
|
||||
containerPort: 1883
|
||||
- name: mqtt-ssl
|
||||
protocol: TCP
|
||||
containerPort: 8883
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqWebMQTTPlugin.enabled }}
|
||||
- name: mqtt-ws
|
||||
protocol: TCP
|
||||
containerPort: 15675
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqAmqpsSupport.enabled }}
|
||||
- name: amqps
|
||||
protocol: TCP
|
||||
containerPort: 5671
|
||||
{{- end }}
|
||||
{{- if .Values.rabbitmqPrometheusPlugin.enabled }}
|
||||
- name: metrics
|
||||
protocol: TCP
|
||||
containerPort: {{ .Values.rabbitmqPrometheusPlugin.port }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
{{- toYaml .Values.livenessProbe | trim | nindent 12 }}
|
||||
readinessProbe:
|
||||
{{- toYaml .Values.readinessProbe | trim | nindent 12 }}
|
||||
{{- if .Values.lifecycle }}
|
||||
lifecycle:
|
||||
{{- toYaml .Values.lifecycle | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: MY_POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.name
|
||||
- name: RABBITMQ_USE_LONGNAME
|
||||
value: "true"
|
||||
- name: RABBITMQ_NODENAME
|
||||
value: rabbit@$(MY_POD_NAME).{{ template "rabbitmq-ha.fullname" . }}-discovery.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
|
||||
- name: K8S_HOSTNAME_SUFFIX
|
||||
value: .{{ template "rabbitmq-ha.fullname" . }}-discovery.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
|
||||
- name: K8S_SERVICE_NAME
|
||||
value: {{ template "rabbitmq-ha.fullname" . }}-discovery
|
||||
- name: RABBITMQ_ERLANG_COOKIE
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "rabbitmq-ha.secretName" . }}
|
||||
key: rabbitmq-erlang-cookie
|
||||
- name: RABBIT_MANAGEMENT_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "rabbitmq-ha.secretName" . }}
|
||||
key: rabbitmq-management-username
|
||||
- name: RABBIT_MANAGEMENT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "rabbitmq-ha.secretName" . }}
|
||||
key: rabbitmq-management-password
|
||||
{{- if .Values.rabbitmqHipeCompile }}
|
||||
- name: RABBITMQ_HIPE_COMPILE
|
||||
value: {{ .Values.rabbitmqHipeCompile | quote }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.env }}
|
||||
- name: {{ $key }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
volumeMounts:
|
||||
- name: {{ .Values.persistentVolume.name }}
|
||||
mountPath: /var/lib/rabbitmq
|
||||
- name: config
|
||||
mountPath: /etc/rabbitmq
|
||||
- name: definitions
|
||||
mountPath: /etc/definitions
|
||||
readOnly: true
|
||||
{{- if .Values.rabbitmqCert.enabled }}
|
||||
- name: cert
|
||||
mountPath: /etc/cert
|
||||
{{- end }}
|
||||
{{- if .Values.extraVolumeMounts }}
|
||||
{{ toYaml .Values.extraVolumeMounts | indent 12 }}
|
||||
{{- end }}
|
||||
{{ if .Values.prometheus.exporter.enabled }}
|
||||
- name: {{ .Chart.Name }}-exporter
|
||||
image: {{ .Values.prometheus.exporter.image.repository }}:{{ .Values.prometheus.exporter.image.tag }}
|
||||
imagePullPolicy: {{ .Values.prometheus.exporter.image.pullPolicy }}
|
||||
ports:
|
||||
- name: exporter
|
||||
protocol: TCP
|
||||
containerPort: {{ .Values.prometheus.exporter.port }}
|
||||
env:
|
||||
- name: PUBLISH_PORT
|
||||
value: "{{ .Values.prometheus.exporter.port }}"
|
||||
{{ if .Values.prometheus.exporter.capabilities }}
|
||||
- name: RABBIT_CAPABILITIES
|
||||
value: "{{ .Values.prometheus.exporter.capabilities }}"
|
||||
{{- end }}
|
||||
- name: RABBIT_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "rabbitmq-ha.secretName" . }}
|
||||
key: rabbitmq-username
|
||||
- name: RABBIT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "rabbitmq-ha.secretName" . }}
|
||||
key: rabbitmq-password
|
||||
{{- range $key, $value := .Values.prometheus.exporter.env }}
|
||||
- name: {{ $key }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.prometheus.exporter.resources | indent 12 }}
|
||||
{{ end }}
|
||||
{{- if .Values.extraContainers }}
|
||||
{{ tpl (toYaml .Values.extraContainers) . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml .Values.tolerations | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.schedulerName }}
|
||||
schedulerName: "{{ .Values.schedulerName }}"
|
||||
{{- end }}
|
||||
{{- if .Values.affinity }}
|
||||
affinity:
|
||||
{{- with .Values.affinity }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- if eq .Values.podAntiAffinity "hard" }}
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- topologyKey: "{{ .Values.podAntiAffinityTopologyKey }}"
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- else if eq .Values.podAntiAffinity "soft" }}
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 1
|
||||
podAffinityTerm:
|
||||
topologyKey: "{{ .Values.podAntiAffinityTopologyKey }}"
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app: {{ template "rabbitmq-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.priorityClassName }}
|
||||
priorityClassName: {{ .Values.priorityClassName }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
emptyDir: {}
|
||||
- name: configmap
|
||||
configMap:
|
||||
name: {{ template "rabbitmq-ha.fullname" . }}
|
||||
- name: definitions
|
||||
secret:
|
||||
secretName: {{ template "rabbitmq-ha.secretName" . }}
|
||||
items:
|
||||
- key: {{ .Values.definitionsSource }}
|
||||
path: definitions.json
|
||||
{{- if .Values.rabbitmqCert.enabled }}
|
||||
- name: cert
|
||||
secret:
|
||||
defaultMode: 420
|
||||
secretName: {{ template "rabbitmq-ha.certSecretName" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraVolumes }}
|
||||
{{ toYaml .Values.extraVolumes | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.persistentVolume.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: {{ .Values.persistentVolume.name }}
|
||||
annotations:
|
||||
{{ tpl (toYaml .Values.persistentVolume.annotations) . | indent 10 }}
|
||||
labels:
|
||||
{{ tpl (toYaml .Values.persistentVolume.labels) . | indent 10 }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.persistentVolume.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistentVolume.size | quote }}
|
||||
{{- if .Values.persistentVolume.storageClass }}
|
||||
{{- if (eq "-" .Values.persistentVolume.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistentVolume.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.persistentVolume.selector }}
|
||||
selector:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: {{ .Values.persistentVolume.name }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,597 @@
|
||||
## RabbitMQ application credentials
|
||||
## Ref: http://rabbitmq.com/access-control.html
|
||||
##
|
||||
rabbitmqUsername: guest
|
||||
# rabbitmqPassword:
|
||||
|
||||
## RabbitMQ Management user used for health checks
|
||||
managementUsername: management
|
||||
# managementPassword:
|
||||
|
||||
## Place any additional key/value configuration to add to rabbitmq.conf
|
||||
## Ref: https://www.rabbitmq.com/configure.html#config-items
|
||||
extraConfig: |
|
||||
# queue_master_locator = min-masters
|
||||
|
||||
## Place advanced.config file in /etc/rabbitmq/advanced.config
|
||||
## Ref: https://www.rabbitmq.com/configure.html#advanced-config-file
|
||||
advancedConfig: |
|
||||
|
||||
## Definitions specification within the secret, will always be mounted
|
||||
## at /etc/definitions/defintions.json
|
||||
definitionsSource: definitions.json
|
||||
|
||||
## Place any additional plugins to enable in /etc/rabbitmq/enabled_plugins
|
||||
## Ref: https://www.rabbitmq.com/plugins.html
|
||||
extraPlugins: |
|
||||
rabbitmq_shovel,
|
||||
rabbitmq_shovel_management,
|
||||
rabbitmq_federation,
|
||||
rabbitmq_federation_management,
|
||||
|
||||
definitions:
|
||||
globalParameters: |-
|
||||
# {
|
||||
# "name": "cluster_name",
|
||||
# "value": "rabbitmq-ha"
|
||||
# }
|
||||
users: |-
|
||||
# {
|
||||
# "name": "myUsername",
|
||||
# "password": "myPassword",
|
||||
# "tags": "administrator"
|
||||
# }
|
||||
vhosts: |-
|
||||
# {
|
||||
# "name": "/rabbit"
|
||||
# }
|
||||
parameters: |-
|
||||
# {
|
||||
# "value": {
|
||||
# "src-uri": "amqp://localhost",
|
||||
# "src-queue": "source",
|
||||
# "dest-uri": "amqp://localhost",
|
||||
# "dest-queue": "destination",
|
||||
# "add-forward-headers": false,
|
||||
# "ack-mode": "on-confirm",
|
||||
# "delete-after": "never"
|
||||
# },
|
||||
# "vhost": "/",
|
||||
# "component": "shovel",
|
||||
# "name": "test"
|
||||
# }
|
||||
permissions: |-
|
||||
# {
|
||||
# "user": "myUsername",
|
||||
# "vhost": "/rabbit",
|
||||
# "configure": ".*",
|
||||
# "write": ".*",
|
||||
# "read": ".*"
|
||||
# }
|
||||
topicPermissions: |-
|
||||
# {
|
||||
# "user": "myUsername",
|
||||
# "vhost": "/rabbit",
|
||||
# "exchange": "myexchange",
|
||||
# "write": ".*",
|
||||
# "read": ".*"
|
||||
# }
|
||||
queues: |-
|
||||
# {
|
||||
# "name":"myName",
|
||||
# "vhost":"/rabbit",
|
||||
# "durable":true,
|
||||
# "auto_delete":false,
|
||||
# "arguments":{}
|
||||
# }
|
||||
exchanges: |-
|
||||
# {
|
||||
# "name":"myName",
|
||||
# "vhost":"/rabbit",
|
||||
# "type":"direct",
|
||||
# "durable":true,
|
||||
# "auto_delete":false,
|
||||
# "internal":false,
|
||||
# "arguments":{}
|
||||
# }
|
||||
bindings: |-
|
||||
# {
|
||||
# "source":"myName",
|
||||
# "vhost":"/rabbit",
|
||||
# "destination":"myName",
|
||||
# "destination_type":"queue",
|
||||
# "routing_key":"myKey",
|
||||
# "arguments":{}
|
||||
# }
|
||||
## Sets the policies in definitions.json. This can be used to control the high
|
||||
## availability of queues by mirroring them to multiple nodes.
|
||||
## Ref: https://www.rabbitmq.com/ha.html
|
||||
policies: |-
|
||||
# {
|
||||
# "name": "ha-all",
|
||||
# "pattern": ".*",
|
||||
# "vhost": "/",
|
||||
# "definition": {
|
||||
# "ha-mode": "all",
|
||||
# "ha-sync-mode": "automatic",
|
||||
# "ha-sync-batch-size": 1
|
||||
# }
|
||||
# }
|
||||
|
||||
## Ref: https://www.rabbitmq.com/rabbitmqctl.8.html#force_boot
|
||||
forceBoot: false
|
||||
|
||||
## RabbitMQ default VirtualHost
|
||||
## Ref: https://www.rabbitmq.com/vhosts.html
|
||||
##
|
||||
rabbitmqVhost: "/"
|
||||
|
||||
## Erlang cookie to determine whether different nodes are allowed to communicate with each other
|
||||
## Ref: https://www.rabbitmq.com/clustering.html
|
||||
##
|
||||
# rabbitmqErlangCookie:
|
||||
|
||||
## RabbitMQ Memory high watermark
|
||||
## Ref: http://www.rabbitmq.com/memory.html
|
||||
##
|
||||
rabbitmqMemoryHighWatermark: 256MB
|
||||
rabbitmqMemoryHighWatermarkType: absolute
|
||||
|
||||
## EPMD port for peer discovery service used by RabbitMQ nodes and CLI tools
|
||||
## Ref: https://www.rabbitmq.com/clustering.html
|
||||
##
|
||||
rabbitmqEpmdPort: 4369
|
||||
|
||||
## Node port
|
||||
rabbitmqNodePort: 5672
|
||||
|
||||
## Manager port
|
||||
rabbitmqManagerPort: 15672
|
||||
|
||||
## Set to true to precompile parts of RabbitMQ with HiPE, a just-in-time
|
||||
## compiler for Erlang. This will increase server throughput at the cost of
|
||||
## increased startup time. You might see 20-50% better performance at the cost
|
||||
## of a few minutes delay at startup.
|
||||
rabbitmqHipeCompile: false
|
||||
|
||||
## SSL certificates
|
||||
## Red: http://www.rabbitmq.com/ssl.html
|
||||
rabbitmqCert:
|
||||
enabled: false
|
||||
|
||||
# Specifies an existing secret to be used for SSL Certs
|
||||
existingSecret: ""
|
||||
|
||||
## Create a new secret using these values
|
||||
cacertfile: |
|
||||
certfile: |
|
||||
keyfile: |
|
||||
|
||||
## Extra volumes for statefulset
|
||||
extraVolumes: []
|
||||
|
||||
## Extra volume mounts for statefulset
|
||||
extraVolumeMounts: []
|
||||
|
||||
## Authentication mechanism
|
||||
## Ref: http://www.rabbitmq.com/authentication.html
|
||||
rabbitmqAuth:
|
||||
enabled: false
|
||||
|
||||
config: |
|
||||
# auth_mechanisms.1 = PLAIN
|
||||
# auth_mechanisms.2 = AMQPLAIN
|
||||
# auth_mechanisms.3 = EXTERNAL
|
||||
|
||||
## Automatic Partition Handling Strategy (split brain handling)
|
||||
## Ref: https://www.rabbitmq.com/partitions.html#automatic-handling
|
||||
## Note: pause-if-all-down is not supported without using a custom configmap since it requires extra
|
||||
## configuration.
|
||||
|
||||
rabbitmqClusterPartitionHandling: autoheal
|
||||
|
||||
## Authentication backend
|
||||
## Ref: https://github.com/rabbitmq/rabbitmq-auth-backend-http
|
||||
rabbitmqAuthHTTP:
|
||||
enabled: false
|
||||
|
||||
config: |
|
||||
# auth_backends.1 = http
|
||||
# auth_http.user_path = http://some-server/auth/user
|
||||
# auth_http.vhost_path = http://some-server/auth/vhost
|
||||
# auth_http.resource_path = http://some-server/auth/resource
|
||||
# auth_http.topic_path = http://some-server/auth/topic
|
||||
|
||||
## LDAP Plugin
|
||||
## Ref: http://www.rabbitmq.com/ldap.html
|
||||
rabbitmqLDAPPlugin:
|
||||
enabled: false
|
||||
|
||||
## LDAP configuration:
|
||||
config: |
|
||||
# auth_backends.1 = ldap
|
||||
# auth_ldap.servers.1 = my-ldap-server
|
||||
# auth_ldap.user_dn_pattern = cn=${username},ou=People,dc=example,dc=com
|
||||
# auth_ldap.use_ssl = false
|
||||
# auth_ldap.port = 389
|
||||
# auth_ldap.log = false
|
||||
|
||||
## MQTT Plugin
|
||||
## Ref: http://www.rabbitmq.com/mqtt.html
|
||||
rabbitmqMQTTPlugin:
|
||||
enabled: false
|
||||
|
||||
## MQTT configuration:
|
||||
config: |
|
||||
# mqtt.default_user = guest
|
||||
# mqtt.default_pass = guest
|
||||
# mqtt.allow_anonymous = true
|
||||
|
||||
## Web MQTT Plugin
|
||||
## Ref: http://www.rabbitmq.com/web-mqtt.html
|
||||
rabbitmqWebMQTTPlugin:
|
||||
enabled: false
|
||||
|
||||
## Web MQTT configuration:
|
||||
config: |
|
||||
# web_mqtt.ssl.port = 12345
|
||||
# web_mqtt.ssl.backlog = 1024
|
||||
# web_mqtt.ssl.certfile = /etc/cert/cacert.pem
|
||||
# web_mqtt.ssl.keyfile = /etc/cert/cert.pem
|
||||
# web_mqtt.ssl.cacertfile = /etc/cert/key.pem
|
||||
# web_mqtt.ssl.password = changeme
|
||||
|
||||
## STOMP Plugin
|
||||
## Ref: http://www.rabbitmq.com/stomp.html
|
||||
rabbitmqSTOMPPlugin:
|
||||
enabled: false
|
||||
|
||||
## STOMP configuration:
|
||||
config: |
|
||||
# stomp.default_user = guest
|
||||
# stomp.default_pass = guest
|
||||
|
||||
## Web STOMP Plugin
|
||||
## Ref: http://www.rabbitmq.com/web-stomp.html
|
||||
rabbitmqWebSTOMPPlugin:
|
||||
enabled: false
|
||||
|
||||
## Web STOMP configuration:
|
||||
config: |
|
||||
# web_stomp.ws_frame = binary
|
||||
# web_stomp.cowboy_opts.max_keepalive = 10
|
||||
|
||||
## Prometheus Plugin
|
||||
## Ref: https://www.rabbitmq.com/prometheus.html
|
||||
rabbitmqPrometheusPlugin:
|
||||
enabled: false
|
||||
|
||||
## NodePort
|
||||
nodePort: null
|
||||
|
||||
## metrics port, overrides configuration:
|
||||
## prometheus.tcp.port
|
||||
port: 15692
|
||||
|
||||
## metrics path, overrides configuration:
|
||||
## prometheus.path
|
||||
path: /metrics
|
||||
|
||||
## Prometheus configuration:
|
||||
## https://github.com/rabbitmq/rabbitmq-prometheus
|
||||
config: |
|
||||
## prometheus.path and prometheus.tcp.port can be set above
|
||||
|
||||
## AMQPS support
|
||||
## Ref: http://www.rabbitmq.com/ssl.html
|
||||
rabbitmqAmqpsSupport:
|
||||
enabled: false
|
||||
|
||||
# NodePort
|
||||
amqpsNodePort: 5671
|
||||
|
||||
# SSL configuration
|
||||
config: |
|
||||
# listeners.ssl.default = 5671
|
||||
# ssl_options.cacertfile = /etc/cert/cacert.pem
|
||||
# ssl_options.certfile = /etc/cert/cert.pem
|
||||
# ssl_options.keyfile = /etc/cert/key.pem
|
||||
# ssl_options.verify = verify_peer
|
||||
# ssl_options.fail_if_no_peer_cert = false
|
||||
|
||||
## Number of replicas
|
||||
replicaCount: 3
|
||||
|
||||
image:
|
||||
repository: rabbitmq
|
||||
tag: 3.8.5-alpine
|
||||
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:
|
||||
# - myRegistrKeySecretName
|
||||
|
||||
busyboxImage:
|
||||
repository: busybox
|
||||
tag: 1.30.1
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
## Duration in seconds the pod needs to terminate gracefully
|
||||
terminationGracePeriodSeconds: 10
|
||||
|
||||
service:
|
||||
annotations: {}
|
||||
clusterIP: None
|
||||
|
||||
## List of IP addresses at which the service is available
|
||||
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
|
||||
##
|
||||
externalIPs: []
|
||||
|
||||
loadBalancerIP: ""
|
||||
externalTrafficPolicy: ""
|
||||
loadBalancerSourceRanges: []
|
||||
type: ClusterIP
|
||||
|
||||
## Customize nodePort number when the service type is NodePort
|
||||
### Ref: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
|
||||
###
|
||||
epmdNodePort: null
|
||||
amqpNodePort: null
|
||||
managerNodePort: null
|
||||
|
||||
## Custom annotations for discovery service
|
||||
## Will fallback to `service.annotations` while `separateAnnotations: false`
|
||||
##
|
||||
discovery:
|
||||
separateAnnotations: false
|
||||
annotations: {}
|
||||
|
||||
podManagementPolicy: OrderedReady
|
||||
|
||||
## Statefulsets rolling update update strategy
|
||||
## Ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#rolling-update
|
||||
##
|
||||
updateStrategy: OnDelete
|
||||
|
||||
## Statefulsets Pod Priority
|
||||
## Ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
|
||||
## priorityClassName: ""
|
||||
|
||||
## 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:'.
|
||||
## If you decide to set the memory limit, make sure to also change the
|
||||
## rabbitmqMemoryHighWatermark following the formula:
|
||||
## rabbitmqMemoryHighWatermark = 0.4 * resources.limits.memory
|
||||
##
|
||||
resources: {}
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 1Gi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 1Gi
|
||||
initContainer:
|
||||
enabled: true
|
||||
securityContext:
|
||||
runAsGroup: 0
|
||||
runAsNonRoot: false
|
||||
runAsUser: 0
|
||||
chownFiles: true
|
||||
resources: {}
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
## Additional init containers
|
||||
extraInitContainers: []
|
||||
|
||||
## Additional containers
|
||||
extraContainers: []
|
||||
|
||||
## Use an alternate scheduler, e.g. "stork".
|
||||
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||
##
|
||||
# schedulerName:
|
||||
|
||||
## Data Persistency
|
||||
persistentVolume:
|
||||
enabled: false
|
||||
## 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: "-"
|
||||
## selector can be used to match an existing PersistentVolume
|
||||
selector: {}
|
||||
name: data
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
size: 8Gi
|
||||
annotations: {}
|
||||
labels: {}
|
||||
|
||||
## Node labels for pod assignment
|
||||
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||
##
|
||||
nodeSelector: {}
|
||||
|
||||
## Node tolerations for pod assignment
|
||||
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||
##
|
||||
tolerations: []
|
||||
|
||||
## Extra Annotations to be added to pod
|
||||
podAnnotations: {}
|
||||
|
||||
## Extra Annotations to be added to the StatefulSet
|
||||
statefulSetAnnotations: {}
|
||||
|
||||
## Pod affinity
|
||||
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
podAntiAffinity: soft
|
||||
podAntiAffinityTopologyKey: "kubernetes.io/hostname"
|
||||
|
||||
## Affinity settings
|
||||
## Defining 'affinity' will disable any podAntiAffinity settings.
|
||||
## If you still need anti-affinity, you must include the configuration here.
|
||||
##
|
||||
affinity: {}
|
||||
|
||||
## Create default configMap
|
||||
##
|
||||
existingConfigMap: false
|
||||
|
||||
## Add additional labels to all resources
|
||||
##
|
||||
extraLabels: {}
|
||||
|
||||
## Role Based Access
|
||||
## Ref: https://kubernetes.io/docs/admin/authorization/rbac/
|
||||
##
|
||||
rbac:
|
||||
create: true
|
||||
|
||||
## Service Account
|
||||
## Ref: https://kubernetes.io/docs/admin/service-accounts-admin/
|
||||
##
|
||||
serviceAccount:
|
||||
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:
|
||||
|
||||
## Automount API credentials for a service account.
|
||||
## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
|
||||
automountServiceAccountToken: true
|
||||
|
||||
ingress:
|
||||
## Set to true to enable ingress record generation
|
||||
enabled: false
|
||||
|
||||
path: /
|
||||
|
||||
## 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
|
||||
## hostName: foo.bar.com
|
||||
|
||||
## Set this to true in order to enable TLS on the ingress record
|
||||
tls: false
|
||||
|
||||
## If TLS is set to true, you must declare what secret will store the key/certificate for TLS
|
||||
tlsSecret: myTlsSecret
|
||||
|
||||
## Ingress annotations done as key:value pairs
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 120
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- 'timeout 5 wget -O - -q --header "Authorization: Basic `echo -n \"$RABBIT_MANAGEMENT_USER:$RABBIT_MANAGEMENT_PASSWORD\" | base64`" http://127.0.0.1:15672/api/healthchecks/node | grep -qF "{\"status\":\"ok\"}"'
|
||||
|
||||
readinessProbe:
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 6
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- 'timeout 3 wget -O - -q --header "Authorization: Basic `echo -n \"$RABBIT_MANAGEMENT_USER:$RABBIT_MANAGEMENT_PASSWORD\" | base64`" http://127.0.0.1:15672/api/healthchecks/node | grep -qF "{\"status\":\"ok\"}"'
|
||||
|
||||
# Specifies an existing secret to be used for RMQ password, management user password and Erlang Cookie
|
||||
existingSecret: ""
|
||||
|
||||
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
fsGroup: 101
|
||||
runAsGroup: 101
|
||||
runAsNonRoot: true
|
||||
runAsUser: 100
|
||||
|
||||
## Sets environment variables for the rabbitmq container
|
||||
env: {}
|
||||
|
||||
prometheus:
|
||||
## Configures Prometheus Exporter to expose and scrape stats.
|
||||
exporter:
|
||||
enabled: false
|
||||
env: {}
|
||||
image:
|
||||
repository: kbudde/rabbitmq-exporter
|
||||
tag: v0.29.0
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
## Port Prometheus scrapes for metrics
|
||||
port: 9090
|
||||
## Comma-separated list of extended scraping capabilities supported by the target RabbitMQ server
|
||||
capabilities: "bert,no_sort"
|
||||
|
||||
## Allow overriding of container resources
|
||||
resources: {}
|
||||
# limits:
|
||||
# cpu: 200m
|
||||
# memory: 1Gi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 100Mi
|
||||
|
||||
## Prometheus is using Operator. Setting to true will create Operator specific resources like ServiceMonitors and Alerts
|
||||
operator:
|
||||
## Are you using Prometheus Operator? [Blog Post](https://coreos.com/blog/the-prometheus-operator.html)
|
||||
enabled: true
|
||||
|
||||
## Configures Alerts, which will be setup via Prometheus Operator / ConfigMaps.
|
||||
alerts:
|
||||
## Prometheus exporter must be enabled as well
|
||||
enabled: true
|
||||
|
||||
## Selector must be configured to match Prometheus Install, defaulting to whats done by Prometheus Operator
|
||||
## See [CoreOS Prometheus Chart](https://github.com/coreos/prometheus-operator/tree/master/helm)
|
||||
selector:
|
||||
role: alert-rules
|
||||
labels: {}
|
||||
|
||||
serviceMonitor:
|
||||
## Interval at which Prometheus scrapes RabbitMQ Exporter
|
||||
interval: 10s
|
||||
|
||||
# Namespace Prometheus is installed in
|
||||
namespace: monitoring
|
||||
|
||||
## Defaults to whats used if you follow CoreOS [Prometheus Install Instructions](https://github.com/coreos/prometheus-operator/tree/master/helm#tldr)
|
||||
## [Prometheus Selector Label](https://github.com/coreos/prometheus-operator/blob/master/helm/prometheus/templates/prometheus.yaml#L65)
|
||||
## [Kube Prometheus Selector Label](https://github.com/coreos/prometheus-operator/blob/master/helm/kube-prometheus/values.yaml#L298)
|
||||
selector:
|
||||
prometheus: kube-prometheus
|
||||
|
||||
## Kubernetes Cluster Domain
|
||||
clusterDomain: cluster.local
|
||||
|
||||
## Pod Disruption Budget
|
||||
podDisruptionBudget: {}
|
||||
# maxUnavailable: 1
|
||||
# minAvailable: 1
|
||||
|
||||
lifecycle: {}
|
||||
@@ -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
|
||||
@@ -0,0 +1,20 @@
|
||||
annotations:
|
||||
category: Infrastructure
|
||||
apiVersion: v1
|
||||
appVersion: 3.8.9
|
||||
description: Open source message broker software that implements the Advanced Message
|
||||
Queuing Protocol (AMQP)
|
||||
home: https://github.com/bitnami/charts/tree/master/bitnami/rabbitmq
|
||||
icon: https://bitnami.com/assets/stacks/rabbitmq/img/rabbitmq-stack-220x234.png
|
||||
keywords:
|
||||
- rabbitmq
|
||||
- message queue
|
||||
- AMQP
|
||||
maintainers:
|
||||
- email: containers@bitnami.com
|
||||
name: Bitnami
|
||||
name: rabbitmq
|
||||
sources:
|
||||
- https://github.com/bitnami/bitnami-docker-rabbitmq
|
||||
- https://www.rabbitmq.com
|
||||
version: 7.7.1
|
||||
@@ -0,0 +1,602 @@
|
||||
# RabbitMQ
|
||||
|
||||
[RabbitMQ](https://www.rabbitmq.com/) is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP).
|
||||
|
||||
## TL;DR
|
||||
|
||||
```bash
|
||||
$ helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
$ helm install my-release bitnami/rabbitmq
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a [RabbitMQ](https://github.com/bitnami/bitnami-docker-rabbitmq) 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`:
|
||||
|
||||
```bash
|
||||
$ helm install my-release bitnami/rabbitmq
|
||||
```
|
||||
|
||||
The command deploys RabbitMQ 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 RabbitMQ 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` |
|
||||
|
||||
### Common parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
||||
| `nameOverride` | String to partially override rabbitmq.fullname | `nil` |
|
||||
| `fullnameOverride` | String to fully override rabbitmq.fullname | `nil` |
|
||||
| `clusterDomain` | Default Kubernetes cluster domain | `cluster.local` |
|
||||
|
||||
### RabbitMQ parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
||||
| `image.registry` | RabbitMQ image registry | `docker.io` |
|
||||
| `image.repository` | RabbitMQ image name | `bitnami/rabbitmq` |
|
||||
| `image.tag` | RabbitMQ image tag | `{TAG_NAME}` |
|
||||
| `image.pullPolicy` | RabbitMQ 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` | Set to true if you would like to see extra information on logs | `false` |
|
||||
| `auth.username` | RabbitMQ application username | `user` |
|
||||
| `auth.password` | RabbitMQ application password | _random 10 character long alphanumeric string_ |
|
||||
| `auth.existingPasswordSecret` | Existing secret with RabbitMQ credentials | `nil` (evaluated as a template) |
|
||||
| `auth.erlangCookie` | Erlang cookie | _random 32 character long alphanumeric string_ |
|
||||
| `auth.existingErlangSecret` | Existing secret with RabbitMQ Erlang cookie | `nil` |
|
||||
| `auth.tls.enabled` | Enable TLS support on RabbitMQ | `false` |
|
||||
| `auth.tls.failIfNoPeerCert` | When set to true, TLS connection will be rejected if client fails to provide a certificate | `true` |
|
||||
| `auth.tls.sslOptionsVerify` | Should [peer verification](https://www.rabbitmq.com/ssl.html#peer-verification) be enabled? | `verify_peer` |
|
||||
| `auth.tls.caCertificate` | Certificate Authority (CA) bundle content | `nil` |
|
||||
| `auth.tls.serverCertificate` | Server certificate content | `nil` |
|
||||
| `auth.tls.serverKey` | Server private key content | `nil` |
|
||||
| `auth.tls.existingSecret` | Existing secret with certificate content to RabbitMQ credentials | `nil` |
|
||||
| `logs` | Path of the RabbitMQ server's Erlang log file | `-` |
|
||||
| `ulimitNofiles` | Max File Descriptor limit | `65536` |
|
||||
| `maxAvailableSchedulers` | RabbitMQ maximum available scheduler threads | `2` |
|
||||
| `onlineSchedulers` | RabbitMQ online scheduler threads | `1` |
|
||||
| `memoryHighWatermark.enabled` | Enable configuring Memory high watermark on RabbitMQ | `false` |
|
||||
| `memoryHighWatermark.type` | Memory high watermark type. Either `absolute` or `relative` | `relative` |
|
||||
| `memoryHighWatermark.value` | Memory high watermark value | `0.4` |
|
||||
| `plugins` | List of plugins to enable | `rabbitmq_management rabbitmq_peer_discovery_k8s` |
|
||||
| `communityPlugins` | List of custom plugins (URLs) to be downloaded during container initialization | `nil` |
|
||||
| `extraPlugins` | Extra plugins to enable | `nil` |
|
||||
| `clustering.addressType` | Switch clustering mode. Either `ip` or `hostname` | `hostname` |
|
||||
| `clustering.rebalance` | Rebalance master for queues in cluster when new replica is created | `false` |
|
||||
| `clustering.forceBoot` | Rebalance master for queues in cluster when new replica is created | `false` |
|
||||
| `loadDefinition.enabled` | Enable loading a RabbitMQ definitions file to configure RabbitMQ | `false` |
|
||||
| `loadDefinition.existingSecret` | Existing secret with the load definitions file | `nil` |
|
||||
| `command` | Override default container command (useful when using custom images) | `nil` |
|
||||
| `args` | Override default container args (useful when using custom images) | `nil` |
|
||||
| `extraEnvVars` | Extra environment variables to add to RabbitMQ pods | `[]` |
|
||||
| `extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars | `nil` |
|
||||
| `extraEnvVarsSecret` | Name of existing Secret containing extra env vars (in case of sensitive data) | `nil` |
|
||||
| `extraContainerPorts` | Extra ports to be included in container spec, primarily informational | `[]` |
|
||||
| `configuration` | RabbitMQ configuration | Check `values.yaml` file |
|
||||
| `extraConfiguration` | Extra configuration to be appended to RabbitMQ configuration | Check `values.yaml` file |
|
||||
| `advancedConfiguration` | Extra configuration (in classic format) | Check `values.yaml` file |
|
||||
| `ldap.enabled` | Enable LDAP support | `false` |
|
||||
| `ldap.servers` | List of LDAP servers hostnames | `[]` |
|
||||
| `ldap.port` | LDAP servers port | `389` |
|
||||
| `ldap.user_dn_pattern` | Pattern used to translate the provided username into a value to be used for the LDAP bind | `cn=${username},dc=example,dc=org` |
|
||||
| `ldap.tls.enabled` | Enable TLS for LDAP connections (check advancedConfiguration parameter in values.yml) | `false` |
|
||||
|
||||
### Statefulset parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
||||
| `replicaCount` | Number of RabbitMQ nodes | `1` |
|
||||
| `schedulerName` | Name of the k8s service (other than default) | `nil` |
|
||||
| `podManagementPolicy` | Pod management policy | `OrderedReady` |
|
||||
| `updateStrategyType` | Update strategy type for the statefulset | `RollingUpdate` |
|
||||
| `rollingUpdatePartition` | Partition update strategy | `nil` |
|
||||
| `podLabels` | RabbitMQ pod labels | `{}` (evaluated as a template) |
|
||||
| `podAnnotations` | RabbitMQ Pod annotations | `{}` (evaluated as a template) |
|
||||
| `affinity` | Affinity for pod assignment | `{}` (evaluated as a template) |
|
||||
| `priorityClassName` | Name of the existing priority class to be used by kafka pods | `""` |
|
||||
| `nodeSelector` | Node labels for pod assignment | `{}` (evaluated as a template) |
|
||||
| `tolerations` | Tolerations for pod assignment | `[]` (evaluated as a template) |
|
||||
| `podSecurityContext` | RabbitMQ pods' Security Context | `{}` |
|
||||
| `containerSecurityContext` | RabbitMQ containers' Security Context | `{}` |
|
||||
| `resources.limits` | The resources limits for RabbitMQ containers | `{}` |
|
||||
| `resources.requests` | The requested resources for RabbitMQ containers | `{}` |
|
||||
| `livenessProbe` | Liveness probe configuration for RabbitMQ | Check `values.yaml` file |
|
||||
| `readinessProbe` | Readiness probe configuration for RabbitMQ | Check `values.yaml` file |
|
||||
| `customLivenessProbe` | Override default liveness probe | `nil` |
|
||||
| `customReadinessProbe` | Override default readiness probe | `nil` |
|
||||
| `pdb.create` | Enable/disable a Pod Disruption Budget creation | `false` |
|
||||
| `pdb.minAvailable` | Minimum number/percentage of pods that should remain scheduled | `nil` |
|
||||
| `pdb.maxUnavailable` | Maximum number/percentage of pods that may be made unavailable | `1` |
|
||||
| `initContainers` | Add additional init containers to the RabbitMQ pod | `{}` (evaluated as a template) |
|
||||
| `sidecars` | Add additional sidecar containers to the RabbitMQ pod | `{}` (evaluated as a template) |
|
||||
| `extraVolumeMounts` | Optionally specify extra list of additional volumeMounts . | `{}` |
|
||||
| `extraVolumes` | Optionally specify extra list of additional volumes . | `{}` |
|
||||
| `extraSecrets` | Optionally specify extra secrets to be created by the chart. | `{}` |
|
||||
|
||||
### Exposure parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
||||
| `service.type` | Kubernetes Service type | `ClusterIP` |
|
||||
| `service.port` | Amqp port | `5672` |
|
||||
| `service.tlsPort` | Amqp TLS port | `5671` |
|
||||
| `service.nodePort` | Node port override for `amqp` port, if serviceType NodePort or LoadBalancer | `nil` |
|
||||
| `service.tlsNodePort` | Node port override for `amqp-ssl` port, if serviceType NodePort or LoadBalancer | `nil` |
|
||||
| `service.distPort` | Erlang distribution server port | `25672` |
|
||||
| `service.distNodePort` | Node port override for `dist` port, if serviceType NodePort | `nil` |
|
||||
| `service.managerPort` | RabbitMQ Manager port | `15672` |
|
||||
| `service.managerNodePort` | Node port override for `http-stats` port, if serviceType NodePort | `nil` |
|
||||
| `service.metricsPort` | RabbitMQ Prometheues metrics port | `9419` |
|
||||
| `service.metricsNodePort` | Node port override for `metrics` port, if serviceType NodePort | `nil` |
|
||||
| `service.epmdNodePort` | Node port override for `epmd` port, if serviceType NodePort | `nil` |
|
||||
| `service.extraPorts` | Extra ports to expose in the service | `[]` |
|
||||
| `service.loadBalancerSourceRanges` | Address(es) that are allowed when service is LoadBalancer | `[]` |
|
||||
| `service.loadBalancerIP` | LoadBalancerIP for the service | `nil` |
|
||||
| `service.externalIP` | ExternalIP for the service | `nil` |
|
||||
| `service.labels` | Service labels | `{}` (evaluated as a template) |
|
||||
| `service.annotations` | Service annotations | `{}` (evaluated as a template) |
|
||||
| `ingress.enabled` | Enable ingress resource for Management console | `false` |
|
||||
| `ingress.path` | Path for the default host | `/` |
|
||||
| `ingress.certManager` | Add annotations for cert-manager | `false` |
|
||||
| `ingress.hostname` | Default host for the ingress resource | `rabbitmq.local` |
|
||||
| `ingress.annotations` | Ingress annotations | `[]` |
|
||||
| `ingress.tls` | Enable TLS configuration for the hostname defined at `ingress.hostname` parameter | `false` |
|
||||
| `ingress.existingSecret` | Existing secret for the Ingress TLS certificate | `nil` |
|
||||
| `ingress.extraHosts[0].name` | Additional hostnames to be covered | `nil` |
|
||||
| `ingress.extraHosts[0].path` | Additional hostnames to be covered | `nil` |
|
||||
| `ingress.extraTls[0].hosts[0]` | TLS configuration for additional hostnames to be covered | `nil` |
|
||||
| `ingress.extraTls[0].secretName` | TLS configuration for additional hostnames to be covered | `nil` |
|
||||
| `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` |
|
||||
| `networkPolicy.additionalRules` | Additional NetworkPolicy rules | `nil` |
|
||||
|
||||
### Persistence parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
||||
| `persistence.enabled` | Enable RabbitMQ data persistence using PVC | `true` |
|
||||
| `persistence.existingClaim` | Provide an existing `PersistentVolumeClaim`, the value is evaluated as a template | `nil` |
|
||||
| `persistence.storageClass` | PVC Storage Class for RabbitMQ data volume | `nil` |
|
||||
| `persistence.accessMode` | PVC Access Mode for RabbitMQ data volume | `ReadWriteOnce` |
|
||||
| `persistence.size` | PVC Storage Request for RabbitMQ data volume | `8Gi` |
|
||||
| `persistence.selector` | Selector to match an existing Persistent Volume | `{}`(evaluated as a template) |
|
||||
| `persistence.volumes` | Additional volumes without creating PVC | `{}`(evaluated as a template) |
|
||||
|
||||
### RBAC parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
||||
| `serviceAccount.create` | Enable creation of ServiceAccount for RabbitMQ pods | `true` |
|
||||
| `serviceAccount.name` | Name of the created serviceAccount | Generated using the `rabbitmq.fullname` template |
|
||||
| `rbac.create` | Weather to create & use RBAC resources or not | `false` |
|
||||
|
||||
### Volume Permissions parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
||||
| `volumePermissions.enabled` | Enable init container that changes the owner and group of the persistent volume(s) mountpoint to `runAsUser:fsGroup` | `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.image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `volumePermissions.resources.limits` | Init container volume-permissions resource limits | `{}` |
|
||||
| `volumePermissions.resources.requests` | Init container volume-permissions resource requests | `{}` |
|
||||
|
||||
### Metrics parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
||||
| `metrics.enabled` | Enable exposing RabbitMQ metrics to be gathered by Prometheus | `false` |
|
||||
| `metrics.plugins` | Plugins to enable Prometheus metrics in RabbitMQ | `rabbitmq_prometheus` |
|
||||
| `metrics.podAnnotations` | Annotations for enabling prometheus to access the metrics endpoint | `{prometheus.io/scrape: "true", prometheus.io/port: "9419"}` |
|
||||
| `metrics.serviceMonitor.enabled` | Create ServiceMonitor Resource for scraping metrics using PrometheusOperator | `false` |
|
||||
| `metrics.serviceMonitor.namespace` | Namespace which Prometheus is running in | `monitoring` |
|
||||
| `metrics.serviceMonitor.interval` | Interval at which metrics should be scraped | `30s` |
|
||||
| `metrics.serviceMonitor.scrapeTimeout` | Specify the timeout after which the scrape is ended | `nil` |
|
||||
| `metrics.serviceMonitor.relabellings` | Specify Metric Relabellings to add to the scrape endpoint | `nil` |
|
||||
| `metrics.serviceMonitor.honorLabels` | honorLabels chooses the metric's labels on collisions with target labels. | `false` |
|
||||
| `metrics.serviceMonitor.additionalLabels` | Used to pass Labels that are required by the Installed Prometheus Operator | `{}` |
|
||||
| `metrics.serviceMonitor.release` | Used to pass Labels release that sometimes should be custom for Prometheus Operator | `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 | `monitoring` |
|
||||
| `metrics.prometheusRule.rules` | Rules to be created, check values for an example. | `[]` |
|
||||
|
||||
The above parameters map to the env variables defined in [bitnami/rabbitmq](http://github.com/bitnami/bitnami-docker-rabbitmq). For more information please refer to the [bitnami/rabbitmq](http://github.com/bitnami/bitnami-docker-rabbitmq) image documentation.
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```bash
|
||||
$ helm install my-release \
|
||||
--set auth.username=admin,auth.password=secretpassword,auth.erlangCookie=secretcookie \
|
||||
bitnami/rabbitmq
|
||||
```
|
||||
|
||||
The above command sets the RabbitMQ admin username and password to `admin` and `secretpassword` respectively. Additionally the secure erlang cookie is set to `secretcookie`.
|
||||
|
||||
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/rabbitmq
|
||||
```
|
||||
|
||||
> **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. In case you want to spread the deployment accross nodes you should configure the affinity parameters.
|
||||
|
||||
- Increase the number of replicas:
|
||||
|
||||
```diff
|
||||
- replicaCount: 1
|
||||
+ replicaCount: 3
|
||||
```
|
||||
|
||||
- Resource needs and limits to apply to the pod:
|
||||
|
||||
```diff
|
||||
resources:
|
||||
- requests: {}
|
||||
+ requests:
|
||||
+ memory: 2Gi
|
||||
+ cpu: 1000m
|
||||
- limits: {}
|
||||
+ limits:
|
||||
+ memory: 2Gi
|
||||
+ cpu: 1000m
|
||||
```
|
||||
|
||||
- Enable Memory high watermark relative limit:
|
||||
|
||||
```diff
|
||||
- memoryHighWatermark.enabled: false
|
||||
+ memoryHighWatermark.enabled: true
|
||||
```
|
||||
|
||||
- Enable NetworkPolicy:
|
||||
|
||||
```diff
|
||||
- networkPolicy.enabled: false
|
||||
+ networkPolicy.enabled: true
|
||||
- networkPolicy.allowExternal: true
|
||||
+ networkPolicy.allowExternal: false
|
||||
```
|
||||
|
||||
- Enable Pod Disruption Budget:
|
||||
|
||||
```diff
|
||||
- pdb.create: false
|
||||
+ pdb.create: true
|
||||
```
|
||||
|
||||
- Enable Prometheus metrics:
|
||||
|
||||
```diff
|
||||
- metrics.enabled: false
|
||||
+ metrics.enabled: true
|
||||
```
|
||||
|
||||
To horizontally scale this chart once it has been deployed you have two options:
|
||||
|
||||
- Use `kubectl scale` command.
|
||||
- Upgrading the chart with the following parameters:
|
||||
|
||||
```console
|
||||
replicaCount=3
|
||||
auth.password="$RABBITMQ_PASSWORD"
|
||||
auth.erlangCookie="$RABBITMQ_ERLANG_COOKIE"
|
||||
```
|
||||
|
||||
> Note: please note it's mandatory to indicate the password and erlangCookie that was set the first time the chart was installed to upgrade the chart. Otherwise, new pods won't be able to join the cluster.
|
||||
|
||||
When scaling down the solution unnecessary RabbitMQ nodes are automatically stopped, but they are not removed from the cluster. You need to manually remove them running the `rabbitmqctl forget_cluster_node` command. For instance, if you initially installed RabbitMQ with 3 replicas and then you scaled it down to 2 replicas, run the commands below (assuming that the release name is `rabbitmq` and you're using `hostname` as clustering type):
|
||||
|
||||
```console
|
||||
$ kubectl exec rabbitmq-0 --container rabbitmq -- rabbitmqctl forget_cluster_node rabbit@rabbitmq-2.rabbitmq-headless.default.svc.cluster.local
|
||||
$ kubectl delete pvc data-rabbitmq-2
|
||||
```
|
||||
|
||||
### Enabling TLS support
|
||||
|
||||
To enable TLS support you must generate the certificates using RabbitMQ [documentation](https://www.rabbitmq.com/ssl.html#automated-certificate-generation). Once you have your certificate, you have two alternatives:
|
||||
|
||||
A) Create a secret including the certificates:
|
||||
|
||||
```bash
|
||||
$ kubectl create secret generic rabbitmq-certificates --from-file=./ca.crt --from-file=./tls.crt --from-file=./tls.key
|
||||
```
|
||||
|
||||
Then, install the RabbitMQ chart setting the parameters below:
|
||||
|
||||
```console
|
||||
tls.enabled=true
|
||||
tls.existingSecret=rabbitmq-certificates
|
||||
```
|
||||
|
||||
B) Include the certificates in your values.yaml:
|
||||
|
||||
```yaml
|
||||
auth:
|
||||
enabled: true
|
||||
caCertificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDRTCCAi2gAwIBAgIJAJPh+paO6a3cMA0GCSqGSIb3DQEBCwUAMDExIDAeBgNV
|
||||
...
|
||||
-----END CERTIFICATE-----
|
||||
serverCertificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDqjCCApKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAxMSAwHgYDVQQDDBdUTFNH
|
||||
...
|
||||
-----END CERTIFICATE-----
|
||||
serverKey: |-
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpAIBAAKCAQEA2iX3M4d3LHrRAoVUbeFZN3EaGzKhyBsz7GWwTgETiNj+AL7p
|
||||
....
|
||||
-----END RSA PRIVATE KEY-----
|
||||
```
|
||||
|
||||
- Setting [auth.tls.failIfNoPeerCert](https://www.rabbitmq.com/ssl.html#peer-verification-configuration) to `false` allows a TLS connection if client fails to provide a certificate.
|
||||
- When setting [auth.tls.sslOptionsVerify](https://www.rabbitmq.com/ssl.html#peer-verification-configuration) to `verify_peer`, the node must perform peer verification. When set to `verify_none`, peer verification will be disabled and certificate exchange won't be performed.
|
||||
|
||||
### Load Definitions
|
||||
|
||||
It is possible to [load a RabbitMQ definitions file to configure RabbitMQ](http://www.rabbitmq.com/management.html#load-definitions). Because definitions may contain RabbitMQ credentials, [store the JSON as a Kubernetes secret](https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod). Within the secret's data, choose a key name that corresponds with the desired load definitions filename (i.e. `load_definition.json`) and use the JSON object as the value. For example:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: rabbitmq-load-definition
|
||||
type: Opaque
|
||||
stringData:
|
||||
load_definition.json: |-
|
||||
{
|
||||
"vhosts": [
|
||||
{
|
||||
"name": "/"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Then, specify the `load_definitions` property as an `extraConfiguration` pointing to the load definition file path within the container (i.e. `/app/load_definition.json`) and set `loadDefinition.enable` to `true`. Any load definitions specified will be available within in the container at `/app`.
|
||||
|
||||
> Loading a definition will take precedence over any configuration done through [Helm values](#parameters).
|
||||
|
||||
If needed, you can use `extraSecrets` to let the chart create the secret for you. This way, you don't need to manually create it before deploying a release. For example :
|
||||
|
||||
```yaml
|
||||
extraSecrets:
|
||||
load-definition:
|
||||
load_definition.json: |
|
||||
{
|
||||
"vhosts": [
|
||||
{
|
||||
"name": "/"
|
||||
}
|
||||
]
|
||||
}
|
||||
loadDefinition:
|
||||
enabled: true
|
||||
existingSecret: load-definition
|
||||
extraConfiguration: |
|
||||
load_definitions = /app/load_definition.json
|
||||
```
|
||||
|
||||
### LDAP
|
||||
|
||||
LDAP support can be enabled in the chart by specifying the `ldap.` parameters while creating a release. The following parameters should be configured to properly enable the LDAP support in the chart.
|
||||
|
||||
- `ldap.enabled`: Enable LDAP support. Defaults to `false`.
|
||||
- `ldap.servers`: List of LDAP servers hostnames. No defaults.
|
||||
- `ldap.port`: LDAP servers port. `389`.
|
||||
- `ldap.user_dn_pattern`: Pattern used to translate the provided username into a value to be used for the LDAP bind. Defaults to `cn=${username},dc=example,dc=org`.
|
||||
- `ldap.tls.enabled`: Enable TLS for LDAP connections. Defaults to `false`.
|
||||
|
||||
For example:
|
||||
|
||||
```console
|
||||
ldap.enabled=true
|
||||
ldap.serverss[0]="my-ldap-server"
|
||||
ldap.port="389"
|
||||
ldap.user_dn_pattern="cn=${username},dc=example,dc=org"
|
||||
```
|
||||
|
||||
If `ldap.tls.enabled` is set to true, consider using `ldap.port=636` and checking the settings in the advancedConfiguration.
|
||||
|
||||
### Memory high watermark
|
||||
|
||||
It is possible to configure Memory high watermark on RabbitMQ to define [memory thresholds](https://www.rabbitmq.com/memory.html#threshold) using the `memoryHighWatermark.*` parameters. To do so, you have two alternatives:
|
||||
|
||||
A) Set an absolute limit of RAM to be used on each RabbitMQ node:
|
||||
|
||||
```console
|
||||
memoryHighWatermark.enabled="true"
|
||||
memoryHighWatermark.type="absolute"
|
||||
memoryHighWatermark.value="512MB"
|
||||
```
|
||||
|
||||
B) Set a relative limit of RAM to be used on each RabbitMQ node. To enable this feature, you must define the memory limits at POD level too:
|
||||
|
||||
```console
|
||||
memoryHighWatermark.enabled="true"
|
||||
memoryHighWatermark.type="relative"
|
||||
memoryHighWatermark.value="0.4"
|
||||
resources.limits.memory="2Gi"
|
||||
```
|
||||
|
||||
### Adding extra environment variables
|
||||
|
||||
In case you want to add extra environment variables (useful for advanced operations like custom init scripts), you can use the `extraEnvVars` property.
|
||||
|
||||
```yaml
|
||||
extraEnvVars:
|
||||
- name: LOG_LEVEL
|
||||
value: error
|
||||
```
|
||||
|
||||
Alternatively, you can use a ConfigMap or a Secret with the environment variables. To do so, use the `.extraEnvVarsCM` or the `extraEnvVarsSecret` properties.
|
||||
|
||||
### Plugins
|
||||
|
||||
The Bitnami Docker RabbitMQ image ships a set of plugins by default. You can use the command below to obtain the whole list.
|
||||
|
||||
```bash
|
||||
$ docker run --rm -it bitnami/rabbitmq -- ls /opt/bitnami/rabbitmq/plugins/
|
||||
```
|
||||
|
||||
By default, this chart enables `rabbitmq_management` and `rabbitmq_peer_discovery_k8s` since they are required for RabbitMQ to work on K8s. To enable extra plugins, set the `extraPlugins` parameter with the list of plugins you want to enable.
|
||||
|
||||
In addition to this, you can also use the `communityPlugins` parameter to indicate a list of URLs separated by spaces where to download you custom plugins for RabbitMQ. For instance, use the parameters below to download a custom plugin during the container initialization and enable it:
|
||||
|
||||
```console
|
||||
communityPlugins="http://some-public-url/my-custom-plugin-X.Y.Z.ez"
|
||||
extraPlugins="my-custom-plugin"
|
||||
```
|
||||
|
||||
### Known issues
|
||||
|
||||
- Changing the password through RabbitMQ's UI can make the pod fail due to the default liveness probes. If you do so, remember to make the chart aware of the new password. Updating the default secret with the password you set through RabbitMQ's UI will automatically recreate the pods. If you are using your own secret, you may have to manually recreate the pods.
|
||||
|
||||
## Persistence
|
||||
|
||||
The [Bitnami RabbitMQ](https://github.com/bitnami/bitnami-docker-rabbitmq) image stores the RabbitMQ data and configurations at the `/opt/bitnami/rabbitmq/var/lib/rabbitmq/` path of the container.
|
||||
|
||||
The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) at this location. By default, the volume is created using dynamic volume provisioning. An existing PersistentVolumeClaim can also be defined.
|
||||
|
||||
### Existing PersistentVolumeClaims
|
||||
|
||||
1. Create the PersistentVolume
|
||||
1. Create the PersistentVolumeClaim
|
||||
1. Install the chart
|
||||
|
||||
```bash
|
||||
$ helm install my-release --set persistence.existingClaim=PVC_NAME bitnami/rabbitmq
|
||||
```
|
||||
|
||||
### Adjust permissions of the persistence volume mountpoint
|
||||
|
||||
As the image runs 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`.
|
||||
|
||||
## 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
|
||||
|
||||
It's necessary to set the `auth.password` and `auth.erlangCookie` parameters when upgrading for readiness/liveness probes to work properly. When you install this chart for the first time, some notes will be displayed providing the credentials you must use under the 'Credentials' section. Please note down the password and the cookie, and run the command below to upgrade your chart:
|
||||
|
||||
```bash
|
||||
$ helm upgrade my-release bitnami/rabbitmq --set auth.password=[PASSWORD] --set auth.erlangCookie=[RABBITMQ_ERLANG_COOKIE]
|
||||
```
|
||||
|
||||
| Note: you need to substitute the placeholders [PASSWORD] and [RABBITMQ_ERLANG_COOKIE] with the values obtained in the installation notes.
|
||||
|
||||
### To 7.0.0
|
||||
|
||||
- Several parameters were renamed or dissapeared in favor of new ones on this major version:
|
||||
- `replicas` is renamed to `replicaCount`.
|
||||
- `securityContext.*` is deprecated in favor of `podSecurityContext` and `containerSecurityContext`.
|
||||
- Authentication parameters were reorganized under the `auth.*` parameter:
|
||||
- `rabbitmq.username`, `rabbitmq.password`, and `rabbitmq.erlangCookie` are now `auth.username`, `auth.password`, and `auth.erlangCookie` respectively.
|
||||
- `rabbitmq.tls.*` parameters are now under `auth.tls.*`.
|
||||
- Parameters prefixed with `rabbitmq.` were renamed removing the prefix. E.g. `rabbitmq.configuration` -> renamed to `configuration`.
|
||||
- `rabbitmq.rabbitmqClusterNodeName` is deprecated.
|
||||
- `rabbitmq.setUlimitNofiles` is deprecated.
|
||||
- `forceBoot.enabled` is renamed to `clustering.forceBoot`.
|
||||
- `loadDefinition.secretName` is renamed to `loadDefinition.existingSecret`.
|
||||
- `metics.port` is remamed to `service.metricsPort`.
|
||||
- `service.extraContainerPorts` is renamed to `extraContainerPorts`.
|
||||
- `service.nodeTlsPort` is renamed to `service.tlsNodePort`.
|
||||
- `podDisruptionBudget` is deprecated in favor of `pdb.create`, `pdb.minAvailable`, and `pdb.maxUnavailable`.
|
||||
- `rbacEnabled` -> deprecated in favor of `rbac.create`.
|
||||
- New parameters: `serviceAccount.create`, and `serviceAccount.name`.
|
||||
- New parameters: `memoryHighWatermark.enabled`, `memoryHighWatermark.type`, and `memoryHighWatermark.value`.
|
||||
- Chart labels and Ingress configuration were adapted to follow the Helm charts best practices.
|
||||
- Initialization logic now relies on the container.
|
||||
- This version introduces `bitnami/common`, a [library chart](https://helm.sh/docs/topics/library_charts/#helm) as a dependency. More documentation about this new utility could be found [here](https://github.com/bitnami/charts/tree/master/bitnami/common#bitnami-common-library-chart). Please, make sure that you have updated the chart dependencies before executing any upgrade.
|
||||
|
||||
Consequences:
|
||||
|
||||
- Backwards compatibility is not guaranteed.
|
||||
- Compatibility with non Bitnami images is not guaranteed anymore.
|
||||
|
||||
### To 6.0.0
|
||||
|
||||
This new version updates the RabbitMQ image to a [new version based on bash instead of node.js](https://github.com/bitnami/bitnami-docker-rabbitmq#3715-r18-3715-ol-7-r19). However, since this Chart overwrites the container's command, the changes to the container shouldn't affect the Chart. To upgrade, it may be needed to enable the `fastBoot` option, as it is already the case from upgrading from 5.X to 5.Y.
|
||||
|
||||
### To 5.0.0
|
||||
|
||||
This major release changes the clustering method from `ip` to `hostname`.
|
||||
This change is needed to fix the persistence. The data dir will now depend on the hostname which is stable instead of the pod IP that might change.
|
||||
|
||||
> IMPORTANT: Note that if you upgrade from a previous version you will lose your data.
|
||||
|
||||
### To 3.0.0
|
||||
|
||||
Backwards compatibility is not guaranteed unless you modify the labels used on the chart's deployments.
|
||||
Use the workaround below to upgrade from versions previous to 3.0.0. The following example assumes that the release name is rabbitmq:
|
||||
|
||||
```console
|
||||
$ kubectl delete statefulset rabbitmq --cascade=false
|
||||
```
|
||||
|
||||
## Bitnami Kubernetes Documentation
|
||||
|
||||
Bitnami Kubernetes documentation is available at [https://docs.bitnami.com/](https://docs.bitnami.com/). You can find there the following resources:
|
||||
|
||||
- [Documentation for RabbitMQ Helm chart](https://docs.bitnami.com/kubernetes/infrastructure/rabbitmq/)
|
||||
- [Get Started with Kubernetes guides](https://docs.bitnami.com/kubernetes/)
|
||||
- [Bitnami Helm charts documentation](https://docs.bitnami.com/kubernetes/apps/)
|
||||
- [Kubernetes FAQs](https://docs.bitnami.com/kubernetes/faq/)
|
||||
- [Kubernetes Developer guides](https://docs.bitnami.com/tutorials/)
|
||||
@@ -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,22 @@
|
||||
annotations:
|
||||
category: Infrastructure
|
||||
apiVersion: v1
|
||||
appVersion: 0.9.0
|
||||
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.9.0
|
||||
@@ -0,0 +1,287 @@
|
||||
# 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 Inpput |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `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. |
|
||||
| `common.validations.values.redis.passwords` | This helper will ensure required password for Redis 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. |
|
||||
|
||||
### 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 possiblity 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,57 @@
|
||||
{{/* 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" .) -}}
|
||||
{{- $name = .name -}}
|
||||
{{- 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 -}}
|
||||
@@ -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,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,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.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 -}}
|
||||
@@ -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: "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" . -}}
|
||||
{{- $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 -}}
|
||||
|
||||
{{/*
|
||||
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,72 @@
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Validate Redis 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 Auxiliar function to get the right value for existingSecret.
|
||||
|
||||
Usage:
|
||||
{{ include "common.redis.values.existingSecret" (dict "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether Redis 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 -}}
|
||||
|
||||
{{/*
|
||||
Auxiliar 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 -}}
|
||||
|
||||
{{/*
|
||||
Auxiliar 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 -}}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user