<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: When running a REGO script with the open policy agent OPA how do i only specify the kubernetes cluster to run against in Cortex Cloud Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-cloud-discussions/when-running-a-rego-script-with-the-open-policy-agent-opa-how-do/m-p/546299#M967</link>
    <description>&lt;P&gt;Hello, I am not OP but I do have the same question. I want to apply the folowing policy only to one cluster:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;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"
}&lt;/LI-CODE&gt;
&lt;P&gt;How could I be able to do this?&lt;BR /&gt;&lt;BR /&gt;Thank you for your help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2023 21:46:53 GMT</pubDate>
    <dc:creator>NRojas1</dc:creator>
    <dc:date>2023-06-16T21:46:53Z</dc:date>
    <item>
      <title>When running a REGO script with the open policy agent OPA how do i only specify the kubernetes cluster to run against</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-cloud-discussions/when-running-a-rego-script-with-the-open-policy-agent-opa-how-do/m-p/383618#M355</link>
      <description>&lt;P&gt;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..&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin-compute/access_control/open_policy_agent.html" target="_blank"&gt;https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin-compute/access_control/open_policy_agent.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;q1) Is this done in the REGO script itself (see below) ..eg "if cluster == XXX" etc&lt;BR /&gt;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 )&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# 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])
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The UI - shows no setting to only run this policy against a particular cluster ..&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/29808i28C3B351989DEC19/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 11:59:18 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-cloud-discussions/when-running-a-rego-script-with-the-open-policy-agent-opa-how-do/m-p/383618#M355</guid>
      <dc:creator>SCullum</dc:creator>
      <dc:date>2021-02-03T11:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: When running a REGO script with the open policy agent OPA how do i only specify the kubernetes cluster to run against</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-cloud-discussions/when-running-a-rego-script-with-the-open-policy-agent-opa-how-do/m-p/511705#M597</link>
      <description>&lt;P&gt;Greetings SCullum,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards,&lt;/P&gt;
&lt;P&gt;J. Avery King&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 14:30:36 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-cloud-discussions/when-running-a-rego-script-with-the-open-policy-agent-opa-how-do/m-p/511705#M597</guid>
      <dc:creator>AKing9</dc:creator>
      <dc:date>2022-08-12T14:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: When running a REGO script with the open policy agent OPA how do i only specify the kubernetes cluster to run against</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-cloud-discussions/when-running-a-rego-script-with-the-open-policy-agent-opa-how-do/m-p/546299#M967</link>
      <description>&lt;P&gt;Hello, I am not OP but I do have the same question. I want to apply the folowing policy only to one cluster:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;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"
}&lt;/LI-CODE&gt;
&lt;P&gt;How could I be able to do this?&lt;BR /&gt;&lt;BR /&gt;Thank you for your help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 21:46:53 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-cloud-discussions/when-running-a-rego-script-with-the-open-policy-agent-opa-how-do/m-p/546299#M967</guid>
      <dc:creator>NRojas1</dc:creator>
      <dc:date>2023-06-16T21:46:53Z</dc:date>
    </item>
  </channel>
</rss>

