Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions deploy/config-server/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,36 @@ CHART_VERSION=0.0.2-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
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

if [[ -z $repo_choice ]]; then
repo_choice=1
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"
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

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=""
fi

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" ]
Expand Down Expand Up @@ -56,9 +69,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.

8 changes: 2 additions & 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,5 @@ spec:
resources:
requests:
storage: {{ .Values.volume.size }}
selector:
matchLabels:
name: {{ .Values.volume.name }}

{{- end }}
{{- end }}
20 changes: 13 additions & 7 deletions helm/config-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ spec:
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.spring_profiles.enabled }}
{{- range $index, $repo := .Values.spring_profiles.spring_compositeRepos }}
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_URI
Expand Down Expand Up @@ -78,7 +88,7 @@ spec:
valueFrom:
secretKeyRef:
name: {{ include "config-server.fullname" $ }}
key: github-token-{{ $index }}
key: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_PASSWORD
{{- end }}
{{- if $repo.username }}
- name: SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_USERNAME
Expand Down Expand Up @@ -147,20 +157,16 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.spring_profiles.enabled }}
{{- if or .Values.localRepo.enabled (include "config-server.hasNative" . | eq "true") }}
{{- if .Values.localRepo.enabled }}
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") }}
{{- if .Values.localRepo.enabled }}
volumes:
- name: {{ .Values.volume.name }}
persistentVolumeClaim:
claimName: {{ .Values.volume.name }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
Expand Down
4 changes: 2 additions & 2 deletions helm/config-server/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type: Opaque
data:
{{- range $index, $repo := .Values.spring_profiles.spring_compositeRepos }}
{{- if $repo.token }}
github-token-{{ $index }}: {{ $repo.token | quote }}
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_PASSWORD: {{ $repo.token | b64enc | quote }}
{{- else }}
github-token-{{ $index }}: ""
SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_{{ $index }}_PASSWORD: ""
{{- end }}
{{- end }}
8 changes: 2 additions & 6 deletions helm/config-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ tolerations: []
affinity: {}
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 @@ -160,18 +161,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.
## Init containers parameters:
## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section.
##
Expand Down
Loading