OPA (Open Policy Agent) Upload

OPA (Open Policy Agent) Upload

Certified
Enterprise Edition

Upload or replace an OPA policy

PUTs a Rego module to /v1/policies/{id}; overwrites existing content. Sends source as text/plain.

yaml
type: io.kestra.plugin.ee.opa.policy.Upload

Upload an OPA policy

yaml
id: upload_policy
namespace: company.team

tasks:
  - id: upload_policy
    type: io.kestra.plugin.ee.opa.policy.Upload
    url: "{{ secret('OPA_URL') }}"
    token: "{{ secret('OPA_TOKEN') }}"
    policyId: "kubernetes-admission"
    policy: |
      package kubernetes.admission

      deny contains msg if {
        input.request.kind == "Deployment"
        not input.request.object.spec.template.spec.securityContext.runAsNonRoot
        msg := "Containers must not run as root"
      }

      deny contains msg if {
        input.request.kind == "Deployment"
        input.request.object.spec.replicas > 10
        input.request.namespace != "production"
        msg := "Non-production deployments cannot exceed 10 replicas"
      }
Properties

Policy source

Rego policy source code to create or update.

Policy ID

Unique identifier of the policy module in OPA.

OPA base URL

Reference (ref) of the pluginDefaults to apply to this task.

Bearer token