CLI to Install/Uninstall Addons/operators on OCM/OCP clusters.
Image locate at ocp-addons-operators-cli
To pull the image: podman pull quay.io/redhat_msi/ocp-addons-operators-cli
Clone the repository
git clone https://github.com/RedHatQE/ocp-addons-operators-cli.git
Install poetry
Use poetry run python ocp_addons_operators_cli/cli.py
to execute the cli.
poetry install
poetry run python ocp_addons_operators_cli/cli.py --help
User can install/uninstall addons and/or operators by sending YAML file instead with CLI args
Example YAML file can be found here
pass --yaml-config-file=.local/addons-operators.yaml
to use YAML file.
Action also can be passed to the CLI as --action install/uninstall
instead of specifying the action in the YAML file.
poetry run python ocp_addons_operators_cli/cli.py --action install --yaml-config-file addons-operators.yaml
podman run quay.io/redhat_msi/ocp-addons-operators-cli --help
-
--action
: install/uninstall product(s) -
--brew-token
: Brew token (needed to install managed-odh addon in stage). Also required for operators IIB installation. Default value is taken from environment variableBREW_TOKEN
. -
--debug
: Enable debug logs -
--parallel
: Run install/uninstall in parallel -
--must-gather-output-dir
: Path to must-gather output dir.must-gather
will try to collect data when addon/operator installation fails and cluster can be accessed. -
Operators configuration
--kubeconfig
: Path to kubeconfig; can be overwritten by cluster-specific configuration- To install operators from saved IIB json, created by ci-jobs-trigger, following args are required:
--local-operators-latest-iib-path
: Path to local file containing IIB and jobs data--s3-bucket-operators-latest-iib-path
: Path to S3 object containing IIB and jobs data--aws-access-key-id
: AWS access key id, needed when using --s3-bucket-operators-latest-iib-path.--aws-secret-access-key
: AWS secret access key, needed when using --s3-bucket-operators-latest-iib-path.--aws-region
: AWS region, needed when using --s3-bucket-operators-latest-iib-path.PARENT_JOB_NAME
environment variable should be set
-
Addons configuration
--endpoint
: SSO endpoint url, defaults to https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token--ocm-token
: OCM token, defaults toOCM_TOKEN
environment variable--cluster-name
: Addon's cluster name; can be overwritten by cluster-specific configuration
Each --addon
or --operator
accept args, the format is arg=value;
name=name
: Name of the operator/addon to install/uninstalltimeout=300
: timeout to wait for the operator/addon to be installed/uninstalled; format examples:1h
,30m
,3600s
rosa=true
: Use rosa cli to install/uninstall the addoncluster-name=cluster
: Addon's cluster name; if not provided, global configuration will be used
iib=/path/to/iib:123456
: Install the operator using the provided IIBchannel=stable
: Operator channel to install from, default: 'stable'source=redhat-operators
: Operator source, default: 'redhat-operators'source-image=registry/redhat/operator-index:v4.13
: Install Operator using provided CatalogSource Imagekubeconfig
: Path to kubeconfig; if not provided, global configuration will be used
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
-t $OCM_TOKEN \
-a 'name=ocm-addon-test-operator;has-external-resources=false;aws-cluster-test-param=false;timeout=600' \
-c cluster-name
To run multiple addons install in parallel pass -p,--parallel.
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
-t $OCM_TOKEN \
-a 'name=ocm-addon-test-operator;has-external-resources=false;aws-cluster-test-param=false;timeout=600' \
-a 'name=ocm-addon-test-operator-2;has-external-resources=false;aws-cluster-test-param=false;timeout=600' \
-c cluster-name
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action uninstall \
-t $OCM_TOKEN \
-a 'name=ocm-addon-test-operator' \
-c cluster-name
To run multiple addons uninstall in parallel pass -p,--parallel.
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
-t $OCM_TOKEN \
-a 'name=ocm-addon-test-operator' \
-a 'name=ocm-addon-test-operator-2' \
-c cluster-name
To run multiple addons uninstall in parallel pass -p,--parallel.
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
-t $OCM_TOKEN \
-a 'name=ocm-addon-test-operator;cluster-name=cluster1' \
-a 'name=ocm-addon-test-operator-2;cluster-name=cluster2'
Pass 'rosa=true' in the addon -a
arg.
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
-t $OCM_TOKEN \
-a 'name=ocm-addon-test-operator;has-external-resources=false;aws-cluster-test-param=false;rosa=true;timeout=600'
-c cluster-name
Only addons ocm-addon-test-operator-1
and ocm-addon-test-operator-3
will be installed with ROSA cli.
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
--kubeconfig ~/work/CSPI/kubeconfig/rosa-myk412 \
-o 'name=rhods-operator;namespace=redhat-ods-operator'
To run multiple operators install in parallel pass -p,--parallel.
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
--kubeconfig ~/work/CSPI/kubeconfig/rosa-myk412 \
-o 'name=rhods-operator;namespace=redhat-ods-operator;timeout=600' \
-o 'name=servicemeshoperator'
To run multiple operators install in parallel pass -p,--parallel.
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
-o 'name=rhods-operator;namespace=redhat-ods-operator;timeout=600;kubeconfig=/tmp/kubeconfig1' \
-o 'name=servicemeshoperator;kubeconfig=/tmp/kubeconfig2'
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
--kubeconfig ~/work/CSPI/kubeconfig/rosa-myk412 \
--brew-token token \
-o 'name=rhods-operator;namespace=redhat-ods-operator;iib=/path/to/iib:123456'
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
--kubeconfig ~/work/CSPI/kubeconfig/rosa-myk412 \
-o 'name=rhods-operator;namespace=redhat-ods-operator;source-image=registry/redhat/operator-index:v4.13'
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action uninstall \
--kubeconfig ~/work/CSPI/kubeconfig/rosa-myk412 \
-o 'name=servicemeshoperator'
To run multiple operators uninstall in parallel pass -p,--parallel.
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action uninstall \
--kubeconfig ~/work/CSPI/kubeconfig/rosa-myk412 \
-o 'name=rhods-operator;namespace=redhat-ods-operator' \
-o 'name=servicemeshoperator;timeout=600'
To run multiple operators install in parallel pass -p,--parallel.
podman run quay.io/redhat_msi/ocp-addons-operators-cli \
--action install \
--kubeconfig ~/work/CSPI/kubeconfig/rosa-myk412 \
-t $OCM_TOKEN \
-c cluster1 \
-a 'name=ocm-addon-test-operator;has-external-resources=false;aws-cluster-test-param=false;ocm-env=stage' \
-o 'name=servicemeshoperator;timeout=600'