Configure the OPA agent
Enable console decision logs for a diagnostic workload. Retain your real authorization modules in production, and mask sensitive request data before sending decision logs to shared storage.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshOPA
metadata:
name: opa-decision-logs
namespace: kong-mesh-demo
labels:
kuma.io/mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
default:
agentConfig:
type: InsecureInline
insecureInline:
value: |
decision_logs:
console: true
appendPolicies:
- rego:
type: InsecureInline
insecureInline:
value: |
package diagnostics.allow_all
default allow = trueCopied!
type: MeshOPA
name: opa-decision-logs
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
default:
agentConfig:
type: InsecureInline
insecureInline:
value: |
decision_logs:
console: true
appendPolicies:
- rego:
type: InsecureInline
insecureInline:
value: |
package diagnostics.allow_all
default allow = trueCopied!
Adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_opa" "opa_decision_logs" {
provider = konnect-beta
type = "MeshOPA"
name = "opa-decision-logs"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "backend"
}
}
default = {
agent_config = {
type = "InsecureInline"
insecure_inline = {
value = <<-EOT
decision_logs:
console: true
EOT
}
}
append_policies = [
{
rego = {
type = "InsecureInline"
insecure_inline = {
value = <<-EOT
package diagnostics.allow_all
default allow = true
EOT
}
}
}
]
}
}
labels = {
"kuma.io/mesh" = konnect_mesh.my_mesh.name
}
cp_id = konnect_mesh_control_plane.my_meshcontrolplane.id
mesh = konnect_mesh.my_mesh.name
}
Copied!