This repo is made to serve as a bootstrap for OpenAD models that run inference on OpenShift. It implements many templates that can take a project and have it running on Openshift in minutes.
Install all Helmfile dependencies:
helmfile initIn your project root run the install wizard
check out the install script here
curl -sSL https://ibm.biz/BdG3Ab | bashA few defaults have already been configured for serving models in openad but configure as you wish.
There are two ways to configure a private repo: using an SSH key or a Personal Access Token (PAT). For detailed examples of Dockerfiles that handle these authentication methods, see the Dockerfile Examples documentation.
Create ssh key secret my-ssh-privatekey-name (create a unique name).
oc create secret generic my-ssh-privatekey-name \
--from-file=ssh-privatekey=$HOME/.ssh/YOUR_PRIVATE_SSH_KEY_HERE \
--type=kubernetes.io/ssh-authThis secret will be mounted into the build container at /root/.ssh/ssh-privatekey.
Grant Access to the Builder Service Account for the Secret
oc secrets link builder my-ssh-privatekey-nameUpdate the buildConfig.sourceSecret.name in your values file to match the name of the secret you just created (e.g., my-ssh-privatekey-name).
check out an example Dockerfile here
buildConfig:
...
sourceSecret:
type: ssh
name: my-ssh-privatekey-nameCreate auth secret github-credentials from github token.
oc create secret generic github-credentials \
--from-literal=username=__token__ \
--from-literal=password=<your-token> \
--type=kubernetes.io/basic-authUpdate the buildConfig.sourceSecret.name in your values file to match the name of the secret you just created (e.g., github-credentials).
check out an example Dockerfile here
buildConfig:
strategy: Docker
dockerfilePath: openshift/Dockerfile.openshift
sourceSecret: # Secret containing the credentials
type: pat # "ssh" or "pat"
name: github-credentialsThis Helm chart can be configured to create a PersistentVolumeClaim (PVC) for storing data. Please refer to the storage section in helm/values.yaml for configuration options.
Important Note: When you create a PVC with this chart, it will not be deleted when you uninstall the Helm release. This is to prevent accidental data loss. You must manually delete the PVC if you no longer need the data.
When deploymentType is set to build, the buildConfig.gitRef determines which version of your code is built. The strategy you choose depends on your environment.
It is strongly recommended to use Git tags (e.g., v1.0.0) for production builds. This ensures that your deployments are predictable, consistent, and tied to a specific, immutable version of your code.
buildConfig:
gitRef: "v1.0.0" # <-- Recommended for productionUsing a branch name (e.g., main or develop) is suitable for development or continuous integration workflows. This allows you to automatically build and deploy the latest code from a branch. This template includes an optional trigger-build-job.yaml that can be enabled in values.yaml. When used with ArgoCD, this job will automatically start a new build after every sync, which is ideal for tracking a branch.
buildConfig:
gitRef: "main" # <-- Suitable for development/CIThis template can be used with ArgoCD to manage deployments.
Before deploying with ArgoCD, you need to grant the necessary permissions.
Grant ArgoCD Permissions
The ArgoCD application controller needs permissions to manage resources in your target namespace (e.g., openad-models).
oc adm policy add-role-to-user edit \
-n openad-models \
system:serviceaccount:openshift-gitops:openshift-gitops-argocd-application-controllerGrant Service Account Permissions
If your application includes jobs or builds that run under a service account (like the default service account), it may also need permissions.
oc adm policy add-role-to-user edit -n openad-models -z defaultAfter running the install wizard, an ArgoCD Application manifest will be created at charts/argocd/application.yaml.
To deploy your application, apply this manifest to your cluster:
oc apply -f charts/argocd/application.yamlArgoCD will then pick up this application and deploy the Helm chart based on the configuration.
Install the Helm Chart
helmfile -f charts/helmfile.yaml applyStart a new build to have running deployment
oc start-build RELEASE_NAMEWhen building on OpenShift, passing SSH keys to the build process requires a different approach than local Docker builds. Instead of using build arguments, OpenShift mounts the SSH key from a secret directly into the build container at /root/.ssh/ssh-privatekey.
For a working example of how to handle this, please refer to the openshift-ssh.Dockerfile. This example shows how to add the mounted SSH key to the ssh-agent, allowing you to securely clone private repositories during the build.