Initial postgresql chart (#154)

This commit is contained in:
Larry Rensing 2017-02-10 19:06:18 -06:00 committed by Alan Meadows
parent 347fdc86b0
commit 0c97c63cee
7 changed files with 116 additions and 3 deletions

View File

@ -1,12 +1,12 @@
.PHONY: ceph bootstrap mariadb keystone memcached rabbitmq common openstack neutron nova cinder heat maas all clean .PHONY: ceph bootstrap mariadb postgresql keystone memcached rabbitmq common openstack neutron nova cinder heat maas all clean
B64_DIRS := common/secrets B64_DIRS := common/secrets
B64_EXCLUDE := $(wildcard common/secrets/*.b64) B64_EXCLUDE := $(wildcard common/secrets/*.b64)
CHARTS := ceph mariadb rabbitmq memcached keystone glance horizon neutron nova cinder heat maas openstack CHARTS := ceph mariadb postgresql rabbitmq memcached keystone glance horizon neutron nova cinder heat maas openstack
COMMON_TPL := common/templates/_globals.tpl COMMON_TPL := common/templates/_globals.tpl
all: common ceph bootstrap mariadb rabbitmq memcached keystone glance horizon neutron nova cinder heat maas openstack all: common ceph bootstrap mariadb postgresql rabbitmq memcached keystone glance horizon neutron nova cinder heat maas openstack
common: build-common common: build-common
@ -17,6 +17,8 @@ bootstrap: build-bootstrap
mariadb: build-mariadb mariadb: build-mariadb
postgresql: build-postgresql
keystone: build-keystone keystone: build-keystone
cinder: build-cinder cinder: build-cinder

3
postgresql/Chart.yaml Normal file
View File

@ -0,0 +1,3 @@
description: A Helm chart for postgresql
name: postgresql
version: 0.1.0

11
postgresql/README.md Normal file
View File

@ -0,0 +1,11 @@
# openstack-helm/postgresql
This chart leverages StatefulSets, with persistent storage.
The StatefulSets all leverage PVCs to provide stateful storage to /var/lib/postgresql.
You must ensure that your control nodes that should receive postgresql instances are labeled with openstack-control-plane=enabled, or whatever you have configured in values.yaml for the label configuration:
```
kubectl label nodes openstack-control-plane=enabled --all
```

View File

@ -0,0 +1,4 @@
dependencies:
- name: common
repository: http://localhost:8879/charts
version: 0.1.0

View File

@ -0,0 +1,54 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: {{ .Values.service_name }}
spec:
serviceName: {{ .Values.service_name }}
replicas: {{ .Values.replicas }}
template:
metadata:
labels:
app: {{ .Values.service_name }}
spec:
nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
containers:
- name: {{ .Values.service_name }}
image: {{ .Values.images.postgresql }}
imagePullPolicy: {{ .Values.images.pull_policy }}
ports:
- containerPort: {{ .Values.network.port.postgresql }}
livenessProbe:
exec:
command:
- pg_isready
initialDelaySeconds: 20
timeoutSeconds: 5
readinessProbe:
exec:
command:
- pg_isready
initialDelaySeconds: 20
timeoutSeconds: 5
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
- name: postgresql-data
mountPath: /var/lib/postgresql
volumes:
{{- if .Values.development.enabled }}
- name: postgresql-data
hostPath:
path: {{ .Values.development.storage_path }}
{{- else }}
volumeClaimTemplates:
- metadata:
name: postgresql-data
annotations:
{{ .Values.volume.class_path }}: {{ .Values.volume.class_name }}
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: {{ .Values.volume.size }}
{{- end }}

View File

@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service_name }}
spec:
ports:
- name: db
port: {{ .Values.network.port.postgresql }}
selector:
app: {{ .Values.service_name }}

29
postgresql/values.yaml Normal file
View File

@ -0,0 +1,29 @@
# Default values for postgresql.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
development:
enabled: true
storage_path: /data/openstack-helm/postgresql
replicas: 1 #only 1 replica currently supported
service_name: postgresql
# using dockerhub postgresql: https://hub.docker.com/r/library/postgres/tags/
images:
postgresql: "docker.io/postgres:9.5"
pull_policy: IfNotPresent
volume:
class_path: volume.beta.kubernetes.io/storage-class
class_name: general
size: 20Gi
labels:
node_selector_key: openstack-control-plane
node_selector_value: enabled
network:
port:
postgresql: 5432