Skip to content
45 changes: 28 additions & 17 deletions deploy/config-server/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,36 @@ CHART_VERSION=1.3.1-develop

read -p "Is conf-secrets module installed?(Y/n) " conf_installed

read -p "Do you want to enable config-server to pull configurations from local repository?(Y/n)( Default: n )" local_enabled
if [[ -z $local_enabled ]]; then
local_enabled=n
fi

if [ "$local_enabled" = "Y" ]; then
LOCALREPO="true"
read -p "Provide the NFS path where the local repository is cloned/maintained: " path
NFS_PATH="$path"
echo "Please select the configuration source for config-server:"
echo "1. Pull configurations from multiple remote repositories (Git)"
echo "2. Pull configurations from local repository (NFS)"
echo "3. Both (Remote Git and Local NFS)"
read -p "Enter your choice (1/2/3) [Default: 1]: " repo_choice

read -p "Provide the NFS IP address of the server where the local repository is cloned: " ip
NFS_SERVER="$ip"
else
LOCALREPO="false"
NFS_PATH=""
NFS_SERVER=""
if [[ -z $repo_choice ]]; then
repo_choice=1
fi

case $repo_choice in
1)
SPRING_PROFILES="true"
LOCALREPO="false"
;;
2)
SPRING_PROFILES="false"
LOCALREPO="true"
;;
3)
SPRING_PROFILES="true"
LOCALREPO="true"
;;
*)
echo "Invalid choice. Defaulting to option 1."
SPRING_PROFILES="true"
LOCALREPO="false"
;;
esac

if [ $conf_installed = "Y" ]; then read -p "Is values.yaml for config-server chart set correctly as part of Pre-requisites?(Y/n) " yn; fi
if [ $yn = "Y" ]
then
Expand Down Expand Up @@ -56,9 +68,8 @@ if [ $yn = "Y" ]

echo "Installing config-server"
helm -n $NS install config-server mosip/config-server \
--set spring_profiles.enabled="$SPRING_PROFILES" \
--set localRepo.enabled="$LOCALREPO" \
--set volume.nfs.path="$NFS_PATH" \
--set volume.nfs.server="$NFS_SERVER" \
-f values.yaml \
--timeout 10m \
--wait --version $CHART_VERSION
Expand Down
6 changes: 2 additions & 4 deletions deploy/config-server/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
spring_profiles:
enabled: true
spring_profiles_active: "composite"
spring_compositeRepos:
# Based on the user requiremnt the number of multiple sources from where configuration needs to be pulled can be updated below as mentioned.
- type: git
Expand Down Expand Up @@ -39,16 +40,13 @@ volume:
# existingClaim: your-claim
## ReadWriteMany not supported by AWS gp2
name: config-server
storageClass: nfs-client
storageClass: nfs-csi
accessModes:
- ReadWriteMany
size: 10Mi
existingClaim:
# Dir where config and keys are written inside container
mountDir: '/var/lib/config_repo'
nfs:
path: '' # Dir within the nfs server where config repo is cloned/maintained locally.
server: '' # Ip address of nfs server.

## Extra environment variables to be passed to the config-server container
## By default, these are enabled for development/testing. Set enabled: false in production if not needed.
Expand Down
21 changes: 0 additions & 21 deletions helm/config-server/templates/config-pv.yaml

This file was deleted.

