Fix postgresql utility

This fixes Postgres and adds deployment script.
   Also Fixed different unused links from deployment scripts.

Change-Id: I4b6307a805d15eeb062e85c732c14274dc7ca000
Signed-off-by: Sreejith Punnapuzha <sreejith.punnapuzha@outlook.com>
This commit is contained in:
Sreejith Punnapuzha 2019-10-24 16:06:00 -05:00 committed by diwakar thyagaraj
parent 744e4bb10a
commit 0546a3aff7
11 changed files with 155 additions and 30 deletions

View File

@ -0,0 +1,28 @@
{{/*
Copyright 2019 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_etc }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Secret
metadata:
name: postgresql-etc
type: Opaque
data:
{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.patroni "key" "patroni.yaml" "format" "Secret") | indent 2 }}
{{- end }}

View File

@ -82,6 +82,19 @@ spec:
{{ dict "envAll" $envAll "application" "postgresql" "container" "postgresql_utility" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- /tmp/bootstrap.sh
env:
- name: PATRONI_SUPERUSER_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.postgresql.admin }}
key: 'POSTGRES_USER'
- name: PATRONI_SUPERUSER_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.postgresql.admin }}
key: 'POSTGRES_PASSWORD'
- name: POSTGRESQL_HOST_PORT
value: {{ tuple "postgresql" "internal" "postgresql" $envAll | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }}
volumeMounts:
- name: postgresql-utility-bin
mountPath: /tmp/bootstrap.sh
@ -107,9 +120,6 @@ spec:
mountPath: /etc/postgresql/postgresql.conf
subPath: postgresql.conf
readOnly: true
- name: postgresql-client-admin-password
mountPath: /opt/client-password
subPath: key
- name: postgresql-utility-etc
mountPath: /etc/postgresql/rootwrap.d/postgresql-rootwrap.filter
subPath: postgresql-rootwrap-filter
@ -133,11 +143,11 @@ spec:
name: {{ printf "%s-%s" $envAll.Release.Name "etc" }}
defaultMode: 0555
- name: postgresql-etc
configMap:
name: {{ .Values.conf.postgresqlconf.etc }}
defaultMode: 0600
- name: postgresql-client-admin-password
secret:
secretName: {{ .Values.secrets.password.admin | quote }}
defaultMode: 0600
secretName: {{ .Values.conf.postgresqlconf.etc }}
defaultMode: 0444
- name: postgresql-admin
secret:
secretName: {{ .Values.secrets.postgresql.admin | quote }}
defaultMode: 0444
{{- end }}

View File

@ -0,0 +1,27 @@
{{/*
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.secret_admin }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.secrets.postgresql.admin }}
type: Opaque
data:
POSTGRES_USER: {{ .Values.endpoints.postgresql.auth.admin.username | b64enc }}
POSTGRES_PASSWORD: {{ .Values.endpoints.postgresql.auth.admin.password | b64enc }}
{{- end }}

View File

@ -0,0 +1,27 @@
{{/*
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.secret_etc }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Secret
metadata:
name: postgresql-secrets
type: Opaque
data:
admin_user.conf: {{ tuple "secrets/_admin_user.conf.tpl" . | include "helm-toolkit.utils.template" | b64enc }}
{{- end }}

View File

@ -0,0 +1,17 @@
{{/*
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.
*/}}
{{ tuple "postgresql" "internal" . | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" }}:*:*:{{ .Values.endpoints.postgresql.auth.admin.username }}:{{ .Values.endpoints.postgresql.auth.admin.password }}

View File

@ -86,7 +86,7 @@ pod:
cpu: "2000m"
secrets:
password:
postgresql:
admin: postgresql-admin
conf:
@ -169,6 +169,19 @@ endpoints:
port:
registry:
node: 5000
postgresql:
auth:
admin:
username: postgres
password: password
hosts:
default: postgresql
host_fqdn_override:
default: null
port:
postgresql:
default: 5432
monitoring:
prometheus:
enabled: true
@ -177,4 +190,7 @@ manifests:
configmap_bin: true
configmap_etc_client: true
configmap_etc_sudoers: true
configmap_etc: true
secret_etc: true
secret_admin: true
deployment_utility: true

View File

@ -2,10 +2,7 @@
set -xe
kubectl label nodes --all openstack-helm-node-class=enabled --overwrite
#NOTE: Lint and package chart
cd charts
helm upgrade --install calicoctl-utility ./calicoctl-utility --namespace=utility
#NOTE: Validate Deployment info

View File

@ -1,10 +1,7 @@
#!/bin/bash
set -xe
#NOTE: Lint and package chart
: ${OSH_INFRA_PATH:="../../openstack-helm-infra"}
cd charts
CURRENT_DIR="$(pwd)"
cd "${CURRENT_DIR}"/charts
make compute-utility
kubectl label nodes --all openstack-helm-node-class=primary --overwrite

View File

@ -1,10 +1,7 @@
#!/bin/bash
set -xe
#NOTE: Lint and package chart
: ${OSH_INFRA_PATH:="../../openstack-helm-infra"}
cd charts
CURRENT_DIR="$(pwd)"
cd "${CURRENT_DIR}"/charts
make etcdctl-utility
kubectl label nodes --all openstack-helm-node-class=primary --overwrite

View File

@ -1,10 +1,7 @@
#!/bin/bash
set -xe
#NOTE: Lint and package chart
: ${OSH_INFRA_PATH:="../../openstack-helm-infra"}
cd charts
CURRENT_DIR="$(pwd)"
cd "${CURRENT_DIR}"/charts
make mysqlclient-utility
kubectl label nodes --all openstack-helm-node-class=primary --overwrite
@ -12,5 +9,4 @@ kubectl label nodes --all openstack-helm-node-class=primary --overwrite
helm upgrade --install mysqlclient-utility ./mysqlclient-utility --namespace=utility
#NOTE: Validate Deployment info
kubectl get pods -n utility |grep mysqlclient-utility
helm status mysqlclient-utility
kubectl get pods -n utility | grep mysqlclient-utility

View File

@ -0,0 +1,13 @@
#!/bin/bash
set -xe
CURRENT_DIR="$(pwd)"
cd "${CURRENT_DIR}"/charts
kubectl label nodes --all openstack-helm-node-class=primary --overwrite
helm upgrade --install postgresql-utility ./postgresql-utility --namespace=utility
sleep 60
#NOTE: Validate Deployment info
kubectl get pods --all-namespaces | grep postgresql-utility