Skip to content

Commit

Permalink
Merge pull request #100 from maheshopsmx/v4.1.2
Browse files Browse the repository at this point in the history
autoconfig for keycloak and sample app should run on upgrade - OP-19400
  • Loading branch information
saitejaopsmx authored Feb 16, 2023
2 parents e4c6d30 + 29e7641 commit 7cdceaf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions charts/isdargo/templates/keycloak/keycloak-autoconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Job
metadata:
annotations:
"helm.sh/hook": "post-install,post-upgrade"
"helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation"
"helm.sh/hook-delete-policy": "before-hook-creation"
name: keycloack-configure
spec:
template:
Expand Down Expand Up @@ -37,8 +37,16 @@ spec:
cd /tmp/keycloak-11.0.0/bin/
## Login
./kcadm.sh config credentials --server http://keycloack-http:80/auth --realm master --user $admuser --client admin-cli --password $admpass
##Check the Realme is created
chkrealm=$(./kcadm.sh get realms | jq -r '.[] | select(.realm == "'$realm'") | .realm')
if [ "$chkrealm" == "$realm" ];
then
echo "Realm with name $realm is already configured in keycloak"
break
else
echo "Creating realm..."
## Create a Realme
./kcadm.sh create realms -s realm="$realm" -s displayName="$realm" -s enabled=true -o
./kcadm.sh create realms -s realm="$realm" -s displayName="$realm" -s enabled=true -o > /dev/null
## Create Group and get ID
./kcadm.sh create groups -r $realm -b '{ "name": "'$group'" }'
groupid=$(./kcadm.sh get groups -r $realm | jq -r '.[] | select(.name=="'$group'") | .id' )
Expand Down Expand Up @@ -75,6 +83,7 @@ spec:
kubectl create secret generic oes-gate-config --from-file=/tmp/gate.yml -n {{ .Release.Namespace }}
kubectl delete po -l component=gate -n {{ .Release.Namespace }}
break
fi
else
if [ $wait_period -gt 2000 ];
then
Expand Down
2 changes: 1 addition & 1 deletion charts/isdargo/templates/sampleapps/app-of-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook": "post-install,post-upgrade"
"helm.sh/hook-delete-policy": "before-hook-creation"
"helm.sh/hook-weight": "13"
name: app-of-app
Expand Down
2 changes: 1 addition & 1 deletion charts/isdargo/templates/sampleapps/opsmxproj.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook": "post-install,post-upgrade"
"helm.sh/hook-weight": "8"
name: opsmxproj
spec:
Expand Down

0 comments on commit 7cdceaf

Please sign in to comment.