This directory contains Kubernetes manifests and tooling for deploying and managing courses on OpenShift AI (RHOAI) infrastructure.
The RHOAI deployment tools provide automated management of student notebooks, user groups, and resource allocation for course environments. These tools are designed to work with OpenShift AI and integrate with ColdFront for user provisioning.
All cronjobs run on a schedule (default schedule is hourly: 0 * * * *) and can be triggered manually using oc create job --from=cronjob/<name>.
Purpose: Synchronizes users with edit permissions in a namespace to an OpenShift group.
Use Case: Keep ColdFront-provisioned users in sync with OpenShift groups for RBAC and resource quotas.
Configuration:
GROUP_NAME: OpenShift group to sync users toNAMESPACE: Course namespace to watch for edit rolebindings
Deployment:
cd deployment/cronjobs/group-sync/
# Edit cronjob.yaml to set GROUP_NAME and NAMESPACE
# Edit kustomization.yaml to set target namespace
oc apply -k . --as system:adminManual Trigger:
oc create -n <namespace> job --from=cronjob/group-sync group-syncNotes:
- If deploying for multiple classes, update the clusterrolebinding name to avoid conflicts
- Users must have edit rolebinding in the specified namespace to be added to the group
Purpose: Automatically shuts down notebooks that exceed a runtime threshold to conserve resources.
Use Case: Prevent students from leaving notebooks running indefinitely, reducing cluster resource consumption.
Configuration:
GROUP_NAME: OpenShift group to apply culling to (only affects notebooks owned by group members)CUTOFF_TIME: Maximum runtime in seconds before shutdown (e.g.,43200for 12 hours)
Deployment:
cd deployment/cronjobs/nb-culler/
# Edit cronjob.yaml to set GROUP_NAME and CUTOFF_TIME
oc project rhods-notebooks
oc apply -k . --as system:adminManual Trigger:
oc create -n rhods-notebooks job --from=cronjob/nb-culler nb-cullerNotes:
- Only affects notebooks in
rhods-notebooksnamespace - Notebooks are shut down gracefully; PVCs persist
- Different cutoff times can be configured per group
Purpose: Synchronizes users across multiple namespaces to a single OpenShift group.
Use Case: Courses with multiple associated namespaces (e.g., dev, test, prod environments).
Configuration:
GROUP_NAME: OpenShift group to sync users toCLASS_NAME: Class identifier used to discover namespaces (e.g.,cs210)
Deployment:
cd deployment/cronjobs/multiple-ns-group-sync/
# Edit cronjob.yaml to set GROUP_NAME and CLASS_NAME
oc project <target-namespace>
oc apply -k . --as system:adminManual Trigger:
oc create -n <namespace> job --from=cronjob/multiple-ns-group-sync multiple-ns-group-syncPurpose: Mutating admission webhook that automatically adds nerc.mghpcc.org/class=<classname> labels to notebook pods based on user group membership.
Use Case: Enable class-specific resource quotas, gatekeeper policies, and monitoring by differentiating users of different classes in shared namespaces.
Prerequisites:
- Run
group-synccronjob first to populate OpenShift groups - Cert-manager installed for TLS certificate generation
Configuration:
- Edit
webhooks/assign-class-label/deployment.yaml:- Set
GROUPSenvironment variable to comma-separated list of OpenShift groups (e.g.,cs210,cs506,ds210)
- Set
- Update namespace in kustomization.yaml if deploying to new environment
Deployment:
cd deployment/webhooks/assign-class-label/
# Edit deployment.yaml to set GROUPS
oc apply -k . --as system:adminHow It Works:
- User launches a notebook in RHOAI
- Webhook intercepts pod creation request
- Checks user's group membership against configured GROUPS list
- Adds
nerc.mghpcc.org/class=<group>label to pod metadata - Pod is created with class label for downstream policy enforcement
Purpose: Automate setup of GPU resource classes and queues across course namespaces.
Use Case: Configure GPU access (V100, A100, H100) for ML/AI courses.
Deployment:
cd deployment/gpu-class/
./gpu-class-setup.sh <namespace>-
Create OpenShift Group:
cd deployment/cluster-scope/base/user.openshift.io/groups/ mkdir <course-name> # Create group.yaml (copy from existing group) oc apply -f <course-name>/group.yaml
-
Deploy Group Sync:
cd deployment/cronjobs/group-sync/ # Edit GROUP_NAME=<course-name>, NAMESPACE=<course-namespace> oc apply -k . --as system:admin
-
Deploy Notebook Culler:
cd deployment/cronjobs/nb-culler/ # Edit GROUP_NAME=<course-name>, CUTOFF_TIME=<seconds> oc apply -k . --as system:admin
-
Deploy Class Label Webhook:
cd deployment/webhooks/assign-class-label/ # Add <course-name> to GROUPS env variable in deployment.yaml oc apply -k . --as system:admin
TAs can retrieve notebook URLs for debugging or access verification:
# List all notebooks
oc get notebooks -n rhods-notebooks
# Get URL for specific notebook
cd scripts/
python get_url.py
# Enter notebook name when promptedRequirements: Install pyyaml first: pip install pyyaml
# List cronjobs
oc get cronjobs -n <namespace>
# View recent jobs
oc get jobs -n <namespace>
# View job logs
oc logs job/<job-name> -n <namespace># View webhook pods
oc get pods -n <webhook-namespace> -l app=assign-class-label
# View webhook logs
oc logs -n <webhook-namespace> -l app=assign-class-label -f
# Check webhook configuration
oc get mutatingwebhookconfiguration assign-class-label- Group sync not adding users: Verify users have
editrolebinding in target namespace - Webhook not labeling pods: Ensure user is in configured GROUPS and cert-manager is running
- Notebook culler not working: Check GROUP_NAME matches OpenShift group, verify CUTOFF_TIME is in seconds
RHOAI automation containers are located in ../containers/:
assign-class-label/: Flask webhook service (Python 3.12)group-sync/: OpenShift client automation (opf-toolbox base)
To rebuild containers, see individual Dockerfiles and deployment manifests.
| Variable | Used In | Description | Example |
|---|---|---|---|
GROUP_NAME |
All cronjobs | OpenShift group name | cs210 |
NAMESPACE |
group-sync | Namespace to watch | cs210-class |
CUTOFF_TIME |
nb-culler | Max runtime in seconds | 43200 (12 hours) |
CLASS_NAME |
multiple-ns-group-sync | Class identifier | cs210 |
GROUPS |
assign-class-label | Comma-separated groups | cs210,cs506,ds210 |
All deployments use Kustomize for configuration management:
kustomization.yaml
├── namespace: <target-namespace>
├── resources: [YAML files to deploy]
└── patchStrategicMerge: [optional patches]To customize for your environment, edit kustomization.yaml in each component directory.
- All cronjobs and webhooks require cluster-admin permissions (
--as system:admin) - RBAC manifests grant minimal required permissions (see
role.yaml,clusterrole.yamlin each component) - Webhook TLS certificates managed by cert-manager
- Sensitive values should be stored in Secrets (not committed to git)
- TA Access Guide: See
../content/contributor_guide/rhoai_ta_access.md - Container Build Guide: See
../containers/README.md - OPE Main Guide: See
../README.md
For issues, questions, or contributions:
- GitHub Issues: ope-project issues
- Original BU-RHOAI: BU-RHOAI repository