diff --git a/stable/postgresql/Chart.yaml b/stable/postgresql/Chart.yaml index 75a0b8c528..6bdc9781ec 100644 --- a/stable/postgresql/Chart.yaml +++ b/stable/postgresql/Chart.yaml @@ -1,5 +1,5 @@ name: postgresql -version: 0.10.0 +version: 0.11.0 appVersion: 9.6.2 description: Object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance. keywords: diff --git a/stable/postgresql/templates/NOTES.txt b/stable/postgresql/templates/NOTES.txt index dc49232e78..3bc725f01b 100644 --- a/stable/postgresql/templates/NOTES.txt +++ b/stable/postgresql/templates/NOTES.txt @@ -29,7 +29,7 @@ To connect to your database directly from outside the K8s cluster: PGPORT={{ default "5432" .Values.service.port }} # Execute the following commands to route the connection: - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "postgresql.fullname" . }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "postgresql.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME {{ default "5432" .Values.service.port }}:{{ default "5432" .Values.service.port }} {{- end }} diff --git a/stable/postgresql/templates/_helpers.tpl b/stable/postgresql/templates/_helpers.tpl index ebae37b5f1..5f605c6093 100644 --- a/stable/postgresql/templates/_helpers.tpl +++ b/stable/postgresql/templates/_helpers.tpl @@ -34,3 +34,10 @@ Return the appropriate apiVersion for networkpolicy. "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 -}} diff --git a/stable/postgresql/templates/deployment.yaml b/stable/postgresql/templates/deployment.yaml index 689d2750f2..05f6424bce 100644 --- a/stable/postgresql/templates/deployment.yaml +++ b/stable/postgresql/templates/deployment.yaml @@ -3,15 +3,21 @@ kind: Deployment metadata: name: {{ template "postgresql.fullname" . }} labels: - app: {{ template "postgresql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + app: {{ template "postgresql.name" . }} + chart: {{ template "postgresql.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} spec: + template: + selector: + matchLabels: + app: {{ template "postgresql.name" . }} + release: {{ .Release.Name }} template: metadata: labels: - app: {{ template "postgresql.fullname" . }} + app: {{ template "postgresql.name" . }} + release: {{ .Release.Name }} spec: {{- if .Values.affinity }} affinity: diff --git a/stable/postgresql/templates/networkpolicy.yaml b/stable/postgresql/templates/networkpolicy.yaml index 92f3b71b15..1b04b8845b 100644 --- a/stable/postgresql/templates/networkpolicy.yaml +++ b/stable/postgresql/templates/networkpolicy.yaml @@ -4,14 +4,15 @@ apiVersion: {{ template "postgresql.networkPolicy.apiVersion" . }} metadata: name: "{{ template "postgresql.fullname" . }}" labels: - app: {{ template "postgresql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + app: {{ template "postgresql.name" . }} + chart: {{ template "postgresql.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} spec: podSelector: matchLabels: - app: "{{ template "postgresql.fullname" . }}" + app: {{ template "postgresql.name" . }} + release: {{ .Release.Name }} ingress: # Allow inbound connections - ports: diff --git a/stable/postgresql/templates/pvc.yaml b/stable/postgresql/templates/pvc.yaml index f1d38dfb14..78b683211d 100644 --- a/stable/postgresql/templates/pvc.yaml +++ b/stable/postgresql/templates/pvc.yaml @@ -4,10 +4,10 @@ apiVersion: v1 metadata: name: {{ template "postgresql.fullname" . }} labels: - app: {{ template "postgresql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + app: {{ template "postgresql.name" . }} + chart: {{ template "postgresql.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} {{- if .Values.persistence.annotations }} annotations: {{ toYaml .Values.persistence.annotations | indent 4 }} diff --git a/stable/postgresql/templates/secrets.yaml b/stable/postgresql/templates/secrets.yaml index 6dd4c7da55..cc32067e0d 100644 --- a/stable/postgresql/templates/secrets.yaml +++ b/stable/postgresql/templates/secrets.yaml @@ -3,10 +3,10 @@ kind: Secret metadata: name: {{ template "postgresql.fullname" . }} labels: - app: {{ template "postgresql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + app: {{ template "postgresql.name" . }} + chart: {{ template "postgresql.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} type: Opaque data: {{ if .Values.postgresPassword }} diff --git a/stable/postgresql/templates/svc.yaml b/stable/postgresql/templates/svc.yaml index 38c1fa2fba..9b1bd7220d 100644 --- a/stable/postgresql/templates/svc.yaml +++ b/stable/postgresql/templates/svc.yaml @@ -3,10 +3,10 @@ kind: Service metadata: name: {{ template "postgresql.fullname" . }} labels: - app: {{ template "postgresql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + app: {{ template "postgresql.name" . }} + chart: {{ template "postgresql.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} {{- if .Values.metrics.enabled }} annotations: prometheus.io/scrape: "true" @@ -26,4 +26,5 @@ spec: {{ toYaml .Values.service.externalIPs | indent 4 }} {{- end }} selector: - app: {{ template "postgresql.fullname" . }} + app: {{ template "postgresql.name" . }} + release: {{ .Release.Name }}