OPA (Open Policy Agent) Evaluate

OPA (Open Policy Agent) Evaluate

Certified
Enterprise Edition

Evaluate a policy decision with OPA

Calls OPA Data API at /v1/data/{path} with optional input to compute a decision. Metrics and explain traces are optional; metrics default to false.

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

Evaluate an OPA policy

yaml
id: check_policy
namespace: company.team

tasks:
  - id: check_policy
    type: io.kestra.plugin.ee.opa.policy.Evaluate
    url: "{{ secret('OPA_URL') }}"
    token: "{{ secret('OPA_TOKEN') }}"
    policyPath: "kubernetes/admission"
    input:
      request:
        operation: "CREATE"
        kind: "Deployment"
        object:
          metadata:
            name: "nginx-deployment"
            namespace: "production"
          spec:
            replicas: 3
            template:
              spec:
                containers:
                  - name: "nginx"
                    image: "nginx:1.21"
                    securityContext:
                      runAsNonRoot: true
                      readOnlyRootFilesystem: true
    metrics: true
    explain: "notes"
Properties

Policy path

Path relative to /v1/data (do not prefix with data/).

OPA base URL

Explain

Return query explanation in addition to result. Allowed values: notes, fails, full, debug.

Input document

JSON input document rendered with flow variables and sent as input.

Enable metrics

Return query performance metrics; defaults to false.

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

Bearer token

Decision ID

OPA decision_id, if decision logging is enabled

Whether the result is defined

True if OPA returned a result field

Raw OPA response

Full response returned by OPA Data API

Policy result

Value of the 'result' field if present, otherwise null