2 # ============LICENSE_START=======================================================
3 # Copyright (C) 2022 Nordix Foundation.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
21 kind: PersistentVolume
23 name: postgres-storage-pv-volume
29 storageClassName: manual
35 path: "/var/keycloak/data2"
38 kind: PersistentVolumeClaim
40 name: postgres-storage-pv-claim
45 storageClassName: manual
59 SELECT 'CREATE DATABASE capif'
60 WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'capif')\gexec
63 IF NOT EXISTS (SELECT FROM pg_user WHERE usename = 'capif') THEN
64 CREATE USER capif WITH PASSWORD 'capif';
65 GRANT ALL PRIVILEGES ON DATABASE capif TO capif;
103 - image: nexus3.onap.org:10001/postgres
105 imagePullPolicy: IfNotPresent
109 - name: POSTGRES_USER
111 - name: POSTGRES_PASSWORD
114 value: /var/lib/pgsql/data
118 command: [ "/bin/sh", "-c", "sleep 10 && psql -U $POSTGRES_USER -f /init.sql" ]
124 - exec pg_isready -U "keycloak" -h 127.0.0.1 -p 5432
125 initialDelaySeconds: 30
130 command: ["psql", "-w", "-U", $(POSTGRES_USER), "-d", $(POSTGRES_DB), "-c", "SELECT 1"]
131 initialDelaySeconds: 15
134 - containerPort: 5432
137 - name: postgres-persistent-storage
138 mountPath: /var/lib/pgsql/data
145 - name: postgres-persistent-storage
146 persistentVolumeClaim:
147 claimName: postgres-storage-pv-claim