Skip to content

Commit 387d218

Browse files
authored
Merge pull request #1838 from abhishek-1809/develop
Closes #1828 Volume mounting is not working if git local repo is selcted
2 parents eb577a3 + e6940df commit 387d218

7 files changed

Lines changed: 49 additions & 62 deletions

File tree

deploy/config-server/install.sh

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,36 @@ CHART_VERSION=0.0.2-develop
1111

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

14-
read -p "Do you want to enable config-server to pull configurations from local repository?(Y/n)( Default: n )" local_enabled
15-
if [[ -z $local_enabled ]]; then
16-
local_enabled=n
14+
echo "Please select the configuration source for config-server:"
15+
echo "1. Pull configurations from multiple remote repositories (Git)"
16+
echo "2. Pull configurations from local repository (NFS)"
17+
echo "3. Both (Remote Git and Local NFS)"
18+
read -p "Enter your choice (1/2/3) [Default: 1]: " repo_choice
19+
20+
if [[ -z $repo_choice ]]; then
21+
repo_choice=1
1722
fi
1823

19-
if [ "$local_enabled" = "Y" ]; then
20-
LOCALREPO="true"
21-
read -p "Provide the NFS path where the local repository is cloned/maintained: " path
22-
NFS_PATH="$path"
24+
case $repo_choice in
25+
1)
26+
SPRING_PROFILES="true"
27+
LOCALREPO="false"
28+
;;
29+
2)
30+
SPRING_PROFILES="false"
31+
LOCALREPO="true"
32+
;;
33+
3)
34+
SPRING_PROFILES="true"
35+
LOCALREPO="true"
36+
;;
37+
*)
38+
echo "Invalid choice. Defaulting to option 1."
39+
SPRING_PROFILES="true"
40+
LOCALREPO="false"
41+
;;
42+
esac
2343

24-
read -p "Provide the NFS IP address of the server where the local repository is cloned: " ip
25-
NFS_SERVER="$ip"
26-
else
27-
LOCALREPO="false"
28-
NFS_PATH=""
29-
NFS_SERVER=""
30-
fi
3144

3245
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
3346
if [ $yn = "Y" ]
@@ -56,9 +69,8 @@ if [ $yn = "Y" ]
5669

5770
echo "Installing config-server"
5871
helm -n $NS install config-server mosip/config-server \
72+
--set spring_profiles.enabled="$SPRING_PROFILES" \
5973
--set localRepo.enabled="$LOCALREPO" \
60-
--set volume.nfs.path="$NFS_PATH" \
61-
--set volume.nfs.server="$NFS_SERVER" \
6274
-f values.yaml \
6375
--timeout 10m \
6476
--wait --version $CHART_VERSION

deploy/config-server/values.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
spring_profiles:
22
enabled: true
3+
spring_profiles_active: "composite"
34
spring_compositeRepos:
45
# Based on the user requiremnt the number of multiple sources from where configuration needs to be pulled can be updated below as mentioned.
56
- type: git
@@ -39,16 +40,13 @@ volume:
3940
# existingClaim: your-claim
4041
## ReadWriteMany not supported by AWS gp2
4142
name: config-server
42-
storageClass: nfs-client
43+
storageClass: nfs-csi
4344
accessModes:
4445
- ReadWriteMany
4546
size: 10Mi
4647
existingClaim:
4748
# Dir where config and keys are written inside container
4849
mountDir: '/var/lib/config_repo'
49-
nfs:
50-
path: '' # Dir within the nfs server where config repo is cloned/maintained locally.
51-
server: '' # Ip address of nfs server.
5250

5351
## Extra environment variables to be passed to the config-server container
5452
## By default, these are enabled for development/testing. Set enabled: false in production if not needed.

helm/config-server/templates/config-pv.yaml

Lines changed: 0 additions & 21 deletions
This file was deleted.

helm/config-server/templates/config-pvc.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
{{- if .Values.spring_profiles.enabled }}
2-
{{- if or .Values.localRepo.enabled (include "config-server.hasNative" . | eq "true") }}
1+
{{- if .Values.localRepo.enabled }}
32
apiVersion: v1
43
kind: PersistentVolumeClaim
54
metadata:
@@ -14,8 +13,5 @@ spec:
1413
resources:
1514
requests:
1615
storage: {{ .Values.volume.size }}
17-
selector:
18-
matchLabels:
19-
name: {{ .Values.volume.name }}
16+
2017
{{- end }}
21-
{{- end }}

