The OCI OpenShift Autoscaling Operator automates the deployment and management of Cluster API, Cluster API Provider OCI, and Kubernetes cluster-autoscaler components for Red Hat OpenShift clusters running on Oracle Cloud Infrastructure.
This project is intended for developers and operators who need to enable autoscaling for OpenShift worker nodes on OCI. It provides an operator, Kubernetes manifests, sample custom resources, and helper scripts for preparing the OCI and OpenShift configuration that the autoscaling stack requires.
- Red Hat OpenShift cluster running on OCI.
- Local
kubeconfigfile for the OpenShift cluster. - Oracle Cloud Infrastructure CLI (
oci) installed and configured. - OpenShift CLI (
oc) installed. - Go 1.25 or later.
- Docker Desktop or another Docker-compatible container runtime with Buildx support.
jq,curl,gzip, andopensslavailable on your local machine.- OCI permissions to inspect compartments, virtual cloud networks, subnets, network security groups, load balancers, and custom images.
See the Red Hat documentation for creating an OpenShift cluster on OCI: https://docs.redhat.com/en/documentation/openshift_container_platform/4.19/html/installing_on_oci/installing-oci-assisted-installer#installing-oci-about-assisted-installer_installing-oci-assisted-installer
Clone the repository:
git clone https://github.com/oracle-samples/oci-openshift-autoscaling.git
cd oci-openshift-autoscalingSet your OpenShift cluster credentials:
export KUBECONFIG=/path/to/kubeconfigVerify local access:
oc whoami
oci iam region listThe config.sh helper uses the local oci CLI to discover OCI resource identifiers for the target cluster. The CLI must be authenticated before you source the helper script.
This operator supports two Cluster API Provider OCI authentication modes:
- Instance principal mode: CAPOCI uses instance principal authentication from the cluster-side workload.
- API key mode: CAPOCI uses explicit OCI user credentials from the local OCI CLI configuration.
For instance principal mode, set this value in config.sh:
use_instance_principal=trueFor API key mode, keep this value in config.sh:
use_instance_principal=falseIf you need to configure OCI API key authentication, follow the Oracle Cloud Infrastructure API signing key instructions: https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm
Autoscaled worker nodes require a Red Hat CoreOS image that matches the OpenShift cluster version.
For example, for OpenShift 4.19:
curl -LO https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.19/4.19.0/rhcos-4.19.0-x86_64-openstack.x86_64.qcow2.gz
gzip -d rhcos-4.19.0-x86_64-openstack.x86_64.qcow2.gzUpload the image to OCI and create a custom image. See the OCI custom image documentation: https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/importingcustomimagelinux.htm
Record the custom image name. You will use it in config.sh.
For bare metal worker nodes, prepare a Red Hat CoreOS image with the required iSCSI configuration before uploading it to Object Storage and creating the custom image.
Edit config.sh and set the required values:
compartment_name=
image_name=
nsg_name=
compute_nsg_name=
ocp_subnet_name=
bare_metal_subnet_name=Source the configuration:
source config.shThe helper exports the environment variables used to render the deployment manifests.
Build the manager binary:
make buildBuild a container image:
export IMG=<registry>/<repository>/oci-openshift-autoscaling-operator:<tag>
make build-imageBuild and push a multi-architecture image:
export IMG=<registry>/<repository>/oci-openshift-autoscaling-operator:<tag>
make buildxDeploy the operator:
export IMG=<registry>/<repository>/oci-openshift-autoscaling-operator:<tag>
make deployBy default, the operator and autoscaling stack run in the oci-openshift-autoscaling-operator namespace. cert-manager remains in the upstream cert-manager namespace.
Create the sample OCIClusterAutoscaler resource:
make applyVerify the deployments and Cluster API resources:
oc get pods -n oci-openshift-autoscaling-operator
oc get cluster -n oci-openshift-autoscaling-operator
oc get ocicluster -n oci-openshift-autoscaling-operator
oc get machinedeployment -n oci-openshift-autoscaling-operator
oc get ocimachinetemplate -n oci-openshift-autoscaling-operatorRemove only the OCI OpenShift Autoscaling Operator resources:
make cleanup-autoscalerRemove the operator, Cluster API resources, CAPOCI resources, and cluster-autoscaler resources:
make cleanup-autoscaler-fullThe full cleanup target is destructive. It preserves cert-manager by default. To remove cert-manager resources installed by provider bootstrap, opt in explicitly:
make cleanup-autoscaler-full AUTOSCALER_DELETE_CERT_MANAGER=trueDeveloper-oriented documentation is maintained in this repository:
OCIClusterAutoscalercustom resource fields- Component implementation notes in
internal/components/README.md - Operator packaging and deployment assets under
config/
Product documentation for Oracle products and services is published on https://docs.oracle.com.
The repository includes a sample OCIClusterAutoscaler custom resource in config/samples/capi_v1beta1_ociclusterautoscaler.yaml.
Apply the sample:
make applyTest autoscaling by creating workload demand that exceeds the current cluster capacity:
oc create deployment nginx --namespace default --image=docker.io/nginx:latest --replicas=0
oc set resources deployment -n default nginx --requests=memory=2Gi
oc scale deployment -n default nginx --replicas=20Watch the autoscaling resources:
oc get machinedeployment -n oci-openshift-autoscaling-operator
oc get machineset -n oci-openshift-autoscaling-operator
oc get ocicluster -n oci-openshift-autoscaling-operator
oc get ocimachine -n oci-openshift-autoscaling-operator
oc get nodesScale the example workload back down:
oc scale deployment -n default nginx --replicas=0Use GitHub issues in this repository for project questions, bug reports, and enhancement requests.
Do not use GitHub issues to report security vulnerabilities. Follow the responsible disclosure process in the security guide.
For Oracle Cloud Infrastructure service issues, use your normal Oracle Support channel if you have an Oracle Support relationship.
This project welcomes contributions from the community. Before submitting a pull request, review the contribution guide.
Please consult the security guide for the responsible security vulnerability disclosure process.
Copyright (c) 2025, 2026 Oracle and/or its affiliates.
Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.