Skip to content
Create Placement Policy

Create Placement Policy

Placement policies control how DCM decides which environment agent should handle a catalog item instance. Policies are written in Rego, the policy language used by Open Policy Agent (OPA). Each policy can accept or reject a placement request and optionally select a specific agent.

Policies have a priority — lower values are evaluated first.

Define the Policy

Create a file called kubevirt-policy.yaml with the following content:

display_name: local-agent
policy_type: GLOBAL
priority: 1
rego_code: |
  package local

  main := {
   "rejected": false,
   "selected_agent": "local-agent"
  }

This policy:

  • Has the highest priority (1)
  • Always selects local-agent as the target agent
  • Never rejects a request (rejected: false)

Note: The selected_agent value must match the name the environment agent registered under. The compose stack defaults to local-agent (AGENT_NAME in .env). Verify with curl http://localhost:8080/api/v1alpha1/agents | jq.

Create the Policy

dcm policy create --from-file kubevirt-policy.yaml

Verify the Policy

dcm policy list

You can also view a specific policy in YAML format:

dcm policy get <POLICY_ID> -o yaml