point MaaS to postgresql instance within cluster (#199)
* Initial postgresql chart * maas/postgres wip * updated readme for postgresql * Edit service dependency
This commit is contained in:
parent
5f0ffce99b
commit
9bc0183ba0
@ -31,6 +31,7 @@
|
|||||||
# infrastructure services
|
# infrastructure services
|
||||||
{{- define "helm-toolkit.rabbitmq_host"}}memcached.{{.Release.Namespace}}.svc.{{ include "helm-toolkit.region" . }}.{{ include "helm-toolkit.tld" . }}{{- end}}
|
{{- define "helm-toolkit.rabbitmq_host"}}memcached.{{.Release.Namespace}}.svc.{{ include "helm-toolkit.region" . }}.{{ include "helm-toolkit.tld" . }}{{- end}}
|
||||||
{{- define "helm-toolkit.mariadb_host"}}mariadb.{{.Release.Namespace}}.svc.{{ include "helm-toolkit.region" . }}.{{ include "helm-toolkit.tld" . }}{{- end}}
|
{{- define "helm-toolkit.mariadb_host"}}mariadb.{{.Release.Namespace}}.svc.{{ include "helm-toolkit.region" . }}.{{ include "helm-toolkit.tld" . }}{{- end}}
|
||||||
|
{{- define "helm-toolkit.postgresql_host"}}postgresql.{{.Release.Namespace}}.svc.{{ include "helm-toolkit.region" . }}.{{ include "helm-toolkit.tld" . }}{{- end}}
|
||||||
|
|
||||||
# nova defaults
|
# nova defaults
|
||||||
{{- define "helm-toolkit.nova_metadata_host"}}nova-api.{{ include "helm-toolkit.fqdn" . }}{{- end}}
|
{{- define "helm-toolkit.nova_metadata_host"}}nova-api.{{ include "helm-toolkit.fqdn" . }}{{- end}}
|
||||||
|
@ -4,6 +4,22 @@ This chart installs a working version of MaaS on kubernetes.
|
|||||||
|
|
||||||
### Quickstart
|
### Quickstart
|
||||||
|
|
||||||
|
This chart requires a postgresql instance to be running.
|
||||||
|
|
||||||
|
To install postgresql:
|
||||||
|
|
||||||
|
```
|
||||||
|
helm install postgresql --namespace=maas
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: Postgresql may take a short time to reach the 'Running' state. Verify that postgresql is running:
|
||||||
|
|
||||||
|
```
|
||||||
|
# kubectl get pods -n maas
|
||||||
|
NAME READY STATUS RESTARTS AGE
|
||||||
|
postgresql-0 1/1 Running 0 1m
|
||||||
|
```
|
||||||
|
|
||||||
To deploy your MaaS chart:
|
To deploy your MaaS chart:
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -13,16 +29,34 @@ helm install maas --namespace=maas
|
|||||||
To verify the helm deployment was successful:
|
To verify the helm deployment was successful:
|
||||||
```
|
```
|
||||||
# helm ls
|
# helm ls
|
||||||
NAME REVISION UPDATED STATUS CHART
|
NAME REVISION UPDATED STATUS CHART
|
||||||
opining-ocelot 1 Wed Nov 23 19:48:41 2016 DEPLOYED maas-0.1.0
|
opining-mule 1 Mon Feb 13 22:20:08 2017 DEPLOYED maas-0.1.0
|
||||||
|
sweet-manatee 1 Mon Feb 13 21:57:41 2017 DEPLOYED postgresql-0.1.0
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
To check that all resources are working as intended:
|
To check that all resources are working as intended:
|
||||||
```
|
```
|
||||||
# kubectl get all --namespace=maas
|
# kubectl get all --namespace=maas
|
||||||
|
NAME READY STATUS RESTARTS AGE
|
||||||
|
po/maas-rack-3238195061-tn5fv 1/1 Running 0 11m
|
||||||
|
po/maas-region-0 1/1 Running 0 11m
|
||||||
|
po/postgresql-0 1/1 Running 0 34m
|
||||||
|
|
||||||
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
svc/maas-region-ui 10.109.228.165 <nodes> 80/TCP,8000/TCP 2m
|
svc/maas-region-ui 10.105.136.244 <none> 80/TCP,8000/TCP 11m
|
||||||
NAME READY STATUS RESTARTS AGE
|
svc/postgresql 10.107.159.38 <none> 5432/TCP 34m
|
||||||
po/maas-rack-2449935402-ppn34 1/1 Running 0 2m
|
|
||||||
po/maas-region-638716514-miczz 1/1 Running 0 2m
|
NAME DESIRED CURRENT AGE
|
||||||
|
statefulsets/maas-region 1 1 11m
|
||||||
|
statefulsets/postgresql 1 1 34m
|
||||||
|
|
||||||
|
NAME DESIRED SUCCESSFUL AGE
|
||||||
|
jobs/region-import-resources 1 1 11m
|
||||||
|
|
||||||
|
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
|
||||||
|
deploy/maas-rack 1 1 1 1 11m
|
||||||
|
|
||||||
|
NAME DESIRED CURRENT READY AGE
|
||||||
|
rs/maas-rack-3238195061 1 1 1 11m
|
||||||
```
|
```
|
||||||
|
@ -34,7 +34,7 @@ function check_for_download {
|
|||||||
}
|
}
|
||||||
|
|
||||||
maas-region local_config_set \
|
maas-region local_config_set \
|
||||||
--database-host "{{ .Values.db_service_name }}.{{ .Release.Namespace }}" \
|
--database-host "{{ include "helm-toolkit.postgresql_host" . }}" \
|
||||||
--database-name "{{ .Values.database.db_name }}" \
|
--database-name "{{ .Values.database.db_name }}" \
|
||||||
--database-user "{{ .Values.database.db_user }}" \
|
--database-user "{{ .Values.database.db_user }}" \
|
||||||
--database-pass "{{ .Values.database.db_password }}" \
|
--database-pass "{{ .Values.database.db_password }}" \
|
||||||
|
@ -87,16 +87,13 @@ if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
|||||||
################ Configure Database ###################
|
################ Configure Database ###################
|
||||||
#########################################################
|
#########################################################
|
||||||
|
|
||||||
# Need to for postgresql start so it doesn't fail on the installer
|
|
||||||
restart_postgresql
|
|
||||||
|
|
||||||
# Create the database
|
# Create the database
|
||||||
dbc_go maas-region-controller $@
|
dbc_go maas-region-controller $@
|
||||||
maas-region local_config_set \
|
maas-region local_config_set \
|
||||||
--database-host "localhost" \
|
--database-host {{ include "helm-toolkit.postgresql_host" . | quote }} \
|
||||||
--database-name "{{ .Values.database.db_name }}" \
|
--database-name {{ .Values.database.db_name | quote }} \
|
||||||
--database-user "{{ .Values.database.db_user }}" \
|
--database-user {{ .Values.database.db_user | quote }} \
|
||||||
--database-pass "{{ .Values.database.db_password }}"
|
--database-pass {{ .Values.database.db_password | quote }}
|
||||||
|
|
||||||
# Only syncdb if we have selected to install it with dbconfig-common.
|
# Only syncdb if we have selected to install it with dbconfig-common.
|
||||||
db_get maas-region-controller/dbconfig-install
|
db_get maas-region-controller/dbconfig-install
|
||||||
|
@ -16,19 +16,6 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
if ! find "/etc/postgresql" -mindepth 1 -print -quit | grep -q .; then
|
|
||||||
pg_createcluster 9.5 main
|
|
||||||
|
|
||||||
#allow external connections to postgresql
|
|
||||||
sed -i '/#listen_addresses/s/^#//g' /etc/postgresql/9.5/main/postgresql.conf
|
|
||||||
sed -i '/^listen_addresses/ s/localhost/*/' /etc/postgresql/9.5/main/postgresql.conf
|
|
||||||
sed -i '$ a host all all 0.0.0.0/0 md5' /etc/postgresql/9.5/main/pg_hba.conf
|
|
||||||
sed -i '$ a host all all ::/0 md5' /etc/postgresql/9.5/main/pg_hba.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp -r /etc/postgresql/9.5/main/*.conf /var/lib/postgresql/9.5/main/
|
|
||||||
pg_ctlcluster 9.5 main start
|
|
||||||
|
|
||||||
echo 'running postinst'
|
echo 'running postinst'
|
||||||
|
|
||||||
chmod 755 /var/lib/dpkg/info/maas-region-controller.postinst
|
chmod 755 /var/lib/dpkg/info/maas-region-controller.postinst
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
# 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.
|
|
||||||
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: {{ .Values.db_service_name }}
|
|
||||||
labels:
|
|
||||||
app: db-service
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.network.port.db_service }}
|
|
||||||
targetPort: {{ .Values.network.port.db_service_target }}
|
|
||||||
name: db-service
|
|
||||||
selector:
|
|
||||||
app: maas-region
|
|
@ -34,18 +34,6 @@ spec:
|
|||||||
"name": "maas-config",
|
"name": "maas-config",
|
||||||
"mountPath": "/etc/maas/"
|
"mountPath": "/etc/maas/"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "postgresql-config",
|
|
||||||
"mountPath": "/etc/postgresql"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "postgresql-data",
|
|
||||||
"mountPath": "/var/lib/postgresql"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "postgresql-run",
|
|
||||||
"mountPath": "/var/run/postgresql"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "startsh",
|
"name": "startsh",
|
||||||
"mountPath": "/tmp/start.sh",
|
"mountPath": "/tmp/start.sh",
|
||||||
@ -83,25 +71,17 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- name: region-ui
|
- name: region-ui
|
||||||
containerPort: {{ .Values.network.port.region_container }}
|
containerPort: {{ .Values.network.port.region_container }}
|
||||||
- name: postgresql
|
|
||||||
containerPort: {{ .Values.network.port.db_service }}
|
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: {{ .Values.network.port.region_container }}
|
port: {{ .Values.network.port.region_container }}
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: postgresql-data
|
|
||||||
mountPath: /var/lib/postgresql
|
|
||||||
- name: postgresql-run
|
|
||||||
mountPath: /var/run/postgresql
|
|
||||||
- name: maas-lib
|
- name: maas-lib
|
||||||
mountPath: /var/lib/maas
|
mountPath: /var/lib/maas
|
||||||
- name: maas-region-secret
|
- name: maas-region-secret
|
||||||
mountPath: /var/lib/maas/secret
|
mountPath: /var/lib/maas/secret
|
||||||
subPath: secret
|
subPath: secret
|
||||||
- name: postgresql-config
|
|
||||||
mountPath: /etc/postgresql
|
|
||||||
- name: maas-dns-config
|
- name: maas-dns-config
|
||||||
mountPath: /etc/bind/named.conf.options
|
mountPath: /etc/bind/named.conf.options
|
||||||
subPath: named.conf.options
|
subPath: named.conf.options
|
||||||
@ -109,13 +89,6 @@ spec:
|
|||||||
mountPath: /etc/maas/regiond.conf
|
mountPath: /etc/maas/regiond.conf
|
||||||
subPath: regiond.conf
|
subPath: regiond.conf
|
||||||
volumes:
|
volumes:
|
||||||
- name: postgresql-data
|
|
||||||
hostPath:
|
|
||||||
path: /var/lib/postgresql
|
|
||||||
- name: postgresql-run
|
|
||||||
emptyDir: {}
|
|
||||||
- name: postgresql-config
|
|
||||||
emptyDir: {}
|
|
||||||
- name: maas-lib
|
- name: maas-lib
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
- name: maas-region-secret
|
- name: maas-region-secret
|
||||||
|
@ -50,6 +50,9 @@ dbc_dbname='{{ .Values.database.db_name }}'
|
|||||||
# ignored and instead is determined from /etc/mysql/debian.cnf.
|
# ignored and instead is determined from /etc/mysql/debian.cnf.
|
||||||
dbc_dbadmin='postgres'
|
dbc_dbadmin='postgres'
|
||||||
|
|
||||||
|
dbc_dbserver={{ include "helm-toolkit.postgresql_host" . | quote }}
|
||||||
|
dbc_dbport={{ .Values.network.port.db_service }}
|
||||||
|
|
||||||
# dbc_authmethod_admin: authentication method for admin
|
# dbc_authmethod_admin: authentication method for admin
|
||||||
# dbc_authmethod_user: authentication method for dbuser
|
# dbc_authmethod_user: authentication method for dbuser
|
||||||
# see the section titled "AUTHENTICATION METHODS" in
|
# see the section titled "AUTHENTICATION METHODS" in
|
||||||
|
@ -34,7 +34,7 @@ dependencies:
|
|||||||
- maas-region
|
- maas-region
|
||||||
service:
|
service:
|
||||||
- maas-region-ui
|
- maas-region-ui
|
||||||
- db-service
|
- postgresql
|
||||||
|
|
||||||
images:
|
images:
|
||||||
maas_region: quay.io/attcomdev/maas-region:2.1.2-2
|
maas_region: quay.io/attcomdev/maas-region:2.1.2-2
|
||||||
|
@ -19,8 +19,3 @@
|
|||||||
.project
|
.project
|
||||||
.idea/
|
.idea/
|
||||||
*.tmproj
|
*.tmproj
|
||||||
|
|
||||||
secrets/
|
|
||||||
patches/
|
|
||||||
*.py
|
|
||||||
Makefile
|
|
Loading…
Reference in New Issue
Block a user