Group Templates#

Group templates define arbitrary Kubernetes resources that OSMO creates alongside each workflow task group. Unlike pod templates, which configure the pod spec for individual tasks, group templates deploy namespace-scoped resources—such as ComputeDomains or ConfigMaps—that the group’s pods depend on. Resources are scoped to the namespace in which the workflow runs.

Why Use Group Templates?#

Group templates extend OSMO’s scheduling capabilities by allowing you to provision supporting Kubernetes resources alongside workflow task groups:

Provision Shared Group Resources

Create ConfigMaps, Secrets, or other namespace-scoped resources that all tasks in a group share.

Support Custom CRDs

Deploy any Kubernetes custom resource your backend requires without modifying OSMO’s core scheduling logic.

Maintain Consistent Cleanup

OSMO records which resource types were created and cleans them up when the group finishes, regardless of pool config changes.

How It Works#

Resource Creation Flow#

1. Define Templates 📋

Create named Kubernetes manifests

2. Reference in Pools 🔗

Attach to pools

3. Merge Templates 🔄

Combine specifications

4. Create Resources

Resources created before pods

Template Structure#

Group templates are full Kubernetes manifests. They must include apiVersion, kind, and metadata.name. The metadata.namespace field must be omitted—OSMO assigns the namespace at runtime.

{
  "template_name": {
    "apiVersion": "resource.nvidia.com/v1beta1",
    "kind": "ComputeDomain",
    "metadata": {
      "name": "compute-domain-{{WF_GROUP_UUID}}"
    },
    "spec": {
      "numNodes": 0,
      "channel": {
        "resourceClaimTemplate": {
          "name": "compute-domain-{{WF_GROUP_UUID}}-rct"
        }
      }
    }
  }
}

Note

Resource Name Uniqueness

Because multiple workflows may run in the same pool and namespace at the same time, resource names must be unique per group. Include {{WF_GROUP_UUID}} in metadata.name to ensure each group gets its own resource instance, as shown in the example above.

Key Features#

  • Variable Substitution: The same variables available in pod templates are resolved at runtime, except task-specific variables (such as task name and task UUID) which are not available at the group level.

  • Label Injection: OSMO automatically adds its standard labels (osmo.workflow_id, osmo.submitted_by, etc.) to each resource’s metadata.labels for tracking and cleanup.

  • Template Merging: Multiple templates that define the same resource (same apiVersion, kind, and metadata.name) are merged, with later templates overriding earlier ones.

  • Creation Order: Group template resources are created before the group’s pods, ensuring dependencies are satisfied.

Note

For detailed configuration fields and all available variables, see /api/configs/group_template in the API reference.

Practical Guide#