Conditional block in manifest

Hello,

I have a config field for CPU limit, and I want to include the CPU limit in my Deployment manifest only if the field has a value. I tried the following in the deployment manifest since I read in the documentation that the full Go templating library is supported:

    resources:
      requests:
        cpu: 50m
        memory: 500Mi
      {{ if repl ConfigOption "cpu_limit" }}
      limits:
          cpu: repl {{ ConfigOption "cpu_limit" }}
          #memory: 500Mi
      {{ end}}

But I get the following error at lint:

$ replicated release lint --app "gitguardian-seal" --yaml-dir manifests
RULE            TYPE     FILENAME                         LINE    MESSAGE
invalid-yaml    error    manifests/app-deployment.yaml    133     yaml: line 133: could not find expected ':'    
Error: One or more errors of severity "error" or higher were found

I believe that using something like repl if only really works if you use it for the value of a key, not an entire block of a manifest. There is an example of using this here.

While maybe not the ideal solution, you could instead have two manifests, one with the limits and one without. Then use the kots.io/when label annotation (example here ) to only deploy the one based on the config option.