7 changes: 1 addition & 6 deletions helm/config-server/templates/config-pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{- if .Values.spring_profiles.enabled }}
{{- if or .Values.localRepo.enabled (include "config-server.hasNative" . | eq "true") }}
{{- if .Values.localRepo.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -14,8 +13,4 @@ spec:
resources:
requests:
storage: {{ .Values.volume.size }}
selector:
matchLabels:
name: {{ .Values.volume.name }}
{{- end }}
{{- end }}
8 changes: 7 additions & 1 deletion helm/config-server/templates/configmap-env-vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ metadata:
data:
{{- if .Values.spring_profiles.enabled }}
{{- range $index, $repo := .Values.spring_profiles.spring_compositeRepos }}
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_URI: "{{ $repo.uri }}"
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_URI: {{ $repo.uri | quote }}
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_TYPE: {{ $repo.type | quote }}
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_DEFAULT_LABEL: {{ $repo.version | quote }}
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_SEARCHPATHS: {{ $repo.searchFolders | default "" | quote }}
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_CLONE_ON_START: {{ $repo.spring_cloud_config_server_git_cloneOnStart | quote }}
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_FORCE_PULL: {{ $repo.spring_cloud_config_server_git_force_pull | quote }}
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_REFRESH_RATE: {{ $repo.spring_cloud_config_server_git_refreshRate | quote }}
{{- if $repo.username }}
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_USERNAME: {{ $repo.username | quote }}
{{- end }}
{{- end }}
SPRING_CLOUD_CONFIG_SERVER_FAILONCOMPOSITEERROR: {{ .Values.spring_profiles.spring_fail_on_composite_error | quote }}
{{- else if .Values.localRepo.enabled }}
SPRING_CLOUD_CONFIG_SERVER_GIT_URI: {{ .Values.volume.mountDir | quote }}
{{- end }}
225 changes: 101 additions & 124 deletions helm/config-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,138 +30,115 @@ spec:
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
env:
- name: JDK_JAVA_OPTIONS
value: {{ .Values.additionalResources.javaOpts }}
{{- if .Values.spring_profiles.enabled }}
{{- range $index, $repo := .Values.spring_profiles.spring_compositeRepos }}
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_URI
value: "{{ $repo.uri }}"
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_TYPE
value: "{{ $repo.type }}"
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_DEFAULT_LABEL
value: "{{ $repo.version }}"
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_CLONE_ON_START
value: "{{ $repo.spring_cloud_config_server_git_cloneOnStart }}"
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_FORCE_PULL
value: "{{ $repo.spring_cloud_config_server_git_force_pull }}"
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_REFRESH_RATE
value: "{{ $repo.spring_cloud_config_server_git_refreshRate }}"
{{- end }}
- name: SPRING_CLOUD_CONFIG_SERVER_FAILONCOMPOSITEERROR
value: "{{ .Values.spring_profiles.spring_fail_on_composite_error }}"
{{- end }}
{{- if .Values.localRepo.enabled }}
- name: spring_cloud_config_server_native_search-locations
value: {{ .Values.localRepo.spring_cloud_config_server_native_search_locations | quote }}
- name: spring_cloud_config_server_accept-empty
value: {{ .Values.localRepo.spring_cloud_config_server_accept_empty | quote }}
- name: spring_cloud_config_server_git_force-pull
value: {{ .Values.localRepo.spring_cloud_config_server_git_force_pull | quote }}
- name: spring_cloud_config_server_git_refreshRate
value: {{ .Values.localRepo.spring_cloud_config_server_git_refreshRate | quote }}
- name: spring_cloud_config_server_git_cloneOnStart
value: {{ .Values.localRepo.spring_cloud_config_server_git_cloneOnStart | quote }}
{{- end }}
{{- if .Values.spring_profiles.enabled }}
{{- range $index, $repo := .Values.spring_profiles.spring_compositeRepos }}
{{- if $repo.token }}
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "config-server.fullname" $ }}
key: github-token-{{ $index }}
{{- end }}
{{- if $repo.username }}
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_USERNAME
value: {{ $repo.username | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- range .Values.envVariables }}
{{- if .enabled }}
- name: {{ .name }}
valueFrom:
{{- if .valueFrom.configMapKeyRef }}
configMapKeyRef:
name: {{ .valueFrom.configMapKeyRef.name }}
key: {{ .valueFrom.configMapKeyRef.key }}
{{- else if .valueFrom.secretKeyRef }}
secretKeyRef:
name: {{ .valueFrom.secretKeyRef.name }}
key: {{ .valueFrom.secretKeyRef.key }}
{{- end }}
{{- end }}
{{- end }}

