When running a REGO script with the open policy agent OPA how do i only specify the kubernetes cluster to run against

cancel
Showing results for 
Search instead for 
Did you mean: 

When running a REGO script with the open policy agent OPA how do i only specify the kubernetes cluster to run against

L0 Member

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 ..

image.png

0 REPLIES 0
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!