- Prerequisites
- Install the OpenShift GitOps operator
- Obtain an entitlement key
- Update the OCP global pull secret
- Adding Cloud Pak GitOps Application objects to your GitOps server
-
An OpenShift Container Platform cluster, version 4.6 or later.
The applications were tested on both managed and self-managed deployments.
-
Adequate worker node capacity in the cluster for the Cloud Paks to be installed.
Refer to the Cloud Pak documentation to determine the required capacity for the cluster.
-
Cluster storage configured with storage classes supporting both RWO and RWX storage.
The applications were tested with OpenShift Container Storage, Rook Ceph, and the built-in file storage in ROKS classic clusters.
-
From the Administrator's perspective, navigate to the OperatorHub page.
-
Search for "Red Hat OpenShift GitOps". Click on the tile and then click on "Install"
-
Keep the defaults in the wizard and click on "Install"
-
Wait for it to show up in the list of "Installed Operators." If it doesn't install correctly, you can check its status on the "Installed Operators" page in the
openshift-operatorsnamespace.
If you don't already have an entitlement key to the IBM Entitled Registry, obtain your key using the following instructions:
-
Go to the Container software library.
-
Click "Copy key."
-
Copy the entitlement key to a safe place so you can use it when updating the global pull secret for the cluster.
-
(Optional) Verify the validity of the key by logging in to the IBM Entitled Registry using a container tool:
docker login cp.icr.io --username cp --password entitlement_key
Update the OCP global pull secret with the entitlement key.
Keep in mind that the registry user for that secret is "cp". A common mistakes is to assume the registry user is the name or email of the user owning the entitlement key.
-
Navigate to the "Workloads > Secrets" page in the "Administrator" perspective.
-
Select the object "pull-secret".
-
Click on "Actions -> Edit secret".
-
Scroll to the bottom of that page and click on "Add credentials", using the following values for each field:
- "Registry Server Address" cp.icr.io
- "Username": cp
- "Password": paste the entitlement key you copied from the Obtain an entitlement key setp
- "Email": any email, valid or not, will work. This fields is mostly a hint to other people who may see the entry in the configuration
-
Click on "Save"
Updating the OCP global pull secret triggers the staggered restart of each node in the cluster. However, the Red Hat OpenShift on IBM Cloud platform requires an additional step: reload all workers nodes (in the case of ROKS classic clusters) or replace all workers nodes (in the case of ROKS VPC Gen2 clusters.)
You can perform the reloading or replacement of workers directly from the cluster page in the IBM Cloud console or use a terminal, following the instructions listed here.
Global pull secrets require granting too much priviledge to the OpenShift GitOps service account, so we have started to transition to the definition of pull secrets at a namespace level.
The Application resources are transitioning to use PreSync hooks to copy the entitlement key from a Secret named ibm-entitlement-key in the openshift-gitops namespace, so issue the following command to create that secret:
oc create secret docker-registry ibm-entitlement-key \
--docker-server=cp.icr.io \
--docker-username=cp \
--docker-password="${IBM_ENTITLEMENT_KEY:?}" \
--docker-email="non-existent-replace-with0-yours@email.com" \
--namespace=openshift-gitops
The instructions in this section assume you have administrative privileges to the cluster.
After completing the list of activities listed in the previous sections, you have the option of adding the Argo CD Application objects for a Cloud Pak using either the OpenShift Container Platform console or using commands in a terminal.
-
Launch the Argo CD console: Click on the grid-like icon in the upper-left section of the screen, where you should click on either "ArgoCD Console" (for OCP 4.6) or "Cluster Argo CD" (for OCP 4.7 and later.)
-
The Argo CD login screen will prompt you for an admin user and password. The default user is
admin .The admin password is located in a secret in theopenshift-gitopsnamespace.-
The secret name is either
argocd-cluster-cluster(for OCP 4.6) oropenshift-gitops-cluster(for OCP 4.7 and later.) -
Switch to the
openshift-gitopsproject, locate the secret in the "Workloads -> Secrets" selections in the left-navigation tree of the Administrator view, scroll to the bottom, and click on "Reveal Values" to retrieve the value of theadmin.passwordfield. -
Type in the user and password listed in the previous steps, and then click the "Sign In" button.
-
-
(add Argo app) Once logged to the Argo CD console, click on the "New App+" button in the upper left of the Argo CD console and fill out the form with values matching the Cloud Pak of your choice, according to the table below:
For all other fields, use the following values:
Field Value Application Name argo-app Path (OCP 4.6) config/argocd Path (OCP 4.7 and later) config/argocd-ga Namespace openshift-gitops Project default Sync policy Automatic Self Heal true Repository URL https://github.com/IBM/cloudpak-gitops Revision HEAD Cluster URL https://kubernetes.default.svc -
(add Cloud Pak Shared app) Click on the "New App+" button again and fill out the form with values matching the Cloud Pak of your choice, according to the table below:
For all other fields, use the following values:
Field Value Application Name cp-shared-app Path config/argocd-cloudpaks/cp-shared Namespace ibm-cloudpaks Project default Sync policy Automatic Self Heal true Repository URL https://github.com/IBM/cloudpak-gitops Revision HEAD Cluster URL https://kubernetes.default.svc -
Under "Parameters", if using OCP 4.6, replace the value of the field
serviceaccount.argocd_application_controllerwith the valueargocd-cluster-argocd-application-controller. -
After filling out the form details, click the "Create" button
-
(add actual Cloud Pak) Click on the "New App+" button again and fill out the form with values matching the Cloud Pak of your choice, according to the table below:
Cloud Pak Application Name Path Namespace Business Automation cp4a-app config/argocd-cloudpaks/cp4a cp4a Integration Automation cp4i-app config/argocd-cloudpaks/cp4i cp4i AIOps Automation cp4aiops-app config/argocd-cloudpaks/cp4aiops openshift-operators For all other fields, use the following values:
Field Value Project default Sync policy Automatic Self Heal true Repository URL https://github.com/IBM/cloudpak-gitops Revision HEAD Cluster URL https://kubernetes.default.svc -
After filling out the form details, click the "Create" button
-
Under "Parameters", if using OCP 4.6, replace the value of the field
serviceaccount.argocd_application_controllerwith the valueargocd-cluster-argocd-application-controller. -
Still under "Parameters", set the values for the fields
storageclass.rwoandstorageclass.rwxwith the appropriate storage classes. For OpenShift Container Storage, the values will beocs-storagecluster-ceph-rbdandocs-storagecluster-cephfs, respectively. -
After filling out the form details, click the "Create" button
-
Wait for the synchronization to complete.
-
Enable auto-synchronization for the applications automatically created by the previous steps
-
For instance, if adding the "cp4a-app" application, it will automatically create two new applications, "cp4a-operators" and "cp4a-resources". The only exception is the "cp-shared-app" application, which does not bring in a "resources" application.
-
Click on the first application, such as "cp4a-operators", then select "App Details."
-
Scroll down to "Sync Policy" and select "Enable Auto-Sync."
-
Leave "Prune Resources" disabled
-
Enable "Self Heal" (this is required for some synchronizations where the first pass grants extra permissions to the Argo CD service account and the subsequent passes succeed with the extra permissions)
-
Exit the panel and wait for the synchronization to complete, then repeat the steps for the next application, which in this example would be "cp4a-resources".
-
-
Open a terminal and ensure you have the OpenShift CLI installed:
oc version --client # Client Version: 4.8.2Ideally, the client's minor version should not be more than one iteration behind the version of the server. Most commands here are pretty basic and will work with more significant differences, but keep that in mind if you see errors about unrecognized commands and parameters.
If you do not have the CLI installed, follow these instructions.
-
Log in to the Argo CD server
Using OCP 4.6:
# OCP 4.6 argo_route=argocd-cluster-server argo_secret=argocd-cluster-cluster sa_account=argocd-cluster-argocd-application-controller argo_pwd=$(oc get secret ${argo_secret} \ -n openshift-gitops \ -o jsonpath='{.data.admin\.password}' | base64 -d ; echo ) \ && argo_url=$(oc get route ${argo_route} \ -n openshift-gitops \ -o jsonpath='{.spec.host}') \ && argocd login "${argo_url}" \ --username admin \ --password "${argo_pwd}" \ --insecure
Using OCP 4.7 and later (the object names change a little from OCP 4.6:)
# OCP 4.7+ argo_route=openshift-gitops-server argo_secret=openshift-gitops-cluster sa_account=openshift-gitops-argocd-application-controller argo_pwd=$(oc get secret ${argo_secret} \ -n openshift-gitops \ -o jsonpath='{.data.admin\.password}' | base64 -d ; echo ) \ && argo_url=$(oc get route ${argo_route} \ -n openshift-gitops \ -o jsonpath='{.spec.host}') \ && argocd login "${argo_url}" \ --username admin \ --password "${argo_pwd}" \ --insecure
-
Add the
argoapplication. (this step assumes you still have the shell variables assigned from previous steps) :Using OCP 4.6:
# OCP 4.6 argocd app create argo-app \ --project default \ --dest-namespace openshift-gitops \ --dest-server https://kubernetes.default.svc \ --repo https://github.com/IBM/cloudpak-gitops \ --path config/argocd \ --sync-policy automated \ --revision main \ --upsertUsing OCP 4.7 and later (the object names change a little from OCP 4.6:)
# OCP 4.7+ argocd app create argo-app \ --project default \ --dest-namespace openshift-gitops \ --dest-server https://kubernetes.default.svc \ --repo https://github.com/IBM/cloudpak-gitops \ --path config/argocd-ga \ --helm-set-string serviceaccount.argocd_application_controller=${sa_account} \ --sync-policy automated \ --revision main \ --upsert
-
Add the
cp-sharedapplication. (this step assumes you still have the shell variables assigned from previous steps) :argocd app create cp-shared-app \ --project default \ --dest-namespace openshift-gitops \ --dest-server https://kubernetes.default.svc \ --repo https://github.com/IBM/cloudpak-gitops \ --path config/argocd-cloudpaks/cp-shared \ --helm-set-string serviceaccount.argocd_application_controller=${sa_account} \ --sync-policy automated \ --revision main \ --upsert -
Add the respective Cloud Pak application (this step assumes you still have shell variables assigned from previous steps) :
# appname=<< choose a value from the "Application Name" column in the # table of Cloud Paks above, such as cp4a-app, cp4i-app, # cp4aiops-app, etc >> cp=cp4i app_name=${cp}-app # app_path=<< choose the respective value from the "path Name" # column in the table of Cloud Paks above, such as # config/argocd-cloudpaks/cp4i/cp4a, config/argocd-cloudpaks/cp4i, # etc app_path=config/argocd-cloudpaks/${cp} cp_namespace=ibm-cloudpaks gitops_branch=main argocd app create "${app_name}" \ --project default \ --dest-namespace openshift-gitops \ --dest-server https://kubernetes.default.svc \ --helm-set-string metadata.argocd_app_namespace="${cp_namespace}" \ --helm-set-string repoURL=https://github.com/IBM/cloudpak-gitops \ --helm-set-string serviceaccount.argocd_application_controller=${sa_account} \ --helm-set-string targetRevision="${gitops_branch}" \ --path "${app_path}" \ --repo https://github.com/IBM/cloudpak-gitops \ --revision "${gitops_branch}" \ --sync-policy automated \ --upsert argocd app wait "${app_name}"
-
Enable auto-synchronization for the apps automatically added by the previous step. The auto-synchronization is disabled by default in the repo if you want to further configure the applications before starting the synchronization. Note that this step assumes you still have shell variables assigned from previous steps:
argocd app set ${cp}-operators \ --sync-policy automated \ --self-heal argocd app wait ${cp}-operators \ --timeout 1200 argocd app set ${cp}-resources \ --sync-policy automated \ --self-heal argocd app wait ${cp}-resources \ --timeout 7200
-
List all the applications to see their overall status (this step assumes you still have shell variables assigned from previous steps):
argocd app list -l app.kubernetes.io/instance=${app_name}