CLI to install/uninstall Openshift clusters.
Project description
openshift-cli-installer
Basic Openshift install CLI wrapper.
The tool allows deploying or deletion of one or more clusters.
The clusters can be deployed on different platforms; currently supported platforms: AWS IPI, ROSA and Hypershift.
Each cluster can be provided with different configuration options, such as worker type, number of workers etc.
Tools
- AWS IPI installation uses openshift-installer cli which is extracted from the cluster's target version.
The binary is taken fromquay.io/openshift-release-dev/ocp-release:<target version>
- ROSA and Hypershift installation uses the latest ROSA CLI
Container
Image locate at openshift-cli-installer
To pull the image: podman pull quay.io/openshift-cli-installer
Global CLI configuration
-
--clusters-install-data-directory
: Clusters configurations are written to<clusters-install-data-directory><platform><cluster name>
; write permissions are needed.<cluster directory>/auth
containskubeconfig
andkubeadmin-password
files
-
--parallel
: To create / destroy clusters in parallel -
Pass
--s3-bucket-name
(and optionally--s3-bucket-path
) to backup in an S3 bucket. -
AWS IPI clusters:
- The installer output is saved in the .
- The data is used for cluster destroy.
base_domain
cluster parameter is mandatory--registry-config-file
: registry-config json file path, can be obtained from openshift local cluster--docker-config-file
: Path to Docker config.json file, defaults to~/.docker/config.json
. File must include token forregistry.ci.openshift.org
--ssh-key-file
: id_rsa file path
-
ROSA / Hypershift clusters:
--ocm-token
: OCM token, defaults toOCM_TOKEN
environment variable.--ocm-env
: OCM environment to deploy the cluster; available options:stage
orproduction
(defaults tostage
)
Cluster parameters
Every call to the openshift installer cli must have at least one --cluster
option.
- Mandatory parameters:
- name: The name of the cluster
- platform: The platform to deploy the cluster on (supported platforms are: aws, rosa and hypershift)
- region: The region to deploy the cluster
- Optional parameters:
- Parameter names should be separated by semicolons (
;
) - To set cluster create / destroy timeout, pass
--cluster ...timeout=1h'
; default is 30 minutes. timeout
andexpiration-time
format examples:1h
,30m
,3600s
- AWS IPI:
- To overwrite cluster config, check install-config-template.j2 parameters.
- Every parameter (marked with double curly brackets in the template) can be overwritten.
- For example: to overwrite
{{ fips|default("false", true) }}
pass--cluster '...fips=true'
- ROSA / Hypershift:
- Every supported ROSA CLI create/delete parameter can be passed. Check
rosa create --help
for more details. - For example:
- Pass
--cluster ...fips=true'
to enable FIPS - Pass
--cluster ...expiration-time=2h'
to have the cluster expiration time set to 2 hours
- Pass
- Every supported ROSA CLI create/delete parameter can be passed. Check
- Hypershift:
- Cluster VPC CIDR, public and private subnets can be configured from the CLI. Otherwise, values in setup-vpc.tf will be used.
- To set
cidr
, pass--cluster ...cidr=1.1.0.0/16'
- To set
private_subnets
, pass--cluster ...private_subnets=10.1.1.0/24,10.1.2.0/24'
- To set
public_subnets
, pass--cluster ...public_subnets=10.1.10.0/24,10.1.20.0/24'
- To set
- Cluster VPC CIDR, public and private subnets can be configured from the CLI. Otherwise, values in setup-vpc.tf will be used.
- Parameter names should be separated by semicolons (
Usages
podman run quay.io/redhat_msi/openshift-cli-installer --help
Local run
Clone the repository
git clone https://github.com/RedHatQE/openshift-cli-installer.git
Install poetry
Install regctl
Install Terraform how-to
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
sudo dnf install terraform
Use poetry run python openshift_cli_installer/cli.py
to execute the cli.
poetry install
poetry run python openshift_cli_installer/cli.py --help
Create Clusters
Each command can be run via container podman run quay.io/redhat_msi/openshift-cli-installer
or via poetry command poetry run python openshift_cli_installer/cli.py
When using the container pass:
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
-v registry-config.json:/registry-config.json
-v ./clusters-install-data:/openshift-cli-installer/clusters-install-data
One cluster
AWS IPI cluster
Versions
- Supported
streams
are:stable
,nightly
,rc
,ci
andec
, Supported architecture(s):X86_64
- If passed exact version this version will be used (if exists), Example: 3.14.9
- If passed partial version, latest version will be used, Example: 4.13 install 4.13.9 (latest)
- If passed
stream=nightly
and version 4.13, latest 4.13 nightly will be used.- stream should be passed as part on
--cluster
,--cluster ...... stream=stable
- stream should be passed as part on
podman run quay.io/redhat_msi/openshift-cli-installer \
--action create \
--registry-config-file=registry-config.json \
--s3-bucket-name=openshift-cli-installer \
--s3-bucket-path=install-folders \
--cluster 'name=ipi1;base_domain=aws.interop.ccitredhat.com;platform=aws;region=us-east-2;version=4.14.0-ec.2;worker_flavor=m5.xlarge'
ROSA cluster
Versions
[Same for Hypershift clusters]
- Supported
channel-group
are:stable
,candidate
, andnightly
. - If passed exact version this version will be used (if exists), Example: 3.14.9
- If passed partial version, latest version will be used, Example: 4.13 install 4.13.9 (latest)
- If passed
channel-group=nightly
and version 4.13, latest 4.13 nightly will be used.- stream should be passed as part on
--cluster
,--cluster ...... channel-group=stable
- stream should be passed as part on
podman run quay.io/redhat_msi/openshift-cli-installer \
--action create \
--ocm-token=$OCM_TOKEN \
--ocm-env=stage \
--cluster 'name=rosa1;platform=rosa;region=us-east-2;version=4.13.4;compute-machine-type=m5.xlarge;replicas=2;channel-group=candidate;expiration-time=4h;timeout=1h'
Hypershift cluster
podman run quay.io/redhat_msi/openshift-cli-installer \
--action create \
--ocm-token=$OCM_TOKEN \
--ocm-env=stage \
--cluster 'name=hyper;platform=hypershift;region=us-west-2;version=4.13.4;compute-machine-type=m5.4xlarge;replicas=6;channel-group=candidate;expiration-time=4h;timeout=1h'
Multiple clusters
To run multiple clusters deployments in parallel pass -p,--parallel.
podman run quay.io/redhat_msi/openshift-cli-installer \
--action create \
--registry-config-file=registry-config.json \
--s3-bucket-name=openshift-cli-installer \
--s3-bucket-path=install-folders \
--ocm-token=$OCM_TOKEN \
--ocm-env=stage \
--cluster 'name=hyper1;platform=hypershift;region=us-west-2;version=4.13.4;compute-machine-type=m5.4xlarge;replicas=6;channel-group=candidate;expiration-time=2h;timeout=1h' \
--cluster 'name=ipi1;base_domain=aws.interop.ccitredhat.com;platform=aws;region=us-east-2;version=4.14.0-ec.2;worker_flavor=m5.xlarge' \
--cluster 'name=rosa1;platform=rosa;region=us-east-2;version=4.13.4;compute-machine-type=m5.xlarge;replicas=2;channel-group=candidate;expiration-time=4h;timeout=1h' \
--parallel
Destroy Clusters
One cluster
AWS IPI cluster
podman run quay.io/redhat_msi/openshift-cli-installer \
--action destroy \
--ocm-token=$OCM_TOKEN \
--ocm-env=stage \
--cluster 'name=ipi1;region=us-east-2;version=4.14.0-ec.2;timeout=1h'
ROSA cluster
podman run quay.io/redhat_msi/openshift-cli-installer \
--action destroy \
--ocm-token=$OCM_TOKEN \
--ocm-env=stage \
--cluster 'name=rosa1;platform=rosa;region=us-east-2;version=4.13.4;timeout=1h'
Hypershift cluster
podman run quay.io/redhat_msi/openshift-cli-installer \
--action destroy \
--ocm-token=$OCM_TOKEN \
--ocm-env=stage \
--cluster 'name=hyper1;platform=rosa;region=us-east-2;version=4.13.4;timeout=1h'
Multiple clusters
To run multiple clusters deletion in parallel pass -p,--parallel.
podman run quay.io/redhat_msi/openshift-cli-installer \
--action destroy \
--ocm-token=$OCM_TOKEN \
--ocm-env=stage \
--cluster 'name=rosa1;platform=rosa;region=us-east-2;version=4.13.4;timeout=1h' \
--cluster 'name=hyper1;platform=rosa;region=us-east-2;version=4.13.4;timeout=1h' \
--cluster 'name=ipi1;region=us-east-2;version=4.14.0-ec.2;timeout=1h'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for openshift_cli_installer-1.0.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | af439bc3632aec1e357d1f57b06cab84dfaa0f7890736e6a8b723cb5f54dda51 |
|
MD5 | 9ae83342a36117bbc41f57e0229498cd |
|
BLAKE2b-256 | 1858ae866ef9be144afc854fe725f85d664429ffe867262298490a62b6082c58 |