- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
02-03-2021 03:59 AM
I have multiple kubernetes clusters ; however when running a REGO script with the open policy agent how do i only run the policy against the cluster i want..
https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin-compute/access_control/open...
q1) Is this done in the REGO script itself (see below) ..eg "if cluster == XXX" etc
q2) Would this be done in the Prisma cloud UI ( i cannot see any where to mark a OPA policy as run on particular cluster etc )
# pseudo code.. How do i only run this policy on the cluster i care about
if CLUSTER == "XXXX"
{
repo := "foobar"
deny[msg] {
some i
input.request.kind.kind == "Pod"
image := input.request.object.spec.containers[i].image
not startswith(image, repo)
msg := sprintf("Image '%s' comes from untrusted registry use '%s'",[image,repo])
}
The UI - shows no setting to only run this policy against a particular cluster ..
08-12-2022 07:30 AM
Greetings SCullum,
I hope that this note finds you well! I know that it has been a while since you had posted this question but I wanted to see if you still potentially needed any help. Thank you for your time and I hope that you have a good remainder of your day.
Kind Regards,
J. Avery King
06-16-2023 02:46 PM
Hello, I am not OP but I do have the same question. I want to apply the folowing policy only to one cluster:
match[{"msg": msg}] {
input.request.operation == "CREATE"
input.request.object.metadata.namespace == "default"
msg := "It's not allowed to create resources in the Default Namespace"
}
How could I be able to do this?
Thank you for your help
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!