Postgresql: Update chart to match current OSH format

This PS updates the Postgresql chart to match the current OSH
format.

Change-Id: Ifadb473043b51ccc10405886ae7a0954ce119a22
This commit is contained in:
Pete Birley 2018-02-22 19:18:40 -08:00
parent 2dcaa1421d
commit 33f03ef828
7 changed files with 115 additions and 25 deletions

View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
{{/*
Copyright 2017 The Openstack-Helm Authors.
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.
*/}}
set -ex
pg_isready -U ${POSTGRES_USER}

View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
{{/*
Copyright 2017 The Openstack-Helm Authors.
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.
*/}}
set -ex
exec /docker-entrypoint.sh postgres

View File

@ -0,0 +1,30 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
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.
*/}}
{{- if .Values.manifests.configmap_bin }}
{{- $envAll := . }}
{{- $configMapBinName := printf "%s-%s" $envAll.Release.Name "etcd-bin" }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: postgresql-bin
data:
start.sh: |
{{ tuple "bin/_start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
readiness.sh: |
{{ tuple "bin/_readiness.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}

View File

@ -13,6 +13,7 @@ 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.
*/}}
{{- if .Values.manifests.secret_admin }}
---
apiVersion: v1

View File

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service }}
{{- $envAll := . }}
---
apiVersion: v1
@ -26,3 +27,4 @@ spec:
port: {{ tuple "postgresql" "internal" "postgresql" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
selector:
{{ tuple $envAll "postgresql" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
{{- end }}

View File

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.statefulset }}
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.postgresql }}
@ -43,6 +44,7 @@ spec:
- name: postgresql
image: {{ .Values.images.tags.postgresql }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
ports:
- containerPort: {{ tuple "postgresql" "internal" "postgresql" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
env:
@ -58,29 +60,38 @@ spec:
key: 'POSTGRES_USER'
- name: 'PGDATA'
value: {{ .Values.storage.mount.path | quote }}
command:
- /tmp/start.sh
livenessProbe:
exec:
command:
- pg_isready
- -U
- {{ .Values.endpoints.postgresql.auth.admin.username }}
- /tmp/readiness.sh
initialDelaySeconds: 20
timeoutSeconds: 5
readinessProbe:
exec:
command:
- pg_isready
- -U
- {{ .Values.endpoints.postgresql.auth.admin.username }}
- /tmp/readiness.sh
initialDelaySeconds: 20
timeoutSeconds: 5
{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
volumeMounts:
- name: postgresql-bin
mountPath: /tmp/start.sh
subPath: start.sh
readOnly: true
- name: postgresql-bin
mountPath: /tmp/readiness.sh
subPath: readiness.sh
readOnly: true
- name: postgresql-data
mountPath: {{ .Values.storage.mount.path }}
subPath: {{ .Values.storage.mount.subpath }}
{{- if not .Values.storage.pvc.enabled }}
volumes:
- name: postgresql-bin
configMap:
name: postgresql-bin
defaultMode: 0555
{{- if not .Values.storage.pvc.enabled }}
- name: postgresql-data
hostPath:
path: {{ .Values.storage.host.host_path }}
@ -96,3 +107,4 @@ spec:
requests:
storage: {{ .Values.storage.pvc.size }}
{{- end }}
{{- end }}

View File

@ -80,10 +80,13 @@ endpoints:
host_fqdn_override:
default: null
path: null
scheme: 'http'
scheme: postgresql
port:
postgresql:
default: 5432
manifests:
configmap_bin: true
secret_admin: true
service: true
statefulset: true