[stable/postgresql] Support different affinities, nodeSelectors and tolerations for master & slaves (#9646)

* [stable/postgresql] Support different affinities for master & slaves

Signed-off-by: tompizmor <tompizmor@gmail.com>

* Add note to README and obey fullnameOverride

Signed-off-by: tompizmor <tompizmor@gmail.com>
This commit is contained in:
Tomas Pizarro
2018-12-07 06:41:04 -08:00
committed by Kubernetes Prow Robot
parent 41a5a9d9b3
commit f68259033d
7 changed files with 81 additions and 30 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: postgresql
version: 2.7.10
version: 3.0.0
appVersion: 10.6.0
description: Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
keywords:
+19 -3
View File
@@ -82,9 +82,12 @@ The following tables lists the configurable parameters of the PostgreSQL chart a
| `persistence.accessMode` | PVC Access Mode for PostgreSQL volume | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request for PostgreSQL volume | `8Gi` |
| `persistence.annotations` | Annotations for the PVC | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `affinity` | Affinity labels for pod assignment | `{}` |
| `tolerations` | Toleration labels for pod assignment | `[]` |
| `master.nodeSelector` | Node labels for pod assignment (postgresql master) | `{}` |
| `master.affinity` | Affinity labels for pod assignment (postgresql master) | `{}` |
| `master.tolerations` | Toleration labels for pod assignment (postgresql master) | `[]` |
| `slave.nodeSelector` | Node labels for pod assignment (postgresql slave) | `{}` |
| `slave.affinity` | Affinity labels for pod assignment (postgresql slave) | `{}` |
| `slave.tolerations` | Toleration labels for pod assignment (postgresql slave) | `[]` |
| `terminationGracePeriodSeconds` | Seconds the pod needs to terminate gracefully | `nil` |
| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `250m` |
| `securityContext.enabled` | Enable security context | `true` |
@@ -190,6 +193,19 @@ This label will be displayed in the output of a successful install.
## Upgrade
### 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
+3 -2
View File
@@ -25,10 +25,11 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
*/}}
{{- 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-%s" .Release.Name $name "master" | trunc 63 | trimSuffix "-" -}}
{{- printf "%s-%s" $fullname "master" | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- printf "%s" $fullname | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
@@ -39,17 +39,17 @@ spec:
- name: {{ . }}
{{- end}}
{{- end }}
{{- if .Values.nodeSelector }}
{{- if .Values.slave.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{ toYaml .Values.slave.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.affinity }}
{{- if .Values.slave.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{ toYaml .Values.slave.affinity | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
{{- if .Values.slave.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{ toYaml .Values.slave.tolerations | indent 8 }}
{{- end }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
+6 -6
View File
@@ -41,17 +41,17 @@ spec:
- name: {{ . }}
{{- end}}
{{- end }}
{{- if .Values.nodeSelector }}
{{- if .Values.master.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{ toYaml .Values.master.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.affinity }}
{{- if .Values.master.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{ toYaml .Values.master.affinity | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
{{- if .Values.master.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{ toYaml .Values.master.tolerations | indent 8 }}
{{- end }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
+23 -5
View File
@@ -133,11 +133,29 @@ persistence:
size: 8Gi
annotations: {}
## Node labels and tolerations for pod assignment
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
nodeSelector: {}
tolerations: []
##
## PostgreSQL Master parameters
##
master:
## Node, affinity and tolerations labels 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
nodeSelector: {}
affinity: {}
tolerations: []
##
## PostgreSQL Slave parameters
##
slave:
## Node, affinity and tolerations labels 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
nodeSelector: {}
affinity: {}
tolerations: []
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
+23 -7
View File
@@ -138,13 +138,29 @@ persistence:
size: 8Gi
annotations: {}
## Node, affinity and tolerations labels 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
nodeSelector: {}
affinity: {}
tolerations: []
##
## PostgreSQL Master parameters
##
master:
## Node, affinity and tolerations labels 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
nodeSelector: {}
affinity: {}
tolerations: []
##
## PostgreSQL Slave parameters
##
slave:
## Node, affinity and tolerations labels 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
nodeSelector: {}
affinity: {}
tolerations: []
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/