diff --git a/stable/postgresql/Chart.yaml b/stable/postgresql/Chart.yaml index d440f3895c..8b770cfb8d 100644 --- a/stable/postgresql/Chart.yaml +++ b/stable/postgresql/Chart.yaml @@ -1,5 +1,5 @@ name: postgresql -version: 0.8.0 +version: 0.8.1 description: Object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance. keywords: - postgresql diff --git a/stable/postgresql/templates/NOTES.txt b/stable/postgresql/templates/NOTES.txt index 64067e1c6e..cb511f38ab 100644 --- a/stable/postgresql/templates/NOTES.txt +++ b/stable/postgresql/templates/NOTES.txt @@ -1,35 +1,35 @@ PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster: -{{ template "fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local +{{ template "postgresql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local To get your user password run: - PGPASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.postgres-password}" | base64 --decode; echo) + PGPASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "postgresql.fullname" . }} -o jsonpath="{.data.postgres-password}" | base64 --decode; echo) To connect to your database run the following command (using the env variable from above): - kubectl run {{ template "fullname" . }}-client --rm --tty -i --image postgres \ + kubectl run {{ template "postgresql.fullname" . }}-client --rm --tty -i --image postgres \ --env "PGPASSWORD=$PGPASSWORD" \{{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }} - --labels="{{ template "fullname" . }}-client=true" \{{- end }} + --labels="{{ template "postgresql.fullname" . }}-client=true" \{{- end }} --command -- psql -U {{ default "postgres" .Values.postgresUser }} \ - -h {{ template "fullname" . }} {{ default "postgres" .Values.postgresDatabase }} + -h {{ template "postgresql.fullname" . }} {{ default "postgres" .Values.postgresDatabase }} {{ if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }} Note: Since NetworkPolicy is enabled, only pods with label -{{ template "fullname" . }}-client=true" +{{ template "postgresql.fullname" . }}-client=true" will be able to connect to this PostgreSQL cluster. {{- end }} To connect to your database directly from outside the K8s cluster: {{- if contains "NodePort" .Values.service.type }} PGHOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath='{.items[0].status.addresses[0].address}') - PGPORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.spec.ports[0].nodePort}') + PGPORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "postgresql.fullname" . }} -o jsonpath='{.spec.ports[0].nodePort}') {{- else if contains "ClusterIP" .Values.service.type }} PGHOST=127.0.0.1 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 "fullname" . }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "postgresql.fullname" . }}" -o jsonpath="{.items[0].metadata.name}") kubectl port-forward $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 87236cceb5..b6528392a2 100644 --- a/stable/postgresql/templates/_helpers.tpl +++ b/stable/postgresql/templates/_helpers.tpl @@ -2,7 +2,7 @@ {{/* Expand the name of the chart. */}} -{{- define "name" -}} +{{- define "postgresql.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -10,7 +10,7 @@ Expand the name of the chart. 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 "fullname" -}} +{{- define "postgresql.fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -18,7 +18,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{/* Return the appropriate apiVersion for networkpolicy. */}} -{{- define "networkPolicy.apiVersion" -}} +{{- define "postgresql.networkPolicy.apiVersion" -}} {{- if and (ge .Capabilities.KubeVersion.Minor "4") (le .Capabilities.KubeVersion.Minor "6") -}} "extensions/v1beta1" {{- else if ge .Capabilities.KubeVersion.Minor "7" -}} diff --git a/stable/postgresql/templates/deployment.yaml b/stable/postgresql/templates/deployment.yaml index 2b3f602f6f..99e69e7d09 100644 --- a/stable/postgresql/templates/deployment.yaml +++ b/stable/postgresql/templates/deployment.yaml @@ -1,9 +1,9 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: {{ template "fullname" . }} + name: {{ template "postgresql.fullname" . }} labels: - app: {{ template "fullname" . }} + app: {{ template "postgresql.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" @@ -11,10 +11,10 @@ spec: template: metadata: labels: - app: {{ template "fullname" . }} + app: {{ template "postgresql.fullname" . }} spec: containers: - - name: {{ template "fullname" . }} + - name: {{ template "postgresql.fullname" . }} image: "{{ .Values.image }}:{{ .Values.imageTag }}" imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} env: @@ -32,7 +32,7 @@ spec: - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: - name: {{ template "fullname" . }} + name: {{ template "postgresql.fullname" . }} key: postgres-password - name: POD_IP valueFrom: { fieldRef: { fieldPath: status.podIP } } @@ -87,14 +87,14 @@ spec: - name: data {{- if .Values.persistence.enabled }} persistentVolumeClaim: - claimName: {{ .Values.persistence.existingClaim | default (include "fullname" .) }} + claimName: {{ .Values.persistence.existingClaim | default (include "postgresql.fullname" .) }} {{- else }} emptyDir: {} {{- end }} {{- if and .Values.metrics.enabled .Values.metrics.customMetrics }} - name: custom-metrics secret: - secretName: {{ template "fullname" . }} + secretName: {{ template "postgresql.fullname" . }} items: - key: custom-metrics.yaml path: custom-metrics.yaml diff --git a/stable/postgresql/templates/networkpolicy.yaml b/stable/postgresql/templates/networkpolicy.yaml index af5c1e0487..92f3b71b15 100644 --- a/stable/postgresql/templates/networkpolicy.yaml +++ b/stable/postgresql/templates/networkpolicy.yaml @@ -1,17 +1,17 @@ {{- if .Values.networkPolicy.enabled }} kind: NetworkPolicy -apiVersion: {{ template "networkPolicy.apiVersion" . }} +apiVersion: {{ template "postgresql.networkPolicy.apiVersion" . }} metadata: - name: "{{ template "fullname" . }}" + name: "{{ template "postgresql.fullname" . }}" labels: - app: {{ template "fullname" . }} + app: {{ template "postgresql.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" spec: podSelector: matchLabels: - app: "{{ template "fullname" . }}" + app: "{{ template "postgresql.fullname" . }}" ingress: # Allow inbound connections - ports: @@ -20,7 +20,7 @@ spec: from: - podSelector: matchLabels: - {{ template "fullname" . }}-client: "true" + {{ template "postgresql.fullname" . }}-client: "true" {{- end }} # Allow prometheus scrapes - ports: diff --git a/stable/postgresql/templates/pvc.yaml b/stable/postgresql/templates/pvc.yaml index 2424b389ce..12d8dc22ed 100644 --- a/stable/postgresql/templates/pvc.yaml +++ b/stable/postgresql/templates/pvc.yaml @@ -2,9 +2,9 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: {{ template "fullname" . }} + name: {{ template "postgresql.fullname" . }} labels: - app: {{ template "fullname" . }} + app: {{ template "postgresql.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" diff --git a/stable/postgresql/templates/secrets.yaml b/stable/postgresql/templates/secrets.yaml index ef0db253bd..6dd4c7da55 100644 --- a/stable/postgresql/templates/secrets.yaml +++ b/stable/postgresql/templates/secrets.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Secret metadata: - name: {{ template "fullname" . }} + name: {{ template "postgresql.fullname" . }} labels: - app: {{ template "fullname" . }} + app: {{ template "postgresql.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" diff --git a/stable/postgresql/templates/svc.yaml b/stable/postgresql/templates/svc.yaml index 903637db4a..6446db5340 100644 --- a/stable/postgresql/templates/svc.yaml +++ b/stable/postgresql/templates/svc.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "fullname" . }} + name: {{ template "postgresql.fullname" . }} labels: - app: {{ template "fullname" . }} + app: {{ template "postgresql.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" @@ -23,4 +23,4 @@ spec: {{ toYaml .Values.service.externalIPs | indent 4 }} {{- end }} selector: - app: {{ template "fullname" . }} \ No newline at end of file + app: {{ template "postgresql.fullname" . }} \ No newline at end of file