{{- if .Values.extraEnvVars }}
{{- range .Values.extraEnvVars }}
{{- if .enabled }}
- name: {{ .name }}
{{- if .valueFrom }}
valueFrom:
{{- if .valueFrom.configMapKeyRef }}
configMapKeyRef:
name: {{ .valueFrom.configMapKeyRef.name }}
key: {{ .valueFrom.configMapKeyRef.key }}
{{- else if .valueFrom.secretKeyRef }}
secretKeyRef:
name: {{ .valueFrom.secretKeyRef.name }}
key: {{ .valueFrom.secretKeyRef.key }}
{{- end }}
{{- else }}
value: {{ .value | quote }}
{{- end }}
{{- end }}
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
env:
- name: JDK_JAVA_OPTIONS
value: {{ .Values.additionalResources.javaOpts }}
{{- if and .Values.spring_profiles.enabled .Values.localRepo.enabled }}
- name: SPRING_PROFILES_ACTIVE
value: "{{ .Values.spring_profiles.spring_profiles_active }},{{ .Values.localRepo.spring_profiles_active }}"
{{- else if .Values.spring_profiles.enabled }}
- name: SPRING_PROFILES_ACTIVE
value: {{ .Values.spring_profiles.spring_profiles_active | quote }}
{{- else if .Values.localRepo.enabled }}
- name: SPRING_PROFILES_ACTIVE
value: {{ .Values.localRepo.spring_profiles_active | quote }}
{{- end }}
{{- if .Values.localRepo.enabled }}
- name: spring_cloud_config_server_native_search-locations
value: {{ .Values.localRepo.spring_cloud_config_server_native_search_locations | quote }}
- name: spring_cloud_config_server_accept-empty
value: {{ .Values.localRepo.spring_cloud_config_server_accept_empty | quote }}
- name: spring_cloud_config_server_git_force-pull
value: {{ .Values.localRepo.spring_cloud_config_server_git_force_pull | quote }}
- name: spring_cloud_config_server_git_refreshRate
value: {{ .Values.localRepo.spring_cloud_config_server_git_refreshRate | quote }}
- name: spring_cloud_config_server_git_cloneOnStart
value: {{ .Values.localRepo.spring_cloud_config_server_git_cloneOnStart | quote }}
{{- end }}
{{- range .Values.envVariables }}
{{- if .enabled }}
- name: {{ .name }}
valueFrom:
{{- if .valueFrom.configMapKeyRef }}
configMapKeyRef:
name: {{ .valueFrom.configMapKeyRef.name }}
key: {{ .valueFrom.configMapKeyRef.key }}
{{- else if .valueFrom.secretKeyRef }}
secretKeyRef:
name: {{ .valueFrom.secretKeyRef.name }}
key: {{ .valueFrom.secretKeyRef.key }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.extraEnvVars }}
{{- range .Values.extraEnvVars }}
{{- if .enabled }}
- name: {{ .name }}
{{- if .valueFrom }}
valueFrom:
{{- if .valueFrom.configMapKeyRef }}
configMapKeyRef:
name: {{ .valueFrom.configMapKeyRef.name }}
key: {{ .valueFrom.configMapKeyRef.key }}
{{- else if .valueFrom.secretKeyRef }}
secretKeyRef:
name: {{ .valueFrom.secretKeyRef.name }}
key: {{ .valueFrom.secretKeyRef.key }}
{{- end }}
envFrom:
- configMapRef:
name: {{ printf "%s-env-vars" (include "config-server.fullname" .) }}
ports:
- name: http
containerPort: {{ .Values.springServicePort }}
protocol: TCP
{{- if .Values.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }}
{{- else if .Values.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }}
{{- else if .Values.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }}
{{- else if .Values.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
{{- else }}
value: {{ .value | quote }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.spring_profiles.enabled }}
{{- if or .Values.localRepo.enabled (include "config-server.hasNative" . | eq "true") }}
volumeMounts:
- name: {{ .Values.volume.name }}
mountPath: {{ .Values.volume.mountDir }}
{{- end }}
{{- end }}
{{- if .Values.spring_profiles.enabled }}
{{- if or .Values.localRepo.enabled (include "config-server.hasNative" . | eq "true") }}
{{- end }}
{{- end }}
envFrom:
- configMapRef:
name: {{ printf "%s-env-vars" (include "config-server.fullname" .) }}
{{- if .Values.spring_profiles.enabled }}
- secretRef:
name: {{ include "config-server.fullname" . }}
optional: true
{{- end }}
ports:
- name: http
containerPort: {{ .Values.springServicePort }}
protocol: TCP
{{- if .Values.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }}
{{- else if .Values.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }}
{{- else if .Values.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }}
{{- else if .Values.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.localRepo.enabled }}
volumeMounts:
- name: {{ .Values.volume.name }}
mountPath: {{ .Values.volume.mountDir }}
{{- end }}
{{- if .Values.localRepo.enabled }}
volumes:
- name: {{ .Values.volume.name }}
persistentVolumeClaim:
claimName: {{ .Values.volume.name }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
Loading
Loading