> For the complete documentation index, see [llms.txt](https://run-ai-docs.nvidia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://run-ai-docs.nvidia.com/saas/platform-management/policies/supported-workload-type-policies/policy-yaml-examples-supported.md).

# Policy YAML Examples

This page provides YAML examples for supported workload type policies. These policies use a flat `rules` array where each rule specifies the field to control, the spec selector that identifies which part of the workload spec the rule applies to, and one or more enforcements.

For a description of all rule components, see [Supported workload type policies](/saas/platform-management/policies/supported-workload-type-policies.md).

## Rule Structure

```yaml
rules:
  - field: <field-name>
    specSelector: <spec-selector>
    itemSelector: <item-selector>    # optional; only for list-type fields
    selectorParams:                   # optional; required by some selectors
      <param>: <value>
    enforcements:
      - <enforcement-type>: <value>
```

## Deployment: Container Security Baseline

Requires an image on all containers, blocks privilege escalation, and caps CPU and memory limits.

```yaml
rules:
  - field: image
    specSelector: allContainers
    enforcements:
      - required: true
  - field: allowPrivilegeEscalation
    specSelector: allContainers
    enforcements:
      - set:
          value: false
  - field: resourceLimits
    specSelector: allContainers
    enforcements:
      - set:
          key: cpu
          value: "2"
      - set:
          key: memory
          value: "4Gi"
```

## PyTorchJob: Distributed Training Guardrails

Sets resource limits across all containers, pins the master replica count to 1, restricts the worker replica range, and limits retries on the job.

```yaml
rules:
  - field: resourceLimits
    specSelector: allContainers
    enforcements:
      - set:
          key: cpu
          value: "4"
      - set:
          key: memory
          value: "8Gi"
  - field: replicas
    specSelector: masterReplicaSpec
    enforcements:
      - set:
          value: 1
  - field: replicas
    specSelector: workerReplicaSpec
    enforcements:
      - range:
          min: 1
          max: 8
  - field: runPolicy-BackoffLimit
    specSelector: workloadSpec
    enforcements:
      - set:
          value: 3
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://run-ai-docs.nvidia.com/saas/platform-management/policies/supported-workload-type-policies/policy-yaml-examples-supported.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
