diff --git a/provision/infinispan/create_ispn_clusters.sh b/provision/infinispan/create_ispn_clusters.sh index d85182924..8b6497851 100755 --- a/provision/infinispan/create_ispn_clusters.sh +++ b/provision/infinispan/create_ispn_clusters.sh @@ -148,6 +148,7 @@ spec: locations: - name: ${remote_site} url: ${api_url} + namespace: ${remote_namespace} secretName: ${XSITE_TOKEN_SECRET} EOF } @@ -181,7 +182,7 @@ spec: EOF } -function deploy_cache_cr() { +function deploy_distributed_cache_cr() { local kubecfg="${1}" local namespace="${2}" local cache_name="${3}" @@ -214,6 +215,38 @@ spec: EOF } +function deploy_replicated_cache_cr() { + local kubecfg="${1}" + local namespace="${2}" + local cache_name="${3}" + local remote_site="${4}" + local xsite_mode="${5}" + local cr_name=$(echo "${cache_name}" | awk '{print tolower($0)}') + + KUBECONFIG="${kubecfg}" oc apply -f - << EOF +apiVersion: infinispan.org/v2alpha1 +kind: Cache +metadata: + name: ${cr_name} + namespace: ${namespace} +spec: + clusterName: infinispan + name: ${cache_name} + template: |- + replicatedCache: + mode: "SYNC" + statistics: "true" + stateTransfer: + chunkSize: 16 + backups: + ${remote_site}: + backup: + strategy: ${xsite_mode} + stateTransfer: + chunkSize: 16 +EOF +} + function deploy_cache_cr_without_cross_site() { local kubecfg="${1}" local namespace="${2}" @@ -243,14 +276,14 @@ function deploy_all_caches() { local kubecfg="${1}" local namespace="${2}" local remote_site="${3}" - deploy_cache_cr "${kubecfg}" "${namespace}" "sessions" "${remote_site}" "${XSITE_MODE}" - deploy_cache_cr "${kubecfg}" "${namespace}" "actionTokens" "${remote_site}" "${XSITE_MODE}" - deploy_cache_cr "${kubecfg}" "${namespace}" "authenticationSessions" "${remote_site}" "${XSITE_MODE}" - deploy_cache_cr "${kubecfg}" "${namespace}" "offlineSessions" "${remote_site}" "${XSITE_MODE}" - deploy_cache_cr "${kubecfg}" "${namespace}" "clientSessions" "${remote_site}" "${XSITE_MODE}" - deploy_cache_cr "${kubecfg}" "${namespace}" "offlineClientSessions" "${remote_site}" "${XSITE_MODE}" - deploy_cache_cr "${kubecfg}" "${namespace}" "loginFailures" "${remote_site}" "${XSITE_MODE}" - deploy_cache_cr "${kubecfg}" "${namespace}" "work" "${remote_site}" "${XSITE_MODE}" + deploy_distributed_cache_cr "${kubecfg}" "${namespace}" "sessions" "${remote_site}" "${XSITE_MODE}" + deploy_distributed_cache_cr "${kubecfg}" "${namespace}" "actionTokens" "${remote_site}" "${XSITE_MODE}" + deploy_distributed_cache_cr "${kubecfg}" "${namespace}" "authenticationSessions" "${remote_site}" "${XSITE_MODE}" + deploy_distributed_cache_cr "${kubecfg}" "${namespace}" "offlineSessions" "${remote_site}" "${XSITE_MODE}" + deploy_distributed_cache_cr "${kubecfg}" "${namespace}" "clientSessions" "${remote_site}" "${XSITE_MODE}" + deploy_distributed_cache_cr "${kubecfg}" "${namespace}" "offlineClientSessions" "${remote_site}" "${XSITE_MODE}" + deploy_distributed_cache_cr "${kubecfg}" "${namespace}" "loginFailures" "${remote_site}" "${XSITE_MODE}" + deploy_replicated_cache_cr "${kubecfg}" "${namespace}" "work" "${remote_site}" "${XSITE_MODE}" } function get_api_url() { @@ -318,7 +351,7 @@ function create_cross_site_multiple_clusters() { deploy_all_caches "${KUBECONFIG_1}" "${NS_1}" "${site2}" # Create caches on site B - deploy_all_caches "${KUBECONFIG_1}" "${NS_2}" "${site1}" + deploy_all_caches "${KUBECONFIG_2}" "${NS_2}" "${site1}" } function create_cluster_without_cross_site() { diff --git a/provision/minikube/keycloak/config/kcb-infinispan-cache-remote-store-config.xml b/provision/minikube/keycloak/config/kcb-infinispan-cache-remote-store-config.xml index fa3ed272c..ce1a31ef1 100644 --- a/provision/minikube/keycloak/config/kcb-infinispan-cache-remote-store-config.xml +++ b/provision/minikube/keycloak/config/kcb-infinispan-cache-remote-store-config.xml @@ -24,7 +24,7 @@ - + @@ -214,6 +214,30 @@ + + + + + + + + + + + + + + +