From f7c8ed2c4c46f3f5c8248f7167d619d445e7dde7 Mon Sep 17 00:00:00 2001 From: Lalith Kota Date: Thu, 19 Sep 2024 12:45:00 +0530 Subject: [PATCH] Mimoto Chart: Added config server as dependency Signed-off-by: Lalith Kota --- charts/mimoto/questions.yaml | 32 +-- charts/mimoto/templates/_helpers.tpl | 37 ++-- .../templates/config-server/deployment.yaml | 97 +++++++++ .../secret-git-config.yaml | 6 +- .../templates/config-server/service.yaml | 26 +++ .../templates/configmap-spring-config.yaml | 4 +- charts/mimoto/templates/deployment.yaml | 6 +- charts/mimoto/templates/virtualservice.yaml | 15 ++ charts/mimoto/values.yaml | 190 ++++++++++++++---- 9 files changed, 332 insertions(+), 81 deletions(-) create mode 100644 charts/mimoto/templates/config-server/deployment.yaml rename charts/mimoto/templates/{ => config-server}/secret-git-config.yaml (70%) create mode 100644 charts/mimoto/templates/config-server/service.yaml diff --git a/charts/mimoto/questions.yaml b/charts/mimoto/questions.yaml index 8ba3eaf..3a67ac0 100644 --- a/charts/mimoto/questions.yaml +++ b/charts/mimoto/questions.yaml @@ -9,39 +9,39 @@ questions: type: string label: Keycloak Base URL -- variable: springConfig.profile +- variable: global.esignetHostname type: string - label: Spring Config Profile + label: Esignet Hostname -- variable: springConfig.names - type: string - label: Spring Config Names - -- variable: springConfig.gitRepo.enabled - description: Enables download of configs from Git repo. +- variable: springCloudConfig.enabled + description: Enables Spring Cloud Config. type: boolean - label: Spring Config Git Enabled + label: Spring Cloud Config Enabled show_subquestions_if: true subquestions: - - variable: springConfig.gitRepo.repoUrl + - variable: springCloudConfig.profile + type: string + label: Spring Cloud Config Profile + + - variable: springCloudConfig.gitRepo.url description: |- Repo Url for remote Git repo containing configs. This url should include username password if required. type: string - label: Spring Config Git Repo Url + label: Spring Cloud Config Git Repo Url - - variable: springConfig.gitRepo.branch + - variable: springCloudConfig.gitRepo.branch description: Branch of remote Git repo containing configs. type: string - label: Spring Config Git Repo Branch + label: Spring Cloud Config Git Repo Branch -- variable: springConfig.rawConfig +- variable: rawSpringConfig description: |- - If git-based config is disabled, the complete application.properties can be + If Sspring Cloud Config is disabled, the complete application.properties can be directly supplied here. type: yamlfile label: Spring Config application properties. - show_if: "springConfig.gitRepo.enabled=false" + show_if: "springCloudConfig.enabled=false" - variable: oidcClientKeySecretName description: Name of the secret that contains the p12 file holding OIDC Client Keys diff --git a/charts/mimoto/templates/_helpers.tpl b/charts/mimoto/templates/_helpers.tpl index c355261..124203f 100644 --- a/charts/mimoto/templates/_helpers.tpl +++ b/charts/mimoto/templates/_helpers.tpl @@ -12,11 +12,18 @@ Return the proper image name (for the init container volume-permissions image) {{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} {{- end -}} +{{/* +Return the config server image name +*/}} +{{- define "mimoto.config-server.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.springCloudConfig.image "global" .Values.global) }} +{{- end -}} + {{/* Return the proper Docker Image Registry Secret Names */}} {{- define "mimoto.imagePullSecrets" -}} -{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.springCloudConfig.image .Values.volumePermissions.image) "global" .Values.global) -}} {{- end -}} {{/* @@ -30,21 +37,6 @@ Create the name of the service account to use {{- end -}} {{- end -}} -{{/* -Compile all warnings into a single message. -*/}} -{{- define "mimoto.validateValues" -}} -{{- $messages := list -}} -{{- $messages := append $messages (include "mimoto.validateValues.foo" .) -}} -{{- $messages := append $messages (include "mimoto.validateValues.bar" .) -}} -{{- $messages := without $messages "" -}} -{{- $message := join "\n" $messages -}} - -{{- if $message -}} -{{- printf "\nVALUES VALIDATION:\n%s" $message -}} -{{- end -}} -{{- end -}} - {{/* Return podAnnotations */}} @@ -75,7 +67,18 @@ Render Env values section {{- end -}} {{- define "mimoto.envVars" -}} -{{- $envVars := merge (deepCopy .Values.envVars) (deepCopy .Values.envVarsFrom) (.Values.springConfig.gitRepo.enabled | ternary (deepCopy .Values.springConfig.gitRepo.envVars) dict) -}} +{{- $envVars := merge (.Values.springCloudConfig.enabled | ternary (deepCopy .Values.springCloudConfigEnvVars) dict) (deepCopy .Values.coreEnvVars) (deepCopy .Values.coreEnvVarsFrom) (.Values.springCloudConfig.enabled | ternary dict (merge (deepCopy .Values.envVars) (deepCopy .Values.envVarsFrom))) -}} +{{- include "mimoto.baseEnvVars" (dict "envVars" $envVars "context" $) }} +{{- end -}} + +{{- define "mimoto.config-server.envVars" -}} +{{- $overridesEnvVars := dict -}} +{{- if .Values.springCloudConfig.enabled -}} +{{- range $k, $v := (merge (deepCopy .Values.envVars) (deepCopy .Values.envVarsFrom)) -}} +{{- $_ := set $overridesEnvVars (printf "spring_cloud_config_server_overrides_%s" $k) $v -}} +{{- end -}} +{{- end -}} +{{- $envVars := merge $overridesEnvVars (deepCopy .Values.springCloudConfig.envVars) (deepCopy .Values.springCloudConfig.envVarsFrom) -}} {{- include "mimoto.baseEnvVars" (dict "envVars" $envVars "context" $) }} {{- end -}} diff --git a/charts/mimoto/templates/config-server/deployment.yaml b/charts/mimoto/templates/config-server/deployment.yaml new file mode 100644 index 0000000..f0ca693 --- /dev/null +++ b/charts/mimoto/templates/config-server/deployment.yaml @@ -0,0 +1,97 @@ +{{- if .Values.springCloudConfig.enabled }} +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "common.names.fullname" . }}-config-server + labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.springCloudConfig.replicaCount }} + {{- if .Values.springCloudConfig.updateStrategy }} + strategy: {{- toYaml .Values.springCloudConfig.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" (dict "customLabels" .Values.springCloudConfig.podLabels "context" $) | nindent 6 }} + template: + metadata: + {{- if .Values.springCloudConfig.podAnnotations }} + annotations: {{- include "common.tplvalues.render" (dict "value" .Values.springCloudConfig.podAnnotations "context" $) | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" (dict "customLabels" .Values.springCloudConfig.podLabels "context" $) | nindent 8 }} + spec: + serviceAccountName: {{ template "mimoto.serviceAccountName" . }} + {{- include "mimoto.imagePullSecrets" . | nindent 6 }} + {{- if .Values.springCloudConfig.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.springCloudConfig.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.springCloudConfig.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.springCloudConfig.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.springCloudConfig.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.springCloudConfig.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.springCloudConfig.nodeAffinityPreset.type "key" .Values.springCloudConfig.nodeAffinityPreset.key "values" .Values.springCloudConfig.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.springCloudConfig.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.springCloudConfig.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.springCloudConfig.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.springCloudConfig.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.springCloudConfig.priorityClassName }} + priorityClassName: {{ .Values.springCloudConfig.priorityClassName | quote }} + {{- end }} + {{- if .Values.springCloudConfig.podSecurityContext.enabled }} + securityContext: {{- omit .Values.springCloudConfig.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + {{- if .Values.springCloudConfig.initContainers }} + initContainers: + {{- include "common.tplvalues.render" (dict "value" .Values.springCloudConfig.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: config-server + image: {{ template "mimoto.config-server.image" . }} + imagePullPolicy: {{ .Values.springCloudConfig.image.pullPolicy }} + {{- if .Values.springCloudConfig.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.springCloudConfig.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.springCloudConfig.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.springCloudConfig.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.springCloudConfig.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.springCloudConfig.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.springCloudConfig.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.springCloudConfig.args "context" $) | nindent 12 }} + {{- end }} + env: + {{- include "mimoto.config-server.envVars" . | nindent 12 }} + ports: + - name: http + containerPort: {{ .Values.springCloudConfig.containerPort }} + {{- if .Values.springCloudConfig.resources }} + resources: {{- toYaml .Values.springCloudConfig.resources | nindent 12 }} + {{- end }} + {{- if .Values.springCloudConfig.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.springCloudConfig.startupProbe "enabled") "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.springCloudConfig.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.springCloudConfig.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.springCloudConfig.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.springCloudConfig.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- end }} + volumeMounts: + {{- if .Values.springCloudConfig.extraVolumeMounts }} + {{- include "common.tplvalues.render" (dict "value" .Values.springCloudConfig.extraVolumeMounts "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.springCloudConfig.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.springCloudConfig.sidecars "context" $) | nindent 8 }} + {{- end }} + volumes: + {{- if .Values.springCloudConfig.extraVolumes }} + {{- include "common.tplvalues.render" (dict "value" .Values.springCloudConfig.extraVolumes "context" $) | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/mimoto/templates/secret-git-config.yaml b/charts/mimoto/templates/config-server/secret-git-config.yaml similarity index 70% rename from charts/mimoto/templates/secret-git-config.yaml rename to charts/mimoto/templates/config-server/secret-git-config.yaml index 0be0429..7bd6f8a 100644 --- a/charts/mimoto/templates/secret-git-config.yaml +++ b/charts/mimoto/templates/config-server/secret-git-config.yaml @@ -1,15 +1,15 @@ -{{- if .Values.springConfig.gitRepo.enabled }} +{{- if .Values.springCloudConfig.enabled }} apiVersion: v1 kind: Secret metadata: - name: {{ template "common.names.fullname" . }}-git-config-secret + name: {{ template "common.names.fullname" . }}-config-server-git-secret labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} type: Opaque data: - {{- range $k, $v := (omit .Values.springConfig.gitRepo "enabled" "envVars") }} + {{- range $k, $v := .Values.springCloudConfig.gitRepo }} {{ $k }}: {{ include "common.tplvalues.render" (dict "value" $v "context" $) | b64enc | quote }} {{- end }} {{- end }} diff --git a/charts/mimoto/templates/config-server/service.yaml b/charts/mimoto/templates/config-server/service.yaml new file mode 100644 index 0000000..9197a00 --- /dev/null +++ b/charts/mimoto/templates/config-server/service.yaml @@ -0,0 +1,26 @@ +{{- if .Values.springCloudConfig.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "common.names.fullname" . }}-config-server + labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.springCloudConfig.service.type }} + {{- if (or (eq .Values.springCloudConfig.service.type "LoadBalancer") (eq .Values.springCloudConfig.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.springCloudConfig.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.springCloudConfig.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.springCloudConfig.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.springCloudConfig.service.type "LoadBalancer") (not (empty .Values.springCloudConfig.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.springCloudConfig.service.loadBalancerIP }} + {{- end }} + ports: + - name: http + port: {{ .Values.springCloudConfig.service.port }} + targetPort: {{ .Values.springCloudConfig.containerPort }} + selector: {{- include "common.labels.matchLabels" (dict "customLabels" .Values.springCloudConfig.podLabels "context" $) | nindent 4 }} +{{- end }} diff --git a/charts/mimoto/templates/configmap-spring-config.yaml b/charts/mimoto/templates/configmap-spring-config.yaml index 9b1ae7f..4b5a9b1 100644 --- a/charts/mimoto/templates/configmap-spring-config.yaml +++ b/charts/mimoto/templates/configmap-spring-config.yaml @@ -1,4 +1,4 @@ -{{- if .Values.springConfig.rawConfig }} +{{- if .Values.rawSpringConfig }} apiVersion: v1 kind: ConfigMap metadata: @@ -9,5 +9,5 @@ metadata: {{- end }} data: application.properties: |- - {{- include "common.tplvalues.render" (dict "value" .Values.springConfig.rawConfig "context" $) | nindent 4 }} + {{- include "common.tplvalues.render" (dict "value" .Values.rawSpringConfig "context" $) | nindent 4 }} {{- end }} diff --git a/charts/mimoto/templates/deployment.yaml b/charts/mimoto/templates/deployment.yaml index 085c16f..5b14401 100644 --- a/charts/mimoto/templates/deployment.yaml +++ b/charts/mimoto/templates/deployment.yaml @@ -89,9 +89,9 @@ spec: mountPath: /startup.sh subPath: startup.sh {{- end }} - {{- if and .Values.springConfig.rawConfig (not .Values.springConfig.gitRepo.enabled) }} + {{- if and .Values.rawSpringConfig (not .Values.springCloudConfig.enabled) }} - name: spring-config - mountPath: {{ include "common.tplvalues.render" (dict "value" .Values.springConfig.rawConfigMountPath "context" $) }} + mountPath: {{ include "common.tplvalues.render" (dict "value" .Values.rawSpringConfigMountPath "context" $) }} subPath: application.properties {{- end }} - name: oidc-client-keys @@ -110,7 +110,7 @@ spec: name: {{ template "common.names.fullname" . }}-startup defaultMode: 0755 {{- end }} - {{- if and .Values.springConfig.rawConfig (not .Values.springConfig.gitRepo.enabled) }} + {{- if and .Values.rawSpringConfig (not .Values.springCloudConfig.enabled) }} - name: spring-config configMap: name: {{ template "common.names.fullname" . }}-spring-config diff --git a/charts/mimoto/templates/virtualservice.yaml b/charts/mimoto/templates/virtualservice.yaml index cc1ff3d..626776b 100644 --- a/charts/mimoto/templates/virtualservice.yaml +++ b/charts/mimoto/templates/virtualservice.yaml @@ -31,5 +31,20 @@ spec: host: {{ include "common.tplvalues.render" (dict "value" .Values.istio.virtualservice.destination "context" $) }} port: number: {{ include "common.tplvalues.render" (dict "value" .Values.istio.virtualservice.destinationPort "context" $) }} + {{- if .Values.istio.virtualservice.rewriteUri }} + - headers: + request: + set: + x-forwarded-host: {{ default .Values.hostname .Values.istio.virtualservice.host | quote }} + x-forwarded-proto: https + match: + - uri: + prefix: {{ include "common.tplvalues.render" (dict "value" .Values.istio.virtualservice.rewriteUri "context" $) }} + route: + - destination: + host: {{ include "common.tplvalues.render" (dict "value" .Values.istio.virtualservice.destination "context" $) }} + port: + number: {{ include "common.tplvalues.render" (dict "value" .Values.istio.virtualservice.destinationPort "context" $) }} + {{- end }} {{- end }} {{- end }} diff --git a/charts/mimoto/values.yaml b/charts/mimoto/values.yaml index f4bea46..b2a4d10 100644 --- a/charts/mimoto/values.yaml +++ b/charts/mimoto/values.yaml @@ -9,6 +9,7 @@ # storageClass: myStorageClass global: keycloakBaseUrl: 'https://keycloak.your.org' + esignetHostsname: esignet-pbms.openg2p.sandbox.net hostname: mimoto.openg2p.sandbox.net @@ -421,30 +422,43 @@ artifactory: oidcClientKeySecretName: mimoto-oidc-secret envVars: - JDK_JAVA_OPTIONS: '{{ tpl .Values.javaOpts $ }}' - SPRING_CONFIG_NAMES: '{{ tpl .Values.springConfig.names $ }}' - SPRING_CONFIG_PROFILE: '{{ tpl .Values.springConfig.profile $ }}' - SPRING_CONFIG_GIT_ENABLED: '{{ .Values.springConfig.gitRepo.enabled }}' - + # Env Vars from this section will be rendered on the service if springCloudConfig.enabled=false. + # Else they will be rendered on config-server as overrides. mosip_api_internal_host: '{{ tpl .Values.hostname $ }}' mosip_api_public_host: '{{ tpl .Values.hostname $ }}' mosip_resident_url: 'https://{{ tpl .Values.hostname $ }}' - mosip_esignet_host: 'esignet-pbms.openg2p.sandbox.net' + mosip_esignet_host: '{{ tpl .Values.global.esignetHostname $ }}' keycloak_internal_url: '{{ tpl .Values.global.keycloakBaseUrl $ }}' keycloak_external_url: '{{ tpl .Values.global.keycloakBaseUrl $ }}' + mosip_iam_adapter_disableSelfTokenRestTemplate: true + mosip_oidc_client_assertion_type: urn:ietf:params:oauth:client-assertion-type:jwt-bearer mosip_oidc_p12_filename: oidckeystore.p12 mosip_oidc_p12_password: openg2p123 mosip_oidc_p12_path: /home/mosip/certs/ - mimoto_wallet_binding_partner_api_key: "" + + mosip_partner_crypto_p12_password: "" + + mpartner_default_mobile_secret: "" mimoto_oidc_partner_clientid: mimoto-oidc mimoto_oidc_openg2p_partner_clientid: openg2p-mimoto-oidc + mimoto_wallet_binding_partner_api_key: "" + +# Env Vars from this section will be rendered on the service if springCloudConfig.enabled=false. +# Else they will be rendered on config-server as overrides. +envVarsFrom: {} -envVarsFrom: +coreEnvVars: + # Env Vars from this section will always be rendered on the service + JDK_JAVA_OPTIONS: '{{ tpl .Values.javaOpts $ }}' + spring_cloud_config_enabled_env: '{{ .Values.springCloudConfig.enabled }}' + +coreEnvVarsFrom: + # Env Vars from this section will always be rendered on the service artifactory_url_env: configMapKeyRef: name: '{{ tpl .Values.artifactoryInstallationName $ }}-share' @@ -458,24 +472,119 @@ envVarsFrom: name: '{{ tpl .Values.artifactoryInstallationName $ }}-share' key: zip_file_path -springConfig: - names: application,mimoto,inji +springCloudConfigEnvVars: + # Env Vars in this section will be rendered on the service, when springCloudConfig.enabled=true. + spring_cloud_config_label_env: + secretKeyRef: + name: '{{ template "common.names.fullname" . }}-config-server-git-secret' + key: branch + spring_cloud_config_uri_env: 'http://{{ template "common.names.fullname" . }}-config-server/config' + spring_profiles_active_env: '{{ tpl .Values.springCloudConfig.profile $ }}' + +springCloudConfig: + enabled: true + replicaCount: 1 + service: + type: ClusterIP + port: 80 + nodePorts: + http: "" + https: "" + externalTrafficPolicy: Cluster + image: + registry: docker.io + repository: mosipid/config-server + tag: 1.1.2 + pullPolicy: Always + pullSecrets: [] + containerPort: 51000 + startupProbe: + enabled: true + httpGet: + path: /config/*/{{ tpl .Values.springCloudConfig.profile $ }}/{{ tpl .Values.springCloudConfig.gitRepo.branch $ }} + port: http + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 60 + successThreshold: 1 + livenessProbe: + enabled: true + httpGet: + path: /config/*/{{ tpl .Values.springCloudConfig.profile $ }}/{{ tpl .Values.springCloudConfig.gitRepo.branch $ }} + port: http + initialDelaySeconds: 20 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + readinessProbe: + enabled: true + httpGet: + path: /config/*/{{ tpl .Values.springCloudConfig.profile $ }}/{{ tpl .Values.springCloudConfig.gitRepo.branch $ }} + port: http + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + command: [] + args: [] + hostAliases: [] + resources: {} + containerSecurityContext: + enabled: false + runAsUser: 1001 + runAsNonRoot: true + podSecurityContext: + enabled: false + fsGroup: 1001 + podAffinityPreset: "" + podAntiAffinityPreset: soft + nodeAffinityPreset: + type: "" + key: "" + values: [] + affinity: {} + nodeSelector: {} + tolerations: [] + podLabels: + app.kubernetes.io/name: '{{ include "common.names.name" . }}-config-server' + podAnnotations: {} + # priorityClassName: "" + lifecycleHooks: {} + updateStrategy: + type: RollingUpdate + initContainers: [] + sidecars: [] + volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + pullSecrets: [] + ## - myRegistryKeySecretName + resources: {} + extraVolumes: [] + extraVolumeMounts: [] + profile: default gitRepo: - enabled: true - repoUrl: https://github.com/openg2p/mosip-config + url: https://github.com/openg2p/mosip-config branch: master - envVars: - SPRING_CONFIG_GIT_REPO: - secretKeyRef: - name: '{{ template "common.names.fullname" . }}-git-config-secret' - key: repoUrl - SPRING_CONFIG_GIT_BRANCH: - secretKeyRef: - name: '{{ template "common.names.fullname" . }}-git-config-secret' - key: branch - rawConfigMountPath: '/home/mosip/springConfig/application-{{ tpl .Values.springConfig.profile $ }}.properties' - rawConfig: "" + envVars: + # Env Vars in these sections will be rendered on config server. + SPRING_CLOUD_CONFIG_SERVER_GIT_SEARCHPATHS: "" + envVarsFrom: + SPRING_CLOUD_CONFIG_SERVER_GIT_URI: + secretKeyRef: + name: '{{ template "common.names.fullname" . }}-config-server-git-secret' + key: url + +rawSpringConfigMountPath: '/home/mosip/springConfig/application.properties' +rawSpringConfig: "" startUpCommand: |- #!/usr/bin/env bash @@ -486,7 +595,6 @@ startUpCommand: |- exit 1 fi - ./configure_start.sh wget -q "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar ADDL_ARGS=() @@ -499,24 +607,26 @@ startUpCommand: |- ADDL_ARGS+=("-javaagent:glowroot/glowroot.jar -XX:HeapDumpPath=/home/") fi - if [ "$SPRING_CONFIG_GIT_ENABLED" = "true" ]; then - git clone --branch "${SPRING_CONFIG_GIT_BRANCH}" --depth 1 "${SPRING_CONFIG_GIT_REPO}" springConfig - fi - - config_locations="classpath:/bootstrap.properties," - IFS="," - for config_name in $SPRING_CONFIG_NAMES; do - conf_loc="springConfig/${config_name}${SPRING_CONFIG_PROFILE:+-$SPRING_CONFIG_PROFILE}.properties" - if [[ -f "$conf_loc" ]]; then - config_locations+="${conf_loc}," + if [ "$spring_cloud_config_enabled_env" = "true" ]; then + echo "Waiting for config server..." + if ! curl -I -s -o /dev/null -m 10 --retry 100 --retry-delay 10 --retry-all-errors "${spring_cloud_config_uri_env}/*/*"; then + echo "Connecting with artifactory failed after max retries..." + exit 1 + fi + ADDL_ARGS+=("-Dspring.cloud.config.label=${spring_cloud_config_label_env}") + ADDL_ARGS+=("-Dspring.cloud.config.uri=${spring_cloud_config_uri_env}") + ADDL_ARGS+=("-Dspring.profiles.active=${spring_profiles_active_env}") + ADDL_ARGS+=("-Dspring.cloud.config.enabled=true") + ADDL_ARGS+=("-Dspring.cloud.bootstrap.enabled=true") + else + if [ -f springConfig/application.properties ]; then + config_locations="classpath:/bootstrap.properties,springConfig/application.properties" + ADDL_ARGS+=("-Dspring.config.location=${config_locations}") fi - done - unset IFS - ADDL_ARGS+=("-Dspring.config.location=${config_locations::-1}") - ADDL_ARGS+=("-Dspring.profiles.active=${SPRING_CONFIG_PROFILE}") + ADDL_ARGS+=("-Dspring.cloud.config.enabled=false") + ADDL_ARGS+=("-Dspring.cloud.bootstrap.enabled=false") + fi - ADDL_ARGS+=("-Dspring.cloud.config.enabled=false") - ADDL_ARGS+=("-Dspring.cloud.bootstrap.enabled=false") ADDL_ARGS+=("-Dloader.path=${loader_path_env}") exec java -jar ${ADDL_ARGS[@]} ./mimoto.jar