diff options
Diffstat (limited to 'kubernetes')
-rw-r--r-- | kubernetes/vnfsdk/charts/vnfsdk-postgres/templates/deployment.yaml | 44 | ||||
-rw-r--r-- | kubernetes/vnfsdk/charts/vnfsdk-postgres/templates/service.yaml | 38 | ||||
-rw-r--r-- | kubernetes/vnfsdk/charts/vnfsdk-postgres/values.yaml | 63 | ||||
-rw-r--r-- | kubernetes/vnfsdk/requirements.yaml | 3 | ||||
-rw-r--r-- | kubernetes/vnfsdk/resources/config/marketplace_tables_postgres.sql | 25 | ||||
-rw-r--r-- | kubernetes/vnfsdk/templates/configmap.yaml (renamed from kubernetes/vnfsdk/charts/vnfsdk-postgres/Chart.yaml) | 9 | ||||
-rw-r--r-- | kubernetes/vnfsdk/templates/deployment.yaml | 4 | ||||
-rw-r--r-- | kubernetes/vnfsdk/templates/job.yaml | 70 | ||||
-rw-r--r-- | kubernetes/vnfsdk/values.yaml | 23 |
9 files changed, 127 insertions, 152 deletions
diff --git a/kubernetes/vnfsdk/charts/vnfsdk-postgres/templates/deployment.yaml b/kubernetes/vnfsdk/charts/vnfsdk-postgres/templates/deployment.yaml deleted file mode 100644 index 88d6238f35..0000000000 --- a/kubernetes/vnfsdk/charts/vnfsdk-postgres/templates/deployment.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# 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: extensions/v1beta1 -kind: Deployment -metadata: - name: {{ include "common.fullname" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: {{ include "common.name" . }} - template: - metadata: - labels: - app: {{ include "common.name" . }} - release: {{ .Release.Name }} - name: {{ include "common.name" . }} - spec: - hostname: {{ include "common.name" . }} - containers: - - args: - image: "{{ include "common.repository" . }}/{{ .Values.image }}" - imagePullPolicy: {{ .Values.pullPolicy | default .Values.global.pullPolicy }} - name: {{ include "common.name" . }} - imagePullSecrets: - - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/vnfsdk/charts/vnfsdk-postgres/templates/service.yaml b/kubernetes/vnfsdk/charts/vnfsdk-postgres/templates/service.yaml deleted file mode 100644 index f6208cf965..0000000000 --- a/kubernetes/vnfsdk/charts/vnfsdk-postgres/templates/service.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# 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: Service -metadata: - name: {{ include "common.servicename" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - type: {{ .Values.service.type }} - ports: - {{if eq .Values.service.type "NodePort" -}} - - port: {{ .Values.service.internalPort }} - nodePort: {{ .Values.global.nodePortPrefix | default "302" }}{{ .Values.service.nodePort }} - {{- else -}} - - port: {{ .Values.service.externalPort }} - targetPort: {{ .Values.service.internalPort }} - {{- end}} - name: {{ .Values.service.portName | default "http" }} - selector: - app: {{ include "common.name" . }} - release: {{ .Release.Name }} diff --git a/kubernetes/vnfsdk/charts/vnfsdk-postgres/values.yaml b/kubernetes/vnfsdk/charts/vnfsdk-postgres/values.yaml deleted file mode 100644 index 8582593c62..0000000000 --- a/kubernetes/vnfsdk/charts/vnfsdk-postgres/values.yaml +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright © 2018 ZTE -# Modifications Copyright © 2018 AT&T, 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. - -################################################################# -# Global configuration defaults. -################################################################# -global: - nodePortPrefix: 302 - repository: nexus3.onap.org:10001 - readinessRepository: oomk8s - readinessImage: readiness-check:2.0.0 - loggingRepository: docker.elastic.co - loggingImage: beats/filebeat:5.5.0 - -################################################################# -# Application configuration defaults. -################################################################# -# application image -repository: nexus3.onap.org:10001 -image: onap/vnfsdk/refrepo/postgres:1.1.1 -pullPolicy: Always - -# flag to enable debugging - application support required -debugEnabled: false - -replicaCount: 1 - -nodeSelector: {} - -affinity: {} - -# probe configuration parameters -liveness: - initialDelaySeconds: 10 - periodSeconds: 10 - # necessary to disable liveness probe when setting breakpoints - # in debugger so K8s doesn't restart unresponsive container - enabled: true - -readiness: - initialDelaySeconds: 10 - periodSeconds: 10 - -service: - type: ClusterIP - name: vnfsdk-postgres - portName: vnfsdk-postgres - internalPort: 5432 - externalPort: 5432 - -ingress: - enabled: false diff --git a/kubernetes/vnfsdk/requirements.yaml b/kubernetes/vnfsdk/requirements.yaml index ce82a2f838..3b2a02a480 100644 --- a/kubernetes/vnfsdk/requirements.yaml +++ b/kubernetes/vnfsdk/requirements.yaml @@ -16,3 +16,6 @@ dependencies: - name: common version: ~2.0.0 repository: '@local' + - name: postgres + version: ~2.0.0 + repository: '@local' diff --git a/kubernetes/vnfsdk/resources/config/marketplace_tables_postgres.sql b/kubernetes/vnfsdk/resources/config/marketplace_tables_postgres.sql new file mode 100644 index 0000000000..c05d7f2d00 --- /dev/null +++ b/kubernetes/vnfsdk/resources/config/marketplace_tables_postgres.sql @@ -0,0 +1,25 @@ +CREATE DATABASE "marketplaceDB"; + +\c marketplaceDB; + +DROP TABLE IF EXISTS CSAR_PACKAGE_TABLE; + +CREATE TABLE CSAR_PACKAGE_TABLE ( + CSARID VARCHAR(200) NOT NULL, + DOWNLOADURI VARCHAR(200) NULL, + REPORT VARCHAR(200) NULL, + SIZE VARCHAR(100) NULL, + FORMAT VARCHAR(100) NULL, + CREATETIME VARCHAR(100) NULL, + DELETIONPENDING VARCHAR(100) NULL, + MODIFYTIME VARCHAR(100) NULL, + SHORTDESC TEXT NULL, + NAME VARCHAR(100) NULL, + VERSION VARCHAR(20) NULL, + PROVIDER VARCHAR(300) NULL, + TYPE VARCHAR(300) NULL, + DETAILS TEXT NULL, + REMARKS TEXT NULL, + DOWNLOADCOUNT INT NULL, + CONSTRAINT csar_package_table_pkey PRIMARY KEY (CSARID) +); diff --git a/kubernetes/vnfsdk/charts/vnfsdk-postgres/Chart.yaml b/kubernetes/vnfsdk/templates/configmap.yaml index db7201d7c6..5a40a61427 100644 --- a/kubernetes/vnfsdk/charts/vnfsdk-postgres/Chart.yaml +++ b/kubernetes/vnfsdk/templates/configmap.yaml @@ -13,6 +13,9 @@ # limitations under the License. apiVersion: v1 -description: ONAP VNFSDK Postgres Database -name: vnfsdk-postgres -version: 2.0.0 +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" . }} diff --git a/kubernetes/vnfsdk/values.yaml b/kubernetes/vnfsdk/values.yaml index edca2ece6c..0db7744523 100644 --- a/kubernetes/vnfsdk/values.yaml +++ b/kubernetes/vnfsdk/values.yaml @@ -29,11 +29,30 @@ global: # application image repository: nexus3.onap.org:10001 image: onap/vnfsdk/refrepo:1.1.1 +postgresRepository: crunchydata +postgresImage: crunchy-postgres:centos7-10.3-1.8.2 pullPolicy: Always -#subchart name -vnfsdkpostgres: +# application configuration override for postgres +postgres: nameOverride: vnfsdk-postgres + service: + name: vnfsdk-dbset + name2: vnfsdk-dbpri + name3: vnfsdk-dbrep + container: + name: + primary: vnfsdk-dbpri + replica: vnfsdk-dbrep + persistence: + mountSubPath: vnfsdk/data + mountInitPath: vnfsdk + config: + pgUserName: postgres + pgDatabase: postgres + pgPrimaryPassword: postgres + pgUserPassword: postgres + pgRootPassword: postgres # flag to enable debugging - application support required debugEnabled: false |