title: How to use Lookup function in Helm Chart
body: <p>While deploying a Kubernetes application, I want to check if a particular PodSecurityPolicy exists, and if it does then skip installing it again.
  I came across the <a href="https://helm.sh/docs/chart_template_guide/functions_and_pipelines/#using-the-lookup-function" rel="noreferrer">helm lookup function</a>, which allows us to check the existing K8 resources.
  While I understand how to use this function to get all the resources of same kind, how do I use this function to check if a PodSecurityPolicy named &quot;myPodSecurityPolicy&quot; exists.</p>
  <p>I tried something like this:</p>
  <pre><code>{{- if ne (lookup &quot;v1&quot; &quot;PodSecurityPolicy&quot; &quot;&quot; &quot;&quot;) &quot;myPodSecurityPolicy&quot;}}
  &lt;do my stuff&gt;
  
  {{- end }}
  </code></pre>
  <p>But it doesn't look like I can compare it this way, seeing an error -</p>
  <pre><code>error calling ne: invalid type for comparison
  </code></pre>
  <p>Any inputs? Thanks in advance.</p>