-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Infinispan Deployment Closes #417 Co-authored-by: Alexander Schwartz <[email protected]>
- Loading branch information
Showing
22 changed files
with
1,090 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Create Infinispan Deployment | ||
description: Create Infinispan Deployment for running OpenShift project | ||
|
||
inputs: | ||
cluster1: | ||
description: 'The first ROSA cluster' | ||
required: true | ||
namespace1: | ||
description: 'The namespace to install Infinispan in the first ROSA cluster.' | ||
required: true | ||
cluster2: | ||
description: 'The second ROSA cluster (optional)' | ||
namespace2: | ||
description: 'The namespace to install Infinispan in the second ROSA cluster.' | ||
|
||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- id: install_infinispan | ||
shell: bash | ||
run: ./create_ispn_clusters.sh | ||
working-directory: provision/infinispan | ||
env: | ||
CLUSTER_1: ${{ inputs.cluster1 }} | ||
NS_1: ${{ inputs.namespace1 }} | ||
CLUSTER_2: ${{ inputs.cluster2 }} | ||
NS_2: ${{ inputs.namespace2 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Delete Infinispan Deployment | ||
description: Delete Infinispan Deployment for running OpenShift project | ||
|
||
inputs: | ||
cluster1: | ||
description: 'The first ROSA cluster' | ||
required: true | ||
namespace1: | ||
description: 'The namespace to install Infinispan in the first ROSA cluster.' | ||
required: true | ||
cluster2: | ||
description: 'The second ROSA cluster (optional)' | ||
namespace2: | ||
description: 'The namespace to install Infinispan in the second ROSA cluster.' | ||
|
||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- id: delete_infinispan | ||
shell: bash | ||
run: ./delete_ispn_clusters.sh | ||
working-directory: provision/infinispan | ||
env: | ||
CLUSTER_1: ${{ inputs.cluster1 }} | ||
NS_1: ${{ inputs.namespace1 }} | ||
CLUSTER_2: ${{ inputs.cluster2 }} | ||
NS_2: ${{ inputs.namespace2 }} |
43 changes: 43 additions & 0 deletions
43
.github/workflows/infinispan-cross-site-mutiple-clusters.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Infinispan - Cross-site in Two Clusters Deployment | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
clusterName1: | ||
description: 'Name of the first ROSA cluster' | ||
type: string | ||
required: true | ||
namespace1: | ||
description: 'Namespace to deploy Infinispan in the first ROSA cluster' | ||
type: string | ||
required: true | ||
clusterName2: | ||
description: 'Name of the second ROSA cluster' | ||
type: string | ||
required: true | ||
namespace2: | ||
description: 'Namespace to deploy Infinispan in the second ROSA cluster' | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
prepare: | ||
name: Create Infinispan deployment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup ROSA CLI | ||
uses: ./.github/actions/rosa-cli-setup | ||
with: | ||
aws-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
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-create-deployment | ||
with: | ||
cluster1: ${{ inputs.clusterName1 }} | ||
namespace1: ${{ inputs.namespace1 }} | ||
cluster2: ${{ inputs.clusterName2 }} | ||
namespace2: ${{ inputs.namespace2 }} |
38 changes: 38 additions & 0 deletions
38
.github/workflows/infinispan-cross-site-single-cluster.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Infinispan - Cross-site in Single Cluster Deployment | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
clusterName: | ||
description: 'Name of the ROSA cluster' | ||
type: string | ||
required: true | ||
namespace1: | ||
description: 'Namespace to deploy the first Infinispan clusters' | ||
type: string | ||
required: true | ||
namespace2: | ||
description: 'Namespace to deploy the second Infinispan cluster' | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
prepare: | ||
name: Create Infinispan deployment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup ROSA CLI | ||
uses: ./.github/actions/rosa-cli-setup | ||
with: | ||
aws-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
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-create-deployment | ||
with: | ||
cluster1: ${{ inputs.clusterName }} | ||
namespace1: ${{ inputs.namespace1 }} | ||
namespace2: ${{ inputs.namespace2 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Infinispan - Delete Deployment | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
clusterName1: | ||
description: 'Name of the first ROSA cluster' | ||
type: string | ||
required: true | ||
namespace1: | ||
description: 'Namespace to deploy Infinispan in the first ROSA cluster' | ||
type: string | ||
required: true | ||
clusterName2: | ||
description: 'Name of the second ROSA cluster' | ||
type: string | ||
required: false | ||
namespace2: | ||
description: 'Namespace to deploy Infinispan in the second ROSA cluster' | ||
type: string | ||
required: false | ||
|
||
jobs: | ||
prepare: | ||
name: Delete Infinispan deployment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup ROSA CLI | ||
uses: ./.github/actions/rosa-cli-setup | ||
with: | ||
aws-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Infinispan - Single Cluster Deployment | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
clusterName: | ||
description: 'Name of the ROSA cluster' | ||
type: string | ||
required: true | ||
namespace: | ||
description: 'Namespace to deploy Infinispan' | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
prepare: | ||
name: Create Infinispan deployment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup ROSA CLI | ||
uses: ./.github/actions/rosa-cli-setup | ||
with: | ||
aws-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
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-create-deployment | ||
with: | ||
cluster1: ${{ inputs.clusterName }} | ||
namespace1: ${{ inputs.namespace }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
kubecfg_1 | ||
kubecfg_2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
= Infinispan Installer | ||
|
||
Deploy an Infinispan cluster (with or without cross-site) and configures the necessary caches for Keycloak. | ||
|
||
== Required variables | ||
|
||
* `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. | ||
|
||
== 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 | ||
---- | ||
|
||
* 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. | ||
|
||
Example: | ||
[source, bash] | ||
---- | ||
CLUSTER_1="gh-pruivo" CLUSTER_2="gh-keycloak" NS_1="ispn-server" NS_2="ispn-server" ./create_ispn_clusters.sh | ||
---- | ||
|
||
[source, bash] | ||
---- | ||
CLUSTER_1="gh-pruivo" CLUSTER_2="gh-keycloak" NS_1="server-site-1" NS_2="server-site-2" ./create_ispn_clusters.sh | ||
---- | ||
|
||
== Provision Keycloak | ||
|
||
The Taskfile in `provistion/openshift` introduced 4 more variables: | ||
|
||
|
||
|=== | ||
|Variable |Default |Details | ||
|
||
|`KC_CUSTOM_INFINISPAN_CONFIG_FILE` | ||
|`config/kcb-infinispan-cache-config.xml` | ||
|The path to the Infinispan configuration file to be used by Keycloak | ||
|
||
|`KC_ISPN_PORT` | ||
|`11222` | ||
|The Infinispan port. Should never be set if Infinispan is installed by this script. | ||
|
||
|`KC_ISPN_CLUSTER` | ||
|- | ||
|The Infinispan cluster name. If installed by this script, its value is infinispan | ||
|
||
|`KC_ISPN_NAMESPACE` | ||
|- | ||
|The namespace where the Infinispan cluster is installed. | ||
|=== | ||
|
||
As an example, using a single Infinispan cluster, Infinispan and keycloak can be deployed using the | ||
following commands from this directory (assuming `.env` is properly configured to access the OCP cluster): | ||
|
||
[source, bash] | ||
---- | ||
CLUSTER_1="gh-pruivo" CLUSTER_2="gh-pruivo" NS_1="ispn-server" NS_2="ispn-server" ./create_ispn_clusters.sh | ||
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 | ||
---- |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function error_and_exit() { | ||
echo "Error: ${@:2}" | ||
exit "${1}" | ||
} | ||
|
||
# required! | ||
[ -z "${CLUSTER_1}" ] && error_and_exit 1 "CLUSTER_1 is required. CLUSTER_1 is the name of the first ROSA cluster." | ||
[ -z "${NS_1}" ] && error_and_exit 3 "NS_1 is required. NS_1 is the namespace to install Infinispan in the first ROSA cluster" | ||
|
||
KUBECONFIG_1=${KUBECONFIG_1:-"./kubecfg_1"} | ||
KUBECONFIG_2=${KUBECONFIG_2:-"./kubecfg_2"} | ||
|
||
|
||
function rosa_oc_login() { | ||
local kubecfg="${1}" | ||
local cluster="${2}" | ||
|
||
# if file exists, assume oc login is done | ||
[ -f "${kubecfg}" ] || KUBECONFIG="${kubecfg}" CLUSTER_NAME="${cluster}" ${WD}/../aws/rosa_oc_login.sh | ||
} |
Oops, something went wrong.