[Portal-NG] preferences and history 0.2.1 release 06/141506/4
authorbenzelleroehr <ben.zelleroehr@telekom.de>
Tue, 8 Jul 2025 09:15:46 +0000 (11:15 +0200)
committerbenzelleroehr <ben.zelleroehr@telekom.de>
Wed, 9 Jul 2025 18:13:33 +0000 (20:13 +0200)
- switch from MongoDB to PostgreSQL

Issue-ID: PORTALNG-147
Change-Id: If7ca8e86f8a0d11de3e4e8933030fde4f1aec742
Signed-off-by: benzelleroehr <ben.zelleroehr@telekom.de>
kubernetes/onap/Chart.yaml
kubernetes/portal-ng/Chart.yaml
kubernetes/portal-ng/components/portal-ng-history/Chart.yaml
kubernetes/portal-ng/components/portal-ng-history/templates/deployment.yaml
kubernetes/portal-ng/components/portal-ng-history/templates/secret.yaml
kubernetes/portal-ng/components/portal-ng-history/values.yaml
kubernetes/portal-ng/components/portal-ng-preferences/Chart.yaml
kubernetes/portal-ng/components/portal-ng-preferences/templates/deployment.yaml
kubernetes/portal-ng/components/portal-ng-preferences/templates/secret.yaml
kubernetes/portal-ng/components/portal-ng-preferences/values.yaml

index f1f1d69..4532ad7 100644 (file)
@@ -65,7 +65,7 @@ dependencies:
     repository: '@local'
     condition: policy.enabled
   - name: portal-ng
-    version: ~13.x-0
+    version: ~14.x-0
     repository: '@local'
     condition: portal-ng.enabled
   - name: postgres
index 796e98d..649b1cd 100644 (file)
@@ -15,7 +15,7 @@
 apiVersion: v2
 description: ONAP Next Generation Portal
 name: portal-ng
-version: 13.0.3
+version: 14.0.0
 
 dependencies:
   - name: common
@@ -25,10 +25,10 @@ dependencies:
     version: ~13.x-0
     repository: '@local'
   - name: portal-ng-preferences
-    version: ~13.x-0
+    version: ~14.x-0
     repository: '@local'
   - name: portal-ng-history
-    version: ~13.x-0
+    version: ~14.x-0
     repository: '@local'
   - name: portal-ng-ui
     version: ~13.x-0
index 6d16ff9..bd9a531 100644 (file)
@@ -29,12 +29,12 @@ type: application
 # This is the chart version. This version number should be incremented each time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 13.0.2
+version: 14.0.0
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
 # follow Semantic Versioning. They should reflect the version the application is using.
-appVersion: 0.1.1
+appVersion: 0.2.1
 
 dependencies:
   - name: common
@@ -46,6 +46,10 @@ dependencies:
   - name: serviceAccount
     version: ~13.x-0
     repository: '@local'
-  - name: mongodb
-    version: ~16.5.x-0
+  - name: postgres
+    version: ~13.x-0
+    repository: '@local'
+    condition: global.postgres.localCluster
+  - name: postgres-init
+    version: ~13.x-0
     repository: '@local'
index cdf47ca..9f41df5 100644 (file)
@@ -33,11 +33,20 @@ spec:
           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image.imageName }}:{{ .Values.image.tag | default .Chart.AppVersion }}
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           {{ include "common.containerSecurityContext" . | indent 10 | trim }}
+          env:
+            - name: HISTORY_DB_USERNAME
+              {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 14 }}
+            - name: HISTORY_DB_PASSWORD
+              {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 14 }}
+            - name: HISTORY_DB_HOST
+              value: {{ ternary .Values.postgres.service.name2 .Values.global.postgres.service.name2 .Values.global.postgres.localCluster }}
+            - name: HISTORY_DB_PORT
+              value: {{ ternary .Values.postgres.service.externalPort2 .Values.global.postgres.service.externalPort2 .Values.global.postgres.localCluster | quote}}
+            - name: HISTORY_DB
+              value: {{ .Values.postgres.config.pgDatabase }}
           envFrom:
             - configMapRef:
                 name: {{ include "common.fullname" . }}-configmap
-            - secretRef:
-                name: {{ include "common.fullname" . }}-secret
           ports: {{ include "common.containerPorts" . | nindent 12  }}
           livenessProbe:
             httpGet:
index 9fee578..ba5ef58 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 */}}
-apiVersion: v1
-kind: Secret
-metadata:
-  name: {{ include "common.fullname" . }}-secret
-  namespace: {{ include "common.namespace" . }}
-type: Opaque
-data:
-  {{- range $key, $val := .Values.secretEnv }}
-    {{ $key }}: {{ $val | b64enc | quote }}
-    {{- end -}}
\ No newline at end of file
+
+{{ include "common.secretFast" . }}
index cd7a62f..af99e18 100644 (file)
@@ -4,6 +4,33 @@ global:
     KEYCLOAK_REALM: onap
     COLLECTOR_HOST: jaeger-collector.istio-config
     COLLECTOR_PORT: 9411
