From 995547b0dc8084266a7ff02da90931615b4318a3 Mon Sep 17 00:00:00 2001 From: abhijit_onap Date: Fri, 29 May 2020 23:59:50 +0530 Subject: [PATCH] Changes done for bug fixes Signed-off-by: abhijit_onap Change-Id: I414290f70db062bce7e1fe533ac75ddfc92246e1 --- .../files/deploy/applcm-broker-deployment.yaml | 12 ++-- .../roles/applcm/files/deploy/db-deployment.yaml | 70 ---------------------- .../{db-service.yaml => postgres-db-pvc.yaml} | 47 +++++++++------ .../roles/applcm/files/deploy/postgres-k8s.yaml | 69 +++++++++++++++++++++ 4 files changed, 106 insertions(+), 92 deletions(-) delete mode 100644 ocd/infra/playbooks/roles/applcm/files/deploy/db-deployment.yaml rename ocd/infra/playbooks/roles/applcm/files/deploy/{db-service.yaml => postgres-db-pvc.yaml} (56%) create mode 100644 ocd/infra/playbooks/roles/applcm/files/deploy/postgres-k8s.yaml diff --git a/ocd/infra/playbooks/roles/applcm/files/deploy/applcm-broker-deployment.yaml b/ocd/infra/playbooks/roles/applcm/files/deploy/applcm-broker-deployment.yaml index ce4d6b4..74bb34a 100644 --- a/ocd/infra/playbooks/roles/applcm/files/deploy/applcm-broker-deployment.yaml +++ b/ocd/infra/playbooks/roles/applcm/files/deploy/applcm-broker-deployment.yaml @@ -50,13 +50,15 @@ spec: value: /go/release/logfile - name: LOGGER_LEVEL value: info - - name: MYSQL_DATABASE - value: db - - name: MYSQL_PASSWORD + - name: POSTGRES_DATABASE + value: mecmdb + - name: DBHOST + value: mecmdb + - name: POSTGRES_PASSWORD value: password - - name: MYSQL_ROOT_PASSWORD + - name: POSTGRES_ROOT_PASSWORD value: password - - name: MYSQL_USER + - name: POSTGRES_USER value: root - name: PACKAGE_ARTIFACT_PATH value: /Artifacts/Deployment/ diff --git a/ocd/infra/playbooks/roles/applcm/files/deploy/db-deployment.yaml b/ocd/infra/playbooks/roles/applcm/files/deploy/db-deployment.yaml deleted file mode 100644 index 3d75520..0000000 --- a/ocd/infra/playbooks/roles/applcm/files/deploy/db-deployment.yaml +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2020 Huawei Technologies Co., Ltd. -# -# 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. - -# yamllint disable -apiVersion: apps/v1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose convert - kompose.version: 1.21.0 (992df58d8) - creationTimestamp: null - labels: - io.kompose.service: db - name: db -spec: - replicas: 1 - selector: - matchLabels: - io.kompose.service: db - strategy: - type: Recreate - template: - metadata: - annotations: - kompose.cmd: kompose convert - kompose.version: 1.21.0 (992df58d8) - creationTimestamp: null - labels: - io.kompose.service: db - spec: - containers: - - env: - - name: MYSQL_DATABASE - value: db - - name: MYSQL_PASSWORD - value: password - - name: MYSQL_ROOT_PASSWORD - value: password - - name: MYSQL_USER - value: root - image: mysql/mysql-server - imagePullPolicy: "" - name: db - ports: - - containerPort: 3306 - resources: {} - volumeMounts: - - mountPath: /var/lib/mysql - name: my-db - restartPolicy: Always - serviceAccountName: "" - volumes: - - name: my-db - hostPath: - path: /data - type: DirectoryOrCreate -status: {} - -# yamllint enable diff --git a/ocd/infra/playbooks/roles/applcm/files/deploy/db-service.yaml b/ocd/infra/playbooks/roles/applcm/files/deploy/postgres-db-pvc.yaml similarity index 56% rename from ocd/infra/playbooks/roles/applcm/files/deploy/db-service.yaml rename to ocd/infra/playbooks/roles/applcm/files/deploy/postgres-db-pvc.yaml index ee1adb2..85aac62 100644 --- a/ocd/infra/playbooks/roles/applcm/files/deploy/db-service.yaml +++ b/ocd/infra/playbooks/roles/applcm/files/deploy/postgres-db-pvc.yaml @@ -12,25 +12,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -# yamllint disable + +# persistent volume +--- +kind: PersistentVolume apiVersion: v1 -kind: Service metadata: - annotations: - kompose.cmd: kompose convert - kompose.version: 1.21.0 (992df58d8) - creationTimestamp: null + name: postgres-pv-volume labels: - io.kompose.service: db - name: dbhost + type: local + app: postgres spec: - ports: - - name: "3306" - port: 3306 - targetPort: 3306 - selector: - io.kompose.service: db -status: - loadBalancer: {} + storageClassName: manual + capacity: + storage: 5Gi + accessModes: + - ReadWriteMany + hostPath: + path: "/data" -# yamllint enable +# pvc +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: postgres-pv-claim + namespace: default + labels: + app: postgres +spec: + storageClassName: manual + accessModes: + - ReadWriteMany + resources: + requests: + storage: 5Gi diff --git a/ocd/infra/playbooks/roles/applcm/files/deploy/postgres-k8s.yaml b/ocd/infra/playbooks/roles/applcm/files/deploy/postgres-k8s.yaml new file mode 100644 index 0000000..82e2921 --- /dev/null +++ b/ocd/infra/playbooks/roles/applcm/files/deploy/postgres-k8s.yaml @@ -0,0 +1,69 @@ +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# 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. + + +# postgres database +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: postgres-db + namespace: default + labels: + app: postgres-db +spec: + replicas: 1 + selector: + matchLabels: + app: postgres-db + template: + metadata: + labels: + app: postgres-db + spec: + volumes: + - name: postgres-data + persistentVolumeClaim: + claimName: postgres-pv-claim + containers: + - name: postgres-db + image: postgres:9.6 + imagePullPolicy: "IfNotPresent" + env: + - name: POSTGRES_DB + value: mecmdb + - name: POSTGRES_USER + value: root + - name: POSTGRES_PASSWORD + value: password + volumeMounts: + - mountPath: /var/lib/postgresql/data + name: postgres-data + ports: + - containerPort: 5432 + +# postgres service +--- +apiVersion: v1 +kind: Service +metadata: + name: mecmdb + namespace: default +spec: + selector: + app: postgres-db + ports: + - name: "5432" + port: 5432 + targetPort: 5432 -- 2.16.6