Skip to content

Commit

Permalink
Taskfile to deploy Infinispan
Browse files Browse the repository at this point in the history
* Inital commit
  • Loading branch information
pruivo committed Aug 3, 2023
1 parent d5fcbdc commit 4f2a728
Show file tree
Hide file tree
Showing 15 changed files with 613 additions and 606 deletions.
28 changes: 0 additions & 28 deletions .github/actions/infinispan-create-deployment/action.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-default-region: ${{ vars.AWS_DEFAULT_REGION }}
rosa-token: ${{ secrets.ROSA_TOKEN }}
- name: Setup Go Task
uses: ./.github/actions/task-setup
- name: Create Infinispan deployment
uses: ./.github/actions/infinispan-create-deployment
with:
cluster1: ${{ inputs.clusterName1 }}
namespace1: ${{ inputs.namespace1 }}
cluster2: ${{ inputs.clusterName2 }}
namespace2: ${{ inputs.namespace2 }}
working-directory: provision/infinispan
run: task crossdc
env:
ROSA_CLUSTER_NAME_1: "${{ inputs.clusterName1 }}"
ROSA_CLUSTER_NAME_2: "${{ inputs.clusterName2 }}"
OC_NAMESPACE_1: "${{ inputs.namespace1 }}"
OC_NAMESPACE_2: "${{ inputs.namespace2 }}"
38 changes: 0 additions & 38 deletions .github/workflows/infinispan-cross-site-single-cluster.yml

This file was deleted.

21 changes: 12 additions & 9 deletions .github/workflows/infinispan-delete-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ on:
clusterName2:
description: 'Name of the second ROSA cluster'
type: string
required: false
required: true
namespace2:
description: 'Namespace to deploy Infinispan in the second ROSA cluster'
type: string
required: false
required: true

jobs:
prepare:
Expand All @@ -34,10 +34,13 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-default-region: ${{ vars.AWS_DEFAULT_REGION }}
rosa-token: ${{ secrets.ROSA_TOKEN }}
- name: Create Infinispan deployment
uses: ./.github/actions/infinispan-delete-deployment
with:
cluster1: ${{ inputs.clusterName1 }}
namespace1: ${{ inputs.namespace1 }}
cluster2: ${{ inputs.clusterName2 }}
namespace2: ${{ inputs.namespace2 }}
- name: Setup Go Task
uses: ./.github/actions/task-setup
- name: Delete Infinispan deployment
working-directory: provision/infinispan
run: task crossdc-delete
env:
ROSA_CLUSTER_NAME_1: "${{ inputs.clusterName1 }}"
ROSA_CLUSTER_NAME_2: "${{ inputs.clusterName2 }}"
OC_NAMESPACE_1: "${{ inputs.namespace1 }}"
OC_NAMESPACE_2: "${{ inputs.namespace2 }}"
33 changes: 0 additions & 33 deletions .github/workflows/infinispan-single-cluster.yml

This file was deleted.

2 changes: 2 additions & 0 deletions provision/infinispan/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
kubecfg_1
kubecfg_2
.env
.task
48 changes: 10 additions & 38 deletions provision/infinispan/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,26 @@

Deploy an Infinispan cluster (with or without cross-site) and configures the necessary caches for Keycloak.

== Required variables
== Taskfile

* `CLUSTER_1`: The ROSA cluster name of site 1.
* `CLUSTER_2`: The ROSA cluster name of site 2.
* `NS_1`: The namespace to install Infinispan in site 1.
* `NS_2`: The namespace to install Infinispan in site 2.
For single cluster mode:

== Optional variables:
* `KUBECONFIG_1`: Path to `KUBECONFIG` to use for CLUSTER_1.
* `KUBECONFIG_2`: Path to `KUBECONFIG` to use for CLUSTER_2.

If file does not exist, rosa_oc_login will be invoked and the configuration stored in this path.

== Infinispan cluster customization:

* `XSITE_MODE`: The cross-site strategy, default to SYNC.
* `ISPN_REPLICAS`: The number of Infinispan pods.

== Operation Modes

* CLUSTER_1 == CLUSTER_2 and NS_1 == NS_2 -> Single Infinispan cluster without cross-site.

Example:
[source, bash]
----
CLUSTER_1="gh-pruivo" CLUSTER_2="gh-pruivo" NS_1="ispn-server" NS_2="ispn-server" ./create_ispn_clusters.sh
----

* CLUSTER_1 == CLUSTER_2 and NS_1 != NS_2 -> Infinispan clusters with cross-site enabled in a single OCP cluster.
Each namespace gets an Infinispan cluster, and they are linked together with cross-site.

Example:
[source, bash]
----
CLUSTER_1="gh-pruivo" CLUSTER_2="gh-pruivo" NS_1="server-site-1" NS_2="server-site-2" ./create_ispn_clusters.sh
task single-cluster ROSA_CLUSTER_NAME=gh-keycloak OC_NAMESPACE=infinispan
----

* CLUSTER_1 != CLUSTER_2 -> Infinispan clusters with cross-site enabled in 2 different OCP clusters.
The namespaces must be set and they can be the same or different namespaces.
For cross-site between different namespaces:

Example:
[source, bash]
----
CLUSTER_1="gh-pruivo" CLUSTER_2="gh-keycloak" NS_1="ispn-server" NS_2="ispn-server" ./create_ispn_clusters.sh
task crossdc-single ROSA_CLUSTER_NAME=gh-keycloak OC_NAMESPACE_1=ispn-1 OC_NAMESPACE_2=ispn-2
----

And finally, for cross-site between different OCP clusters:
[source, bash]
----
CLUSTER_1="gh-pruivo" CLUSTER_2="gh-keycloak" NS_1="server-site-1" NS_2="server-site-2" ./create_ispn_clusters.sh
task crossdc ROSA_CLUSTER_NAME_1=gh-keycloak ROSA_CLUSTER_NAME_2=gh-pruivo OC_NAMESPACE_1=infinispan OC_NAMESPACE_2=infinispan
----

== Provision Keycloak
Expand Down Expand Up @@ -83,7 +54,8 @@ following commands from this directory (assuming `.env` is properly configured t

[source, bash]
----
CLUSTER_1="gh-pruivo" CLUSTER_2="gh-pruivo" NS_1="ispn-server" NS_2="ispn-server" ./create_ispn_clusters.sh
cd provistion/infinispan
task single-cluster ROSA_CLUSTER_NAME=gh-keycloak OC_NAMESPACE=ispn-server
cd ../provistion/openshift
go-task KC_CUSTOM_INFINISPAN_CONFIG_FILE=config/kcb-infinispan-cache-remote-store-config.xml KC_ISPN_CLUSTER=infinispan KC_ISPN_NAMESPACE=ispn-server
task KC_CUSTOM_INFINISPAN_CONFIG_FILE=config/kcb-infinispan-cache-remote-store-config.xml KC_ISPN_CLUSTER=infinispan KC_ISPN_NAMESPACE=ispn-server
----
Loading

0 comments on commit 4f2a728

Please sign in to comment.