+  #Service Names of the postgres db to connect to.
+  postgres:
+    localCluster: false
+    service:
+      name: pgset
+      externalPort: 5432
+      name2: tcp-pgset-primary
+      externalPort2: 5432
+      name3: tcp-pgset-replica
+      externalPort3: 5432
+    container:
+      name: postgres
+
+secrets:
+  - uid: pg-root-pass
+    name: &pgRootPassSecretName '{{ include "common.release" . }}-portal-ng-history-pg-root-pass'
+    type: password
+    externalSecret: '{{ ternary "" (tpl (default "" .Values.postgres.config.pgRootPasswordExternalSecret) .) (hasSuffix "portal-ng-history-pg-root-pass" .Values.postgres.config.pgRootPasswordExternalSecret) }}'
+    password: '{{ .Values.postgres.config.pgRootpassword }}'
+    policy: generate
+  - uid: pg-user-creds
+    name: &pgUserCredsSecretName '{{ include "common.release" . }}-portal-ng-history-pg-user-creds'
+    type: basicAuth
+    externalSecret: '{{ ternary "" (tpl (default "" .Values.postgres.config.pgUserExternalSecret) .) (hasSuffix "portal-ng-history-pg-user-creds" .Values.postgres.config.pgUserExternalSecret) }}'
+    login: '{{ .Values.postgres.config.pgUserName }}'
+    password: '{{ .Values.postgres.config.pgUserPassword }}'
+    passwordPolicy: generate
 
 image:
   imageName: onap/portal-ng/history
@@ -62,35 +89,47 @@ probes:
     initialDelaySeconds: 30
     failureThreshold: 5
 
-secretEnv:
-  MONGO_USERNAME: dbuser
-  MONGO_PASSWORD: dbpassword
-  MONGO_DATABASE: history
-
 env:
-  MONGO_HOST: history-mongodb
-  MONGO_PORT: 27017
   TRACING_ENABLED: true
 
-mongodb:
-  nameOverride: history-mongodb
+#################################################################
+# Postgres overriding defaults in the postgres
+#################################################################
+postgres:
+  nameOverride: &postgresName portal-ng-history-postgres
   service:
-    portName: tcp-mongodb
-  auth:
-    rootPassword: TrWAweN9y9eW
-    usernames:
-    - dbuser
-    passwords:
-    - dbpassword
-    databases:
-    - history
-  resources:
-    limits:
-      cpu: "2"
-      memory: "2Gi"
-    requests:
-      cpu: "250m"
-      memory: "500Mi"
+    name: *postgresName
+    externalPort: 5432
+    name2: portal-ng-history-pg-primary
+    externalPort2: 5432
+    name3: portal-ng-history-pg-replica
+    externalPort3: 5432
+  container:
+    name:
+      primary: portal-ng-history-pg-primary
+      replica: portal-ng-history-pg-replica
+  persistence:
+    mountSubPath: portal-ng-history/data
+    mountInitPath: portal-ng-history
+  config:
+    pgUserName: portalnghistory
+    pgDatabase: history
+    pgUserExternalSecret: *pgUserCredsSecretName
+    pgRootPasswordExternalSecret: *pgRootPassSecretName
+
+postgres-init:
+  nameOverride: portal-ng-history-postgres-init
+  config:
+    pgUserName: portalnghistory
+    pgDatabase: history
+    pgDataPath: data
+    pgUserExternalSecret: *pgUserCredsSecretName
+  serviceAccount:
+    nameOverride: portal-ng-history-postgres-init
+
+    # pgPrimaryPassword: password
+    # pgUserPassword: password
+    # pgRootPassword: password
 
 #Pods Service Account
 serviceAccount:
index 778afc1..9afd859 100644 (file)
@@ -29,12 +29,12 @@ type: application
 # This is the chart version. This version number should be incremented each time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 13.0.2
+version: 14.0.0
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
 # follow Semantic Versioning. They should reflect the version the application is using.
-appVersion: 0.1.1
+appVersion: 0.2.1
 
 dependencies:
   - name: common
@@ -46,6 +46,10 @@ dependencies:
   - name: serviceAccount
     version: ~13.x-0
     repository: '@local'
-  - name: mongodb
-    version: ~16.5.x-0
+  - name: postgres
+    version: ~13.x-0
+    repository: '@local'
+    condition: global.postgres.localCluster
+  - name: postgres-init
+    version: ~13.x-0
     repository: '@local'
index cdf47ca..3ce98fe 100644 (file)
@@ -33,11 +33,20 @@ spec:
           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image.imageName }}:{{ .Values.image.tag | default .Chart.AppVersion }}
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           {{ include "common.containerSecurityContext" . | indent 10 | trim }}
+          env:
+            - name: PREFERENCES_DB_USERNAME
+              {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 14 }}
+            - name: PREFERENCES_DB_PASSWORD
+              {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 14 }}
+            - name: PREFERENCES_DB_HOST
+              value: {{ ternary .Values.postgres.service.name2 .Values.global.postgres.service.name2 .Values.global.postgres.localCluster }}
+            - name: PREFERENCES_DB_PORT
+              value: {{ ternary .Values.postgres.service.externalPort2 .Values.global.postgres.service.externalPort2 .Values.global.postgres.localCluster | quote }}
+            - name: PREFERENCES_DB
+              value: {{ .Values.postgres.config.pgDatabase }}
           envFrom:
             - configMapRef:
                 name: {{ include "common.fullname" . }}-configmap