helm/config-server/templates/deployment.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ spec:
4141
env:
4242
- name: JDK_JAVA_OPTIONS
4343
value: {{ .Values.additionalResources.javaOpts }}
44+
{{- if and .Values.spring_profiles.enabled .Values.localRepo.enabled }}
45+
- name: SPRING_PROFILES_ACTIVE
46+
value: "{{ .Values.spring_profiles.spring_profiles_active }},{{ .Values.localRepo.spring_profiles_active }}"
47+
{{- else if .Values.spring_profiles.enabled }}
48+
- name: SPRING_PROFILES_ACTIVE
49+
value: {{ .Values.spring_profiles.spring_profiles_active | quote }}
50+
{{- else if .Values.localRepo.enabled }}
51+
- name: SPRING_PROFILES_ACTIVE
52+
value: {{ .Values.localRepo.spring_profiles_active | quote }}
53+
{{- end }}
4454
{{- if .Values.spring_profiles.enabled }}
4555
{{- range $index, $repo := .Values.spring_profiles.spring_compositeRepos }}
4656
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_URI
@@ -78,7 +88,7 @@ spec:
7888
valueFrom:
7989
secretKeyRef:
8090
name: {{ include "config-server.fullname" $ }}
81-
key: github-token-{{ $index }}
91+
key: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_PASSWORD
8292
{{- end }}
8393
{{- if $repo.username }}
8494
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_USERNAME
@@ -147,20 +157,16 @@ spec:
147157
{{- end }}
148158
resources:
149159
{{- toYaml .Values.resources | nindent 12 }}
150-
{{- if .Values.spring_profiles.enabled }}
151-
{{- if or .Values.localRepo.enabled (include "config-server.hasNative" . | eq "true") }}
160+
{{- if .Values.localRepo.enabled }}
152161
volumeMounts:
153162
- name: {{ .Values.volume.name }}
154163
mountPath: {{ .Values.volume.mountDir }}
155-
{{- end }}
156164
{{- end }}
157-
{{- if .Values.spring_profiles.enabled }}
158-
{{- if or .Values.localRepo.enabled (include "config-server.hasNative" . | eq "true") }}
165+
{{- if .Values.localRepo.enabled }}
159166
volumes:
160167
- name: {{ .Values.volume.name }}
161168
persistentVolumeClaim:
162169
claimName: {{ .Values.volume.name }}
163-
{{- end }}
164170
{{- end }}
165171
{{- with .Values.nodeSelector }}
166172
nodeSelector:

helm/config-server/templates/secret.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ type: Opaque
99
data:
1010
{{- range $index, $repo := .Values.spring_profiles.spring_compositeRepos }}
1111
{{- if $repo.token }}
12-
github-token-{{ $index }}: {{ $repo.token | quote }}
12+
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_PASSWORD: {{ $repo.token | b64enc | quote }}
1313
{{- else }}
14-
github-token-{{ $index }}: ""
14+
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_PASSWORD: ""
1515
{{- end }}
1616
{{- end }}

helm/config-server/values.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ tolerations: []
123123
affinity: {}
124124
spring_profiles:
125125
enabled: true
126+
spring_profiles_active: "composite"
126127
spring_compositeRepos:
127128
# Based on the user requiremnt the number of multiple sources from where configuration needs to be pulled can be updated below as mentioned.
128129
- type: git
@@ -160,18 +161,13 @@ volume:
160161
# existingClaim: your-claim
161162
## ReadWriteMany not supported by AWS gp2
162163
name: config-server
163-
storageClass: nfs-client
164+
storageClass: nfs-csi
164165
accessModes:
165166
- ReadWriteMany
166167
size: 10Mi
167168
existingClaim:
168169
# Dir where config and keys are written inside container
169170
mountDir: '/var/lib/config_repo'
170-
nfs:
171-
path: ''
172-
# Dir within the nfs server where config repo is cloned/maintained locally.
173-
server: ''
174-
# Ip address of nfs server.
175171
## Init containers parameters:
176172
## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section.
177173
##

0 commit comments

Comments
 (0)