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
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
[![Maven Package upon a push](https://github.com/mosip/keycloak/actions/workflows/push_trigger.yml/badge.svg?branch=develop)](https://github.com/mosip/keycloak/actions/workflows/push_trigger.yml)

# Keycloak

[![Maven Package upon a push](https://github.com/mosip/keycloak/actions/workflows/push-trigger.yml/badge.svg?branch=develop)](https://github.com/mosip/keycloak/actions/workflows/push-trigger.yml)

## Overview
Contains MOSIP customised keycloak image for IAM.

## Documentation
To know more about Keycloack, refer [here](https://docs.mosip.io/1.2.0/modules/keycloak).

## Contribution & Community
- To learn how you can contribute code to this application, [click here](https://docs.mosip.io/1.2.0/community/code-contributions).
- If you have questions or encounter issues, visit the [MOSIP Community](https://community.mosip.io/) for support.
- For any GitHub issues: [Report here](https://github.com/mosip/keycloak/issues)

## License
This project is licensed under the terms of [Mozilla Public License 2.0](LICENSE).
This project is licensed under the terms of [Mozilla Public License 2.0](LICENSE).
24 changes: 0 additions & 24 deletions deploy/chart/istio-addons/Chart.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions deploy/chart/istio-addons/templates/gateway.yaml

This file was deleted.

38 changes: 0 additions & 38 deletions deploy/chart/istio-addons/templates/virtualservice.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions deploy/chart/istio-addons/values.yaml

This file was deleted.

115 changes: 113 additions & 2 deletions deploy/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,134 @@ if [ $# -ge 1 ]; then
fi
NS=keycloak
SERVICE_NAME=keycloak
ISTIO_ADDONS_CHART_VERSION=1.0.0

echo Creating $NS namespace
kubectl create ns $NS

# Check if user has updated istio-addons-values.yaml with correct host
echo "=============================================="
echo "Pre-installation validation"
echo "=============================================="
echo ""
echo "Before proceeding with the installation, please ensure you have updated"
echo "the 'istio-addons-values.yaml' file with the correct host configuration."
echo ""
echo "Current host configuration:"
current_host=$(grep -A1 "host:" istio-addons-values.yaml | grep -v "serviceHost" | head -1 | cut -d: -f2 | tr -d ' ')
echo "Host: $current_host"
echo ""

while true; do
if [[ "$current_host" == "iam.sandbox.xyz.net" ]]; then
echo "⚠️ WARNING: You are using the default placeholder host 'iam.sandbox.xyz.net'"
echo " This needs to be updated with your actual domain name."
echo ""
echo "Options:"
echo "1. Update the host configuration now"
echo "2. I have already updated it manually"
echo "3. Exit to update manually"
echo ""
echo "Enter your choice (1/2/3):"
read -r choice

case "$choice" in
1)
echo ""
echo "Enter your domain name for IAM (e.g., iam.yourdomain.com):"
read -r new_host
if [[ -n "$new_host" && "$new_host" != "iam.sandbox.xyz.net" ]]; then
# Update the host in the YAML file
sed -i "s/host: $current_host/host: $new_host/" istio-addons-values.yaml

echo "Host updated to: $new_host"
echo ""
break
else
echo "Invalid domain name. Please provide a valid domain."

echo ""
continue
fi
;;
2)
# Re-read the current host to verify
current_host=$(grep -A1 "host:" istio-addons-values.yaml | grep -v "serviceHost" | head -1 | cut -d: -f2 | tr -d ' ')
if [[ "$current_host" == "iam.sandbox.xyz.net" ]]; then

echo "The configuration still shows the default host. Please update it first."
echo ""
continue
else
echo "Configuration verified. Current host: $current_host"
echo ""
break
fi
;;
3)

echo "Installation cancelled."

echo "Please update the 'istio-addons-values.yaml' file with the correct host configuration and run the script again."
echo "Edit the file and change the host value from 'iam.sandbox.xyz.net' to your actual domain."
exit 1
;;
*)

echo "Invalid choice. Please enter 1, 2, or 3."

echo ""
;;
esac
else
echo "Host configuration appears to be updated: $current_host"
echo ""
echo "Do you want to proceed with this configuration? (yes/no):"
read -r user_response

case "$user_response" in
[Yy]|[Yy][Ee][Ss])
echo "Continuing with installation..."
echo ""
break
;;
[Nn]|[Nn][Oo])

echo "Installation cancelled."

echo "Please update the 'istio-addons-values.yaml' file with the correct host configuration and run the script again."
exit 1
;;
*)

echo "Invalid response. Please enter 'yes' or 'no'."

echo ""
;;
esac
fi
done

function installing_keycloak() {
echo Istio label
## TODO: enable istio injection after testing well.
kubectl label ns $NS istio-injection=disabled --overwrite
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add mosip https://mosip.github.io/mosip-helm
helm repo update

echo Installing
helm -n $NS install $SERVICE_NAME mosip/keycloak --version "7.1.18" --set image.repository=mosipqa/mosip-artemis-keycloak --set image.tag=develop --set image.pullPolicy=Always -f values.yaml --wait
helm -n $NS install $SERVICE_NAME mosip/keycloak --version "7.1.18" \
--set image.repository=mosipqa/mosip-artemis-keycloak \
--set image.tag=develop \
--set image.pullPolicy=Always \
--set postgresql.image.repository="mosipid/postgresql" \
--set postgresql.image.tag="14.2.0-debian-10-r70" \
-f values.yaml --wait

EXTERNAL_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-iam-external-host})
echo Install Istio gateway, virtual service
helm -n $NS install istio-addons chart/istio-addons --set keycloakExternalHost=$EXTERNAL_HOST --set keycloakInternalHost="$SERVICE_NAME.$NS" --set service=$SERVICE_NAME
helm -n $NS install istio-addons mosip/istio-addons --version $ISTIO_ADDONS_CHART_VERSION -f istio-addons-values.yaml
return 0
}

Expand Down
15 changes: 15 additions & 0 deletions deploy/istio-addons-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
istio:
name: keycloak
host: iam.sandbox.xyz.net
# Note: If you have multiple ingressController then pass it in the form of list.
ingressController: ingressgateway-internal
# Note : By default, if you do **not** specify any gateways, the chart will bind to a single Gateway whose name is derived from the metadata name. If you have mutiple gateways to specify then pass it in the form of list like below.
# gateways:
# - public-gateway
# - internal-gateway
port:
name: http
number: 80
protocol: HTTP
serviceHost: keycloak
servicePort: 80
Loading