From c18f8b5414740ac6b10d527f49180a70756f9cb9 Mon Sep 17 00:00:00 2001 From: syed salman <72004356+syedsalman3753@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:32:53 +0530 Subject: [PATCH] [DSD-3180] Added new env variable & restructured the deployment scripts (#297) Co-authored-by: syed-salman-technoforte --- helm/oidc-ui/install.sh | 13 +++++++------ helm/oidc-ui/templates/configmap.yaml | 25 +++++++++++++++++++++++-- helm/oidc-ui/templates/deployment.yaml | 2 +- helm/oidc-ui/values.yaml | 7 ++++++- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/helm/oidc-ui/install.sh b/helm/oidc-ui/install.sh index 568cbadca..2d45db073 100755 --- a/helm/oidc-ui/install.sh +++ b/helm/oidc-ui/install.sh @@ -24,12 +24,13 @@ function installing_oidc-ui() { ESIGNET_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-esignet-host}) - echo "Create configmaps oidc-ui-cm, delete if exists" - kubectl -n $NS delete --ignore-not-found=true configmap oidc-ui-cm - kubectl -n $NS create configmap oidc-ui-cm --from-literal="REACT_APP_API_BASE_URL=http://esignet.$NS/v1/esignet" --from-literal="REACT_APP_SBI_DOMAIN_URI=http://esignet.$NS" - echo Installing OIDC UI - helm -n $NS install oidc-ui mosip/oidc-ui --set istio.hosts\[0\]=$ESIGNET_HOST + helm -n $NS install oidc-ui mosip/oidc-ui \ + --set oidc_ui.configmaps.oidc-ui.REACT_APP_API_BASE_URL="http://esignet.$NS/v1/esignet" \ + --set oidc_ui.configmaps.oidc-ui.REACT_APP_SBI_DOMAIN_URI="http://esignet.$NS" \ + --set oidc_ui.configmaps.oidc-ui.OIDC_UI_PUBLIC_URL=''\ + --set istio.hosts\[0\]=$ESIGNET_HOST \ + --version $CHART_VERSION kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status @@ -43,4 +44,4 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true set -o nounset ## set -u : exit the script if you try to use an uninitialised variable set -o errtrace # trace ERR through 'time command' and other functions set -o pipefail # trace ERR through pipes -installing_oidc-ui # calling function \ No newline at end of file +installing_oidc-ui # calling function diff --git a/helm/oidc-ui/templates/configmap.yaml b/helm/oidc-ui/templates/configmap.yaml index 959cc2f6a..498561d90 100644 --- a/helm/oidc-ui/templates/configmap.yaml +++ b/helm/oidc-ui/templates/configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ template "common.names.fullname" . }} + name: {{ template "common.names.fullname" . }}-nginx-cm namespace: {{ .Release.Namespace }} labels: {{- include "common.labels.standard" . | nindent 4 }} {{- if .Values.commonLabels }} @@ -71,4 +71,25 @@ data: try_files $uri $uri/ /index.html; } } - } \ No newline at end of file + } +{{- if .Values.oidc_ui.configmaps }} + {{- range $cm_name, $cm_value := .Values.oidc_ui.configmaps }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $cm_name }} + namespace: {{ $.Release.Namespace }} + labels: {{- include "common.labels.standard" $ | nindent 8 }} + {{- if $.Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 8 }} + {{- end }} + {{- if $.Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 8 }} + {{- end }} +data: + {{- range $key, $value := $cm_value }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + {{- end }} \ No newline at end of file diff --git a/helm/oidc-ui/templates/deployment.yaml b/helm/oidc-ui/templates/deployment.yaml index 065748387..f5a9dc952 100644 --- a/helm/oidc-ui/templates/deployment.yaml +++ b/helm/oidc-ui/templates/deployment.yaml @@ -138,7 +138,7 @@ spec: volumes: - name: nginx-config configMap: - name: {{ template "common.names.fullname" . }} + name: {{ template "common.names.fullname" . }}-nginx-cm items: - key: nginx.conf path: nginx.conf \ No newline at end of file diff --git a/helm/oidc-ui/values.yaml b/helm/oidc-ui/values.yaml index cd4b92633..df46cc0d6 100755 --- a/helm/oidc-ui/values.yaml +++ b/helm/oidc-ui/values.yaml @@ -249,7 +249,7 @@ extraEnvVarsCM: - config-server-share - artifactory-share - softhsm-esignet-share - - oidc-ui-cm + - oidc-ui ## Secret with extra environment variables ## @@ -420,6 +420,11 @@ metrics: oidc_ui: oidc_ui_port: '3000' oidc_service_host: 'esignet.esignet' + configmaps: + oidc-ui: + REACT_APP_API_BASE_URL: 'http://esignet.esignet/v1/esignet' + REACT_APP_SBI_DOMAIN_URI: 'http://esignet.$NS' + OIDC_UI_PUBLIC_URL: '' ## OIDC UI swagger should have only internal access. Hence linked to internal gateway ## We create a gateway for esignet specific URL(s) listed under `hosts`