-            - secretRef:
-                name: {{ include "common.fullname" . }}-secret
           ports: {{ include "common.containerPorts" . | nindent 12  }}
           livenessProbe:
             httpGet:
index 90c67ee..ba5ef58 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 */}}
-apiVersion: v1
-kind: Secret
-metadata:
-  name: {{ include "common.fullname" . }}-secret
-  namespace: {{ include "common.namespace" . }}
-type: Opaque
-data:
-  {{- range $key, $val := .Values.secretEnv }}
-  {{ $key }}: {{ $val | b64enc | quote }}
-  {{- end -}}
\ No newline at end of file
+
+{{ include "common.secretFast" . }}
index 23f79ef..a008091 100644 (file)
@@ -4,6 +4,33 @@ global:
     KEYCLOAK_REALM: onap
     COLLECTOR_HOST: jaeger-collector.istio-config
     COLLECTOR_PORT: 9411
+  #Service Names of the postgres db to connect to.
+  postgres:
+    localCluster: false
+    service:
+      name: pgset
+      externalPort: 5432
+      name2: tcp-pgset-primary
+      externalPort2: 5432
+      name3: tcp-pgset-replica
+      externalPort3: 5432
+    container:
+      name: postgres
+
+secrets:
+  - uid: pg-root-pass
+    name: &pgRootPassSecretName '{{ include "common.release" . }}-portal-ng-preferences-pg-root-pass'
+    type: password
+    externalSecret: '{{ ternary "" (tpl (default "" .Values.postgres.config.pgRootPasswordExternalSecret) .) (hasSuffix "portal-ng-preferences-pg-root-pass" .Values.postgres.config.pgRootPasswordExternalSecret) }}'
+    password: '{{ .Values.postgres.config.pgRootpassword }}'
+    policy: generate
+  - uid: pg-user-creds
+    name: &pgUserCredsSecretName '{{ include "common.release" . }}-portal-ng-preferences-pg-user-creds'
+    type: basicAuth
+    externalSecret: '{{ ternary "" (tpl (default "" .Values.postgres.config.pgUserExternalSecret) .) (hasSuffix "portal-ng-preferences-pg-user-creds" .Values.postgres.config.pgUserExternalSecret) }}'
+    login: '{{ .Values.postgres.config.pgUserName }}'
+    password: '{{ .Values.postgres.config.pgUserPassword }}'
+    passwordPolicy: generate
 
 # Default values for preferences.
 # This is a YAML-formatted file.
@@ -63,35 +90,47 @@ probes:
     initialDelaySeconds: 30
     failureThreshold: 5
 
-secretEnv:
-  MONGO_USERNAME: dbuser
-  MONGO_PASSWORD: dbpassword
-  MONGO_DATABASE: Preferences
-
 env:
-  MONGO_HOST: preferences-mongodb
-  MONGO_PORT: 27017
   TRACING_ENABLED: true
 
-mongodb:
-  nameOverride: preferences-mongodb
+#################################################################
+# Postgres overriding defaults in the postgres
+#################################################################
+postgres:
+  nameOverride: &postgresName portal-ng-preferences-postgres
   service:
-    portName: tcp-mongodb
-  auth:
-    rootPassword: TrWAweN9y9eW
-    usernames:
-    - dbuser
-    passwords:
-    - dbpassword
-    databases:
-    - Preferences
-  resources:
-    limits:
-      cpu: "2"
-      memory: "2Gi"
-    requests:
-      cpu: "250m"
-      memory: "500Mi"
+    name: *postgresName
+    externalPort: 5432
+    name2: portal-ng-preferences-pg-primary
+    externalPort2: 5432
+    name3: portal-ng-preferences-pg-replica
+    externalPort3: 5432
+  container:
+    name:
+      primary: portal-ng-preferences-pg-primary
+      replica: portal-ng-preferences-pg-replica
+  persistence:
+    mountSubPath: portal-ng-preferences/data
+    mountInitPath: portal-ng-preferences
+  config:
+    pgUserName: portalngpreferences
+    pgDatabase: preferences
+    pgUserExternalSecret: *pgUserCredsSecretName
+    pgRootPasswordExternalSecret: *pgRootPassSecretName
+
+postgres-init:
+  nameOverride: portal-ng-preferences-postgres-init
+  config:
+    pgUserName: portalngpreferences
+    pgDatabase: preferences
+    pgDataPath: data
+    pgUserExternalSecret: *pgUserCredsSecretName
+  serviceAccount:
+    nameOverride: portal-ng-preferences-postgres-init
+
+    # pgPrimaryPassword: password
+    # pgUserPassword: password
+    # pgRootPassword: password
 
 #Pods Service Account
 serviceAccount: