Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoconfig for keycloak and sample app should run on upgrade - OP-19400 #100

Merged
merged 7 commits into from
Feb 16, 2023
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
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