Skip to content

Commit

Permalink
Adding a multisite feature
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
  • Loading branch information
ahus1 committed Aug 8, 2024
1 parent d29de69 commit 3b1d326
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/actions/keycloak-create-deployment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ inputs:
enableExternalInfinispanFeature:
description: 'To enable the external Infinispan feature. It disables the embedded caches and only uses the remote caches.'
default: 'false'
enableMultiSiteFeature:
description: 'To enable the external Infinispan feature. It disables the embedded caches and only uses the remote caches.'
default: 'false'
image:
description: 'Keycloak Image'
podMemoryRequests:
Expand Down Expand Up @@ -57,6 +60,7 @@ runs:
KC_DISABLE_STICKY_SESSION: ${{ inputs.disableStickySessions }}
KC_KC25_MODE: ${{ inputs.enableKc25Mode }}
KC_EXTERNAL_INFINISPAN: ${{ inputs.enableExternalInfinispanFeature }}
KC_MULTI_SITE: ${{ inputs.enableMultiSiteFeature }}
KC_CONTAINER_IMAGE: ${{ inputs.image }}
KC_MEMORY_REQUESTS_MB: ${{ inputs.podMemoryRequests }}
KC_MEMORY_LIMITS_MB: ${{ inputs.podMemoryLimit }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
clusterPrefix: gh-keycloak # ${{ env.CLUSTER_PREFIX }} -- unfortunately 'env.' doesn't work here
activeActive: true
enableExternalInfinispanFeature: true
enableMultiSiteFeature: true
secrets: inherit

run-functional-tests-active-active-with-external-infinispan:
Expand Down Expand Up @@ -56,8 +57,9 @@ jobs:
uses: ./.github/workflows/rosa-multi-az-cluster-create.yml
with:
clusterPrefix: gh-keycloak # ${{ env.CLUSTER_PREFIX }} -- unfortunately 'env.' doesn't work here
enablePersistentSessions: true
enablePersistentSessionsFeature: true
enableExternalInfinispanFeature: true
enableMultiSiteFeature: true
createCluster: false
activeActive: true
secrets: inherit
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/rosa-multi-az-cluster-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ on:
description: 'When true deploy an Active/Active Keycloak deployment'
type: boolean
default: false
enablePersistentSessions:
enableKc25Mode:
description: 'Set to true when version older than 26 is deployed'
type: boolean
default: false
enablePersistentSessionsFeature:
description: 'To enable Persistent user and client sessions to the DB'
type: boolean
default: false
enableExternalInfinispanFeature:
description: 'To enable the external Infinispan feature. It disables the embedded caches and only uses the remote caches.'
type: boolean
default: false
default: true
enableMultiSiteFeature:
description: 'To enable the Multi Site Feature'
type: boolean
default: true
keycloakBranch:
description: 'The branch to deploy Keycloak from. If not set nightly image is used'
type: string
Expand All @@ -54,10 +62,18 @@ on:
description: 'Set to true when version older than 26 is deployed'
type: boolean
default: false
enablePersistentSessionsFeature:
description: 'To enable Persistent user and client sessions to the DB'
type: boolean
default: false
enableExternalInfinispanFeature:
description: 'To enable the external Infinispan feature. It disables the embedded caches and only uses the remote caches.'
type: boolean
default: false
default: true
enableMultiSiteFeature:
description: 'To enable the Multi Site Feature'
type: boolean
default: true
keycloakBranch:
description: 'The branch to deploy Keycloak from. If not set nightly image is used'
type: string
Expand All @@ -67,6 +83,7 @@ env:
REGION: ${{ inputs.region || vars.AWS_DEFAULT_REGION }}
KC_KC25_MODE: ${{ inputs.enableKc25Mode }}
KC_EXTERNAL_INFINISPAN: ${{ inputs.enableExternalInfinispanFeature }}
KC_MULTI_SITE: ${{ inputs.enableMultiSiteFeature }}

jobs:
# Workaround required for passing env variables to reusable workflow declarations as ${{ env.* }} is not available
Expand Down
1 change: 1 addition & 0 deletions provision/keycloak-tasks/Utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ tasks:
--set keycloakAdminPassword="{{.KC_ADMIN_PASSWORD}}"
--set disableIngressStickySession={{ .KC_DISABLE_STICKY_SESSION }}
--set externalInfinispan={{ .KC_EXTERNAL_INFINISPAN }}
--set multiSite={{ .KC_MULTI_SITE }}
--set nodePortsEnabled=false
../minikube/keycloak
preconditions:
Expand Down
2 changes: 2 additions & 0 deletions provision/minikube/keycloak/templates/keycloak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ spec:
{{ end }}
features:
enabled:
{{- if .Values.multiSite }}
- multi-site # <3>
{{- end }}
{{- if .Values.externalInfinispan }}
- remote-cache
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions provision/minikube/keycloak/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jvmDebug: true
predefinedAdmin: true
persistentSessions: false
externalInfinispan: false
multiSite: false
infinispan:
jgroupsTls: false
customConfig: false
Expand Down
1 change: 1 addition & 0 deletions provision/openshift/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ tasks:
--set keycloakAdminPassword="{{.KC_ADMIN_PASSWORD}}"
--set disableIngressStickySession={{ .KC_DISABLE_STICKY_SESSION }}
--set externalInfinispan={{ .KC_EXTERNAL_INFINISPAN }}
--set externalInfinispan={{ .KC_MULTI_SITE }}
--set nodePortsEnabled=false
../minikube/keycloak
- >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def handle_site_offline(labels):

acceleratorDNS = labels['accelerator']
accelerator = jmespath.search(f"Accelerators[?DnsName=='{acceleratorDNS}']", a_client.list_accelerators())
if not accelerator:
accelerator = jmespath.search(f"Accelerators[?DualStackDnsName=='{acceleratorDNS}']", a_client.list_accelerators())
if not accelerator:
print(f"Ignoring SiteOffline alert as accelerator with DnsName '{acceleratorDNS}' not found")
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static void waitForTheHealthCheckToBeInState(String healthCheckId, StateV
public static Accelerator getAccelerator(GlobalAcceleratorClient gaClient, String acceleratorDns) {
return gaClient.listAccelerators().accelerators()
.stream()
.filter(a -> acceleratorDns.contains(a.dnsName()))
.filter(a -> acceleratorDns.contains(a.dnsName()) || acceleratorDns.contains(a.dualStackDnsName()))
.findFirst()
.orElseThrow();
}
Expand Down

0 comments on commit 3b1d326

Please sign in to comment.