<p>I am trying to deploy a crd using kubectl. My CRD starts with something like</p>
<pre><code>{{- if and (eq .Values.realm &quot;aws&quot;) (.Values.crd) }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
</code></pre>
<p>This throws an error:</p>
<pre><code>error: error parsing ./charts/crds.yaml: json: offset 2: invalid character '{' looking for beginning of object key string

</code></pre>
<p>I am calling like this</p>
<pre><code>kubectl apply --kubeconfig=&quot;/tmp/target&quot; --namespace &quot;${NAMESPACE}&quot; -f ./charts/crds.yaml
</code></pre>
<p>Any idea how we can achieve this? I do this for other resources like deployment etc, and it doesn't have a problem.</p>

CSUNNY
<p>That is invalid YAML and looks like part of a template that should be processed, generating the actual YAML to be used.
It could be part of a helm chart deducing from the content expressions.</p>
<p>If you want to use it without helm, you need to remove all template expressions and might want to use an online YAML validator to assist.</p>
