From 638545d54ada2e4735c74efa63c4e191a3b31f5c Mon Sep 17 00:00:00 2001 From: ckm007 Date: Thu, 4 Jun 2026 13:49:36 +0530 Subject: [PATCH] [MOSIP-44060, MOSIP-44106, DSD-9381, DSD-9092] Port release-1.3.x improvements to develop - Enhanced deploy/install.sh with pre-installation domain validation loop, PostgreSQL image settings, mosip helm repo for istio-addons, and expanded install flags for readability; keycloak image kept as mosipqa/mosip-artemis-keycloak:develop - Add deploy/istio-addons-values.yaml replacing local chart/istio-addons - Remove deploy/chart/istio-addons/ (local chart replaced by mosip/istio-addons helm repo chart) - Update README.md: fix badge workflow name (push-trigger.yml), restructure with Documentation and Contribution & Community sections Signed-off-by: ckm007 --- README.md | 12 +- deploy/chart/istio-addons/Chart.yaml | 24 ---- .../chart/istio-addons/templates/gateway.yaml | 14 --- .../templates/virtualservice.yaml | 38 ------ deploy/chart/istio-addons/values.yaml | 4 - deploy/install.sh | 115 +++++++++++++++++- deploy/istio-addons-values.yaml | 15 +++ 7 files changed, 137 insertions(+), 85 deletions(-) delete mode 100644 deploy/chart/istio-addons/Chart.yaml delete mode 100644 deploy/chart/istio-addons/templates/gateway.yaml delete mode 100644 deploy/chart/istio-addons/templates/virtualservice.yaml delete mode 100644 deploy/chart/istio-addons/values.yaml create mode 100644 deploy/istio-addons-values.yaml diff --git a/README.md b/README.md index 0078774c..81a986b4 100644 --- a/README.md +++ b/README.md @@ -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). \ No newline at end of file +This project is licensed under the terms of [Mozilla Public License 2.0](LICENSE). diff --git a/deploy/chart/istio-addons/Chart.yaml b/deploy/chart/istio-addons/Chart.yaml deleted file mode 100644 index fecceeae..00000000 --- a/deploy/chart/istio-addons/Chart.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v2 -name: istio-addons -description: A Helm chart for MOSIP Keycloak istio - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" diff --git a/deploy/chart/istio-addons/templates/gateway.yaml b/deploy/chart/istio-addons/templates/gateway.yaml deleted file mode 100644 index 2abffd14..00000000 --- a/deploy/chart/istio-addons/templates/gateway.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: networking.istio.io/v1alpha3 -kind: Gateway -metadata: - name: keycloak -spec: - selector: - istio: ingressgateway-internal - servers: - - port: - number: 80 - name: http - protocol: HTTP - hosts: - - {{ .Values.keycloakExternalHost }} diff --git a/deploy/chart/istio-addons/templates/virtualservice.yaml b/deploy/chart/istio-addons/templates/virtualservice.yaml deleted file mode 100644 index e0f9229a..00000000 --- a/deploy/chart/istio-addons/templates/virtualservice.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: networking.istio.io/v1alpha3 -kind: VirtualService -metadata: - name: keycloak -spec: - hosts: - - "*" - gateways: - - keycloak - - http: - {{- if eq .Values.service "oauth2-proxy" }} - - match: - - uri: - prefix: /oauth2 - route: - - destination: - host: oauth2-proxy.oauth2-proxy.svc.cluster.local - port: - number: 80 - headers: - request: - set: - x-forwarded-proto: https - {{- else if eq .Values.service "keycloak" }} - - match: - - uri: - prefix: / - route: - - destination: - host: {{ .Values.service }}.{{ .Release.Namespace }}.svc.cluster.local - port: - number: 80 - headers: - request: - set: - x-forwarded-proto: https - {{- end }} diff --git a/deploy/chart/istio-addons/values.yaml b/deploy/chart/istio-addons/values.yaml deleted file mode 100644 index 4c867399..00000000 --- a/deploy/chart/istio-addons/values.yaml +++ /dev/null @@ -1,4 +0,0 @@ -# Keycloak may be accessed in-cluster or from outside -keycloakInternalHost: keycloak.keycloak -keycloakExternalHost: iam.sandbox.xyz.net -service: keycloak diff --git a/deploy/install.sh b/deploy/install.sh index 1268c6ee..3e0242b1 100755 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -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 } diff --git a/deploy/istio-addons-values.yaml b/deploy/istio-addons-values.yaml new file mode 100644 index 00000000..ccd7eebf --- /dev/null +++ b/deploy/istio-addons-values.yaml @@ -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