From 3bef88acd104bff9c4dc46d3ee55ef370dbe0d35 Mon Sep 17 00:00:00 2001 From: "Zhang Rong(Jon)" Date: Fri, 4 Nov 2022 11:18:49 +0800 Subject: [PATCH] Set helm CLI container not start by default; Add PV for DB Issue-ID: INF-308 Signed-off-by: Zhang Rong(Jon) Change-Id: I9f866c52c03591c18064cce621c0f92525d43353 --- charts/templates/deployment.yaml | 9 +++++++++ charts/templates/persistent_volume.yaml | 28 ++++++++++++++++++++++++++++ charts/templates/serviceaccount.yaml | 4 ++-- charts/values.yaml | 6 ++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 charts/templates/persistent_volume.yaml diff --git a/charts/templates/deployment.yaml b/charts/templates/deployment.yaml index 4a10890..0976512 100644 --- a/charts/templates/deployment.yaml +++ b/charts/templates/deployment.yaml @@ -49,10 +49,14 @@ spec: value: o2ims123 - name: POSTGRES_USER value: o2ims + - name: PGDATA + value: /var/lib/postgresql/data/pgdata command: ["/bin/bash", "/opt/postgres_start.sh"] volumeMounts: - name: scripts mountPath: /opt + - name: db-pv + mountPath: /var/lib/postgresql/data - name: redis image: redis:alpine ports: @@ -164,6 +168,7 @@ spec: mountPath: /configs/server.key subPath: config.json readOnly: true + {{- if .Values.o2dms.helm_cli_enable }} - name: helmcli image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}" ports: @@ -177,6 +182,7 @@ spec: volumeMounts: - name: scripts mountPath: /opt + {{- end }} volumes: - name: scripts configMap: @@ -195,4 +201,7 @@ spec: - configMap: name: {{ .Chart.Name }}-smocacrt name: smocacrt + - name: db-pv + persistentVolumeClaim: + claimName: {{ .Chart.Name }}-db-pv --- diff --git a/charts/templates/persistent_volume.yaml b/charts/templates/persistent_volume.yaml new file mode 100644 index 0000000..c39d70a --- /dev/null +++ b/charts/templates/persistent_volume.yaml @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Wind River Systems, Inc. +# +# 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: PersistentVolumeClaim +metadata: + name: {{ .Chart.Name }}-db-pv + namespace: {{ .Values.global.namespace }} +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.db.storageSize }} + storageClassName: general +--- \ No newline at end of file diff --git a/charts/templates/serviceaccount.yaml b/charts/templates/serviceaccount.yaml index 2ce5705..86b3c16 100644 --- a/charts/templates/serviceaccount.yaml +++ b/charts/templates/serviceaccount.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ .Values.o2ims.serviceaccountname }} - namespace: oran-o2 + namespace: {{ .Values.global.namespace }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -12,7 +12,7 @@ metadata: name: {{ .Values.o2ims.serviceaccountname }} subjects: - kind: ServiceAccount - namespace: oran-o2 + namespace: {{ .Values.global.namespace }} name: {{ .Values.o2ims.serviceaccountname }} roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/charts/values.yaml b/charts/values.yaml index 6d1fa54..f0a9708 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -37,6 +37,9 @@ resources: global: namespace: oran-o2 +db: + storageSize: 10Gi + o2ims: serviceaccountname: admin-oran-o2 image: @@ -45,6 +48,9 @@ o2ims: pullPolicy: IfNotPresent logginglevel: "WARNING" +o2dms: + helm_cli_enable: false + ocloud: OS_AUTH_URL: "" OS_USERNAME: "" -- 2.16.6