From fb56f0f4bf91c10fc2e898993c70c49613b67bcc Mon Sep 17 00:00:00 2001 From: jasmineWen Date: Wed, 29 Aug 2018 15:55:28 +0000 Subject: Upgrade VNFSDK to use common Postgres charts Issue-ID: OOM-1185 Change-Id: Ie011e87bc9322149076ec62cab3a8b3315e1d817 Signed-off-by: jasmineWen --- kubernetes/vnfsdk/templates/configmap.yaml | 21 +++++++++ kubernetes/vnfsdk/templates/deployment.yaml | 4 +- kubernetes/vnfsdk/templates/job.yaml | 70 +++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 kubernetes/vnfsdk/templates/configmap.yaml create mode 100644 kubernetes/vnfsdk/templates/job.yaml (limited to 'kubernetes/vnfsdk/templates') diff --git a/kubernetes/vnfsdk/templates/configmap.yaml b/kubernetes/vnfsdk/templates/configmap.yaml new file mode 100644 index 0000000000..5a40a61427 --- /dev/null +++ b/kubernetes/vnfsdk/templates/configmap.yaml @@ -0,0 +1,21 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# 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: ConfigMap +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/marketplace_tables_postgres.sql").AsConfig . | indent 2 }} diff --git a/kubernetes/vnfsdk/templates/deployment.yaml b/kubernetes/vnfsdk/templates/deployment.yaml index 8220553cf6..5b6f9237ce 100644 --- a/kubernetes/vnfsdk/templates/deployment.yaml +++ b/kubernetes/vnfsdk/templates/deployment.yaml @@ -38,7 +38,7 @@ spec: - /root/ready.py args: - --container-name - - "{{ .Values.vnfsdkpostgres.nameOverride }}" + - "{{ .Values.postgres.nameOverride }}" env: - name: NAMESPACE valueFrom: @@ -54,7 +54,7 @@ spec: name: {{ include "common.name" . }} env: - name: POSTGRES_SERVICE_HOST - value: "$(VNFSDK_POSTGRES_SERVICE_HOST)" + value: "$(VNFSDK_DBSET_SERVICE_HOST)" readinessProbe: tcpSocket: port: {{ .Values.service.internalPort }} diff --git a/kubernetes/vnfsdk/templates/job.yaml b/kubernetes/vnfsdk/templates/job.yaml new file mode 100644 index 0000000000..08d31077c6 --- /dev/null +++ b/kubernetes/vnfsdk/templates/job.yaml @@ -0,0 +1,70 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# 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: batch/v1 +kind: Job +metadata: + name: {{ include "common.fullname" . }}-init-postgres + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }}-job + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + backoffLimit: 20 + template: + metadata: + labels: + app: {{ include "common.name" . }}-job + release: {{ .Release.Name }} + spec: + restartPolicy: Never + initContainers: + - command: + - /root/ready.py + args: + - --container-name + - "{{ .Values.postgres.nameOverride }}" + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy}} + name: {{ include "common.name" . }}-readiness + containers: + - name: {{ include "common.name" . }}-job + image: "{{ .Values.postgresRepository }}/{{ .Values.postgresImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + env: + - name: PGPASSWORD + value: "{{ .Values.postgres.config.pgUserPassword }}" + command: + - /bin/sh + - -c + - | + psql -U {{ .Values.postgres.config.pgUserName }} -h $(VNFSDK_DBPRI_SERVICE_HOST) -f /aaa/init/marketplace_tables_postgres.sql + volumeMounts: + - name: init-data + mountPath: /aaa/init/marketplace_tables_postgres.sql + subPath: marketplace_tables_postgres.sql + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" + volumes: + - name: init-data + configMap: + name: {{ include "common.fullname" . }} -- cgit 1.2.3-korg