From 3d542731ce43e665288f769989f60be45cabb49a Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Thu, 13 Jun 2019 13:57:25 -0400 Subject: [PATCH] Use application.properties from YAML in values Mount a config map as file /maven/application.properties instead of environment variable SPRING_APPLICATION_JSON. Signed-off-by: Lott, Christopher (cl778h) Change-Id: Ia8364355f9f6f04573640179ece67505cb586e3f --- .../helm/dashboard/Chart.yaml | 3 ++- .../templates/{configmap.yaml => appconfig.yaml} | 24 ++++++++----------- .../helm/dashboard/templates/deployment.yaml | 17 ++++++++------ .../helm/dashboard/templates/service.yaml | 3 ++- .../helm/dashboard/values.yaml | 27 ++++++++++++++-------- 5 files changed, 42 insertions(+), 32 deletions(-) rename ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/{configmap.yaml => appconfig.yaml} (71%) diff --git a/ric-aux/80-Auxiliary-Functions/helm/dashboard/Chart.yaml b/ric-aux/80-Auxiliary-Functions/helm/dashboard/Chart.yaml index f142b0ac..11d8096a 100644 --- a/ric-aux/80-Auxiliary-Functions/helm/dashboard/Chart.yaml +++ b/ric-aux/80-Auxiliary-Functions/helm/dashboard/Chart.yaml @@ -17,6 +17,7 @@ apiVersion: v1 appVersion: "1.0" -description: Helm chart for the RIC Dashboard web app +description: Helm Chart for RIC Dashboard name: dashboard version: 1.1.0 +icon: https://gerrit.o-ran-sc.org/r/gitweb?p=portal/ric-dashboard.git;a=blob;f=webapp-frontend/src/assets/at_t.png;h=3cced1d5ce4668fbf3b33064aaaa6920bc8130b6;hb=HEAD diff --git a/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/configmap.yaml b/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/appconfig.yaml similarity index 71% rename from ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/configmap.yaml rename to ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/appconfig.yaml index e10805ed..2930a155 100644 --- a/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/configmap.yaml +++ b/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/appconfig.yaml @@ -15,22 +15,18 @@ # limitations under the License. # ################################################################################ -# Provides configuration parameters which spring expects as a JSON string +# Defines a config map for mounting as file application.properties apiVersion: v1 kind: ConfigMap metadata: - name: dashboard-configmap + name: {{ include "dashboard.fullname" . }}-appconfig data: - springApplication.json: | - { - "a1med": { - "basepath": "http://0.1.2.3:45" - }, - "e2mgr": { - "basepath": "http://1.2.3.4:56" - }, - "xappmgr": { - "basepath": "http://2.3.4.5:67" - } - } + # this key becomes the filename when mounted + application.properties: | + # appconfig.yaml + server.port = {{ .Values.dashboard.server.port }} + a1med.url = {{ .Values.dashboard.properties.a1med.url }} + anrxapp.url = {{ .Values.dashboard.properties.anrxapp.url }} + e2mgr.url = {{ .Values.dashboard.properties.e2mgr.url }} + xappmgr.url = {{ .Values.dashboard.properties.xappmgr.url }} diff --git a/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/deployment.yaml b/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/deployment.yaml index f02ddec0..a4b311da 100644 --- a/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/deployment.yaml +++ b/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/deployment.yaml @@ -46,14 +46,13 @@ spec: imagePullPolicy: {{ include "common.pullPolicy" . }} ports: - name: http - containerPort: 8080 + containerPort: {{ .Values.dashboard.server.port }} protocol: TCP - env: - - name: SPRING_APPLICATION_JSON - valueFrom: - configMapKeyRef: - name: dashboard-configmap - key: springApplication.json + volumeMounts: + - name: application-config + mountPath: /maven/application.properties + subPath: application.properties + readOnly: true livenessProbe: httpGet: path: / @@ -62,3 +61,7 @@ spec: httpGet: path: / port: http + volumes: + - name: application-config + configMap: + name: {{ include "dashboard.fullname" . }}-appconfig diff --git a/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/service.yaml b/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/service.yaml index 5a1b93c4..08a48875 100644 --- a/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/service.yaml +++ b/ric-aux/80-Auxiliary-Functions/helm/dashboard/templates/service.yaml @@ -28,7 +28,8 @@ metadata: spec: type: {{ .Values.dashboard.service.type }} ports: - - port: {{ .Values.dashboard.service.port }} + - port: {{ .Values.dashboard.server.port }} + nodePort: {{ .Values.dashboard.service.port }} targetPort: http protocol: TCP selector: diff --git a/ric-aux/80-Auxiliary-Functions/helm/dashboard/values.yaml b/ric-aux/80-Auxiliary-Functions/helm/dashboard/values.yaml index 48da9304..eb946460 100644 --- a/ric-aux/80-Auxiliary-Functions/helm/dashboard/values.yaml +++ b/ric-aux/80-Auxiliary-Functions/helm/dashboard/values.yaml @@ -15,11 +15,8 @@ # limitations under the License. # ################################################################################ -# Default values for dashboard. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. +# Deployment values for dashboard. -replicaCount: 1 repository: "nexus3.o-ran-sc.org:10004" imagePullPolicy: IfNotPresent repositoryCred: docker-reg-cred @@ -27,10 +24,22 @@ repositoryCred: docker-reg-cred dashboard: image: name: ric-dash-be - tag: 1.0.0-SNAPSHOT - - + tag: 1.0.4 + replicaCount: 1 + server: + # Tomcat listens here + port: 8080 service: type: NodePort - port: 80 - + port: 30080 + name: dashboard-service + # config URLs must be specified at deployment + properties: + a1med: + url: http://values-yaml-default-A1-URL + anrxapp: + url: http://values-yaml-default-ANR-URL + e2mgr: + url: http://values-yaml-default-E2-URL + xappmgr: + url: http://values-yaml-default-MGR-URL -- 2.16.6