Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,60 @@ $ make force-stop
$ make destroy
```

### Managing Multiple AWS Metal Machines

The tooling supports deploying and managing multiple AWS metal machines simultaneously. This is useful for testing different configurations or running multiple clusters in parallel.

#### How It Works

Two key variables in `aws-hypervisor/instance.env` control which machine you're working with:
- **`SHARED_DIR`**: The directory where instance data is stored (e.g., `instance-data-machine1`)
- **`STACK_NAME`**: The CloudFormation stack name (e.g., `machine1`)

Each unique combination of these variables represents a separate AWS metal machine deployment.

#### Workflow for Multiple Machines

**Initial deployment of a machine:**
```bash
# Edit instance.env to set your first deployment
export SHARED_DIR=instance-data-machine1
export STACK_NAME=machine1

# Deploy the machine
$ make deploy
```

**Deploy a second machine:**
```bash
# Edit instance.env with new values
export SHARED_DIR=instance-data-machine2
export STACK_NAME=machine2

# Deploy the second machine
$ make deploy
```

**Switch between machines:**

To switch which machine you're working with, simply update the two variables in `instance.env` and update the inventory:

```bash
# Edit instance.env to point to the machine you want
export SHARED_DIR=instance-data-machine1
export STACK_NAME=machine1

# Update SSH configuration to point to this machine
$ make inventory

# Now use any command normally (it will operate on machine1)
$ make fencing-ipi
$ make ssh
$ make stop
```

This allows you to seamlessly switch between different AWS metal machines without any additional configuration changes.

### OpenShift Cluster Management

When running OpenShift clusters on the instance (using dev-scripts), you have several options for managing cluster lifecycle:
Expand Down
2 changes: 1 addition & 1 deletion deploy/aws-hypervisor/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
instance.env
instance-data
instance-data*/
pull_secret.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ make_target:
ipi: "all"
agent: "agent"
# Cluster state management variables
cluster_state_dir: "../aws-hypervisor/instance-data"
cluster_state_dir: "../aws-hypervisor/{{ lookup('env', 'SHARED_DIR') }}"
cluster_state_filename: "cluster-vm-state.json"
5 changes: 4 additions & 1 deletion deploy/openshift-clusters/scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ set -o nounset
set -o errexit
set -o pipefail

# shellcheck source=/dev/null
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"

# Check if instance data exists
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
echo "Error: No instance found. Please run 'make deploy' first."
exit 1
fi
Expand Down
5 changes: 4 additions & 1 deletion deploy/openshift-clusters/scripts/deploy-arbiter-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ set -o nounset
set -o errexit
set -o pipefail

# shellcheck source=/dev/null
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"

# Check if instance data exists
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
echo "Error: No instance found. Please run 'make deploy' first."
exit 1
fi
Expand Down
5 changes: 4 additions & 1 deletion deploy/openshift-clusters/scripts/deploy-arbiter-ipi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ set -o nounset
set -o errexit
set -o pipefail

# shellcheck source=/dev/null
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"

# Check if instance data exists
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
echo "Error: No instance found. Please run 'make deploy' first."
exit 1
fi
Expand Down
5 changes: 4 additions & 1 deletion deploy/openshift-clusters/scripts/deploy-fencing-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ set -o nounset
set -o errexit
set -o pipefail

# shellcheck source=/dev/null
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"

# Check if instance data exists
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
echo "Error: No instance found. Please run 'make deploy' first."
exit 1
fi
Expand Down
5 changes: 4 additions & 1 deletion deploy/openshift-clusters/scripts/deploy-fencing-ipi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ set -o nounset
set -o errexit
set -o pipefail

# shellcheck source=/dev/null
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"

# Check if instance data exists
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
echo "Error: No instance found. Please run 'make deploy' first."
exit 1
fi
Expand Down
5 changes: 4 additions & 1 deletion deploy/openshift-clusters/scripts/full-clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ set -o nounset
set -o errexit
set -o pipefail

# shellcheck source=/dev/null
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"

# Check if instance data exists
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
echo "Error: No instance found. Please run 'make deploy' first."
exit 1
fi
Expand Down