Skip to content

Conversation

@fjglira
Copy link
Collaborator

@fjglira fjglira commented Oct 23, 2025

This PR adds a standardized, reusable script for creating and managing OpenShift clusters using MAPT (Managed Application Platform Tools) across different environments: local development to CI/CD pipelines.

Key Features

  • S3 Bucket Management: Automatic creation and cleanup of S3 buckets for CI environments with proper state preservation
  • Flexible Operations: Support for create-only, delete-only, or combined operations (For testing reasons only)
  • Comprehensive Logging: Timestamped logs with live streaming in verbose mode
  • Secure Credential Handling: No credentials logged, automatic cleanup on exit
  • Error Recovery: Proper cleanup on failures with detailed error reporting
  • Allow to create spot cluster instances

For more information, please take a look at the Readme file

Signed-off-by: Francisco Herrera <[email protected]>
@fjglira fjglira marked this pull request as draft October 23, 2025 15:44
@fjglira fjglira marked this pull request as ready for review October 27, 2025 14:56
### Required Tools
- **Container Engine**: Podman (recommended) or Docker
- **AWS CLI**: Required when using S3 backing (CI environments)
- **Pull Secret**: OpenShift pull secret file for cluster creation
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've mentioned the "pull secret" in "Required Credentials".
Probably, it could be removed from here, as it's not a tool.


# Custom cluster configuration
export CLUSTER_NAME="my-test-cluster"
export CLUSTER_VERSION="4.18.0"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since currently, specifying the patch version of the cluster is required, it there a place when available versions could be fetched?
If so, worth mention it here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a note in the read me

|--------|-------------|
| `-c, --create-only` | Create cluster only (don't delete) |
| `-d, --delete-only` | Delete cluster only (don't create) |
| `-b, --both` | Create and delete cluster (default) |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it worth explain, what is "create and delete" cluster flow.
In my point of view, as someone who looking at it for the first time, I'm not quite understand, what is - create and delete flow.
Shouldn't we first create the cluster, then run the required testing and only then delete the cluster?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the both is to only test the entire workflow in case anything is broken. The idea is to have a complete workflow of creation and deletion


| Option | Description |
|--------|-------------|
| `-c, --create-only` | Create cluster only (don't delete) |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to not make the arguments just - "--create" and "--delete"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

container_exists() {
local container_name="$1"
local engine="${CONTAINER_ENGINE:-podman}"
$engine ps -a --format "{{.Names}}" | grep -q "^${container_name}$" 2>/dev/null
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to surround the var with double quotes here and below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, added

Signed-off-by: Francisco Herrera <[email protected]>
Signed-off-by: Francisco Herrera <[email protected]>
Signed-off-by: Francisco Herrera <[email protected]>
Copy link

@MaxBab MaxBab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two tiny comments.

```

**Finding Available OpenShift Versions**: To find available OpenShift versions with patch numbers, you can:
- Check using the AWS clie the AMI available for your account with the name openshift-local:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clie -> cli

AWS_SECRET_ACCESS_KEY AWS secret key for S3 and cluster provisioning

OPTIONAL ENVIRONMENT VARIABLES:
AWS_DEFAULT_REGION AWS region for resources (default: us-east-1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a critical, but the indentation in the section below is not aligned. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants