/ocp-upi-powervs-pod

Deploys a new OpenShift cluster at IBM Cloud on the PowerVS service from within another OpenShift cluster, running the setup from a pod.

Primary LanguageShellApache License 2.0Apache-2.0

ocp4-powervs-automation-runtime

Deploy a new OpenShift Cluster on PowerVS from within another OpenShift, running the setup from a pod.

Step 0: PowerVS Preparation Checklist

NOTE: Details about the checklist steps can be found here.

Step 1: Get OpenShift Secret

  1. Create an account at RedHat portal
  2. Go to bit.ly/ocp-secrets and copy the pull secret.
  3. Paste the secret in the ocp-secrets file:
cluster-configuration/ocp-secrets

Step 2: Configure the Variables

Set the required variables by setting its values in the following files

cluster-configuration/ocp-variables

NOTE: you can use the PowerVS Actions to get the necessary information to fill in the variables.

The variables you need to set are the following:

  IBMCLOUD_API_KEY=
  IBMCLOUD_REGION=
  IBMCLOUD_ZONE=
  POWERVS_INSTANCE_ID=
  BASTION_IMAGE_NAME=
  RHCOS_IMAGE_NAME=
  PROCESSOR_TYPE=
  SYSTEM_TYPE=
  PRIVATE_NETWORK_NAME=
  CLUSTER_DOMAIN=
  STORAGE_CLASS_NAME=
  PVC_SIZE=

In you need to set a proxy for the application running from within the pod, add the following variables (you can set the same value for both):

  HTTP_PROXY=
  HTTPS_PROXY=

You can get the proxy information set as part of your cluster using:

  oc get proxy/cluster -o template --template {{.spec.httpProxy}}
  oc get proxy/cluster -o template --template {{.spec.httpsProxy}}

IMPORTANT: if you are using a RHEL image for the bastion, you must add the following variables and its respectives values in the aforementioned variables file:

  RHEL_SUBS_USERNAME=
  RHEL_SUBS_PASSWORD=

NOTE: Red Hat business partners who have signed a partner agreement are eligible to receive limited quantities of free Not for Resales (NFR) software subscriptions as benefits of participating in partner programs.

Step 3: Create a new cluster

ACTION=apply; OCP_VERSION=4.6; NEW_CLUSTER=$(./deploy.sh $ACTION $OCP_VERSION); \
cd ./clusters/$NEW_CLUSTER; \
oc new-project $NEW_CLUSTER --description="OCP Cluster on PowerVS" \
--display-name="OCP on PowerVS - $NEW_CLUSTER"; \
oc create -f ./secret.yaml; \
oc create -f ./pvc.yaml; \
oc create -f ./ocp-cluster.yaml

Step 4: Destroy a cluster

CLUSTER_ID=<SET ME>
ACTION=destroy; CLUSTER=$CLUSTER_ID; \
./deploy.sh $ACTION $CLUSTER; \
cd ./clusters/$CLUSTER_ID; \
oc delete -f ./ocp-cluster.yaml; \
oc create -f ./ocp-cluster.yaml; \
oc delete -f ./secret.yaml; \
oc delete -f ./pvc.yaml; \
oc delete project $CLUSTER_ID

Example:

# tree -L 2
.
|-- ocp-46-20210112-104034-b16efae55f
    |-- ocp-cluster.yaml
    |-- pvc.yaml
    `-- secret.yaml
`-- ocp-46-20210112-104320-cebd1c0900
    |-- ocp-cluster.yaml
    |-- pvc.yaml
    `-- secret.yaml

CLUSTER_ID=ocp-46-20210112-104034-b16efae55f

ACTION=destroy; CLUSTER=$CLUSTER_ID; \
./deploy.sh $ACTION $CLUSTER; \
cd ./clusters/$CLUSTER_ID; \
oc delete -f ./ocp-cluster.yaml; \ 	# deletes the first deployment, which created the cluster.
oc create -f ./ocp-cluster.yaml; \ 	# deploys a new pod to delete the cluster.
oc delete -f ./secret.yaml; \		# deletes the secrets created
oc delete -f ./pvc.yaml; \ 		# deletes the PVC allocated (you can ignore this step)
oc delete project $CLUSTER_ID		# deletes the project create for deploying this cluster