OPA multiple default rules error when loaded into config-map

28 views Asked by At

I'm following OPA deployment to kubernetes article.
I try to load a different policy though, from the REGO playground. this is an official policy example so the syntax supposed to be impeccable.
Using the command:

kubectl create configmap example-policy --from-file example.rego

I load the example.rego file:

package app.rbac

import rego.v1

default allow := false

allow if user_is_admin

allow if {
    some grant in user_is_granted

    input.action == grant.action
    input.type == grant.type
}

user_is_admin if "admin" in data.user_roles[input.user]

user_is_granted contains grant if {
    some role in data.user_roles[input.user]

    some grant in data.role_grants[role]
}

and get the error from opa docker image:

example.rego:5: rego_type_error: multiple default rules data.app.rbac.allow found

The same file works when I run OPA as server on my local machine...
Any idea?

0

There are 0 answers