diff --git a/stable/postgresql/Chart.yaml b/stable/postgresql/Chart.yaml index 751406db2f..268ffcb298 100644 --- a/stable/postgresql/Chart.yaml +++ b/stable/postgresql/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: postgresql -version: 8.4.3 +version: 8.5.0 appVersion: 11.7.0 description: Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance. keywords: diff --git a/stable/postgresql/README.md b/stable/postgresql/README.md index 26dfb66623..1db8289f99 100644 --- a/stable/postgresql/README.md +++ b/stable/postgresql/README.md @@ -142,6 +142,7 @@ The following tables lists the configurable parameters of the PostgreSQL chart a | `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 | `[]` | | `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) | `[]` | @@ -153,6 +154,7 @@ The following tables lists the configurable parameters of the PostgreSQL chart a | `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 | `[]` | | `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` | @@ -303,6 +305,31 @@ In addition to these options, you can also set an external ConfigMap with all th The allowed extensions are `.sh`, `.sql` and `.sql.gz`. +### 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). diff --git a/stable/postgresql/templates/statefulset-slaves.yaml b/stable/postgresql/templates/statefulset-slaves.yaml index 66d3ba3f97..3290ff7fcd 100644 --- a/stable/postgresql/templates/statefulset-slaves.yaml +++ b/stable/postgresql/templates/statefulset-slaves.yaml @@ -239,6 +239,9 @@ spec: {{- 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 diff --git a/stable/postgresql/templates/statefulset.yaml b/stable/postgresql/templates/statefulset.yaml index 51732b9dbc..3390be22b2 100644 --- a/stable/postgresql/templates/statefulset.yaml +++ b/stable/postgresql/templates/statefulset.yaml @@ -320,6 +320,9 @@ spec: {{- 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" . }} diff --git a/stable/postgresql/values-production.yaml b/stable/postgresql/values-production.yaml index 4b72fd2ac9..8da0b3d93f 100644 --- a/stable/postgresql/values-production.yaml +++ b/stable/postgresql/values-production.yaml @@ -337,6 +337,17 @@ master: ## 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: [] ## ## PostgreSQL Slave parameters @@ -355,12 +366,27 @@ slave: 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: [] ## Configure resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ diff --git a/stable/postgresql/values.yaml b/stable/postgresql/values.yaml index ab158f96e4..d336ea0389 100644 --- a/stable/postgresql/values.yaml +++ b/stable/postgresql/values.yaml @@ -79,6 +79,7 @@ volumePermissions: ## # schedulerName: + ## Pod Security Context ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ ## @@ -332,15 +333,27 @@ master: podAnnotations: {} priorityClassName: "" extraInitContainers: | - # - name: do-something - # image: busybox - # command: ['do', 'something'] + # - name: do-something + # image: busybox + # command: ['do', 'something'] + ## 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: [] ## ## PostgreSQL Slave parameters @@ -360,15 +373,26 @@ slave: podAnnotations: {} priorityClassName: "" extraInitContainers: | - # - name: do-something - # image: busybox - # command: ['do', 'something'] + # - 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: [] ## Configure resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/