Does the 'readonly' field in a config field support templating?

Problem to Solve:

I am working on a KOTS application and there is a Config Field that I want the user to only set it upon initial install. Anytime after that, the field will be read-only.

I tried to use the readonly field along with some templating but is not working. Here are some things I have tried:

readonly: repl{{ gt Sequence 1 }}
readonly: '{{repl gt Sequence 1 }}'

To make sure it wasn’t the ‘greater than’ function, I also tried with eq:

readonly: repl{{ eq Sequence 1 }}
readonly: '{{repl eq Sequence 1 }}'

I have also tried adding |ParseBool but also does not work. I also tried using double quotes but no luck. I get the following error from the linter:

RULE                 TYPE     FILENAME                      LINE    MESSAGE
config-is-invalid    error    manifests/kots-config.yaml                failed to decode config content: json: cannot unmarshal string into Go struct field ConfigItem.spec.groups.items.readonly of type bool    
Error: lint yaml: One or more errors of severity "error" or higher were found```
1 Like

It does not support templating there. I think you have an internal story #48635 for that as an FR. We’d like to see it, too, if you can push on it!

That feature request is for templating the required field, but we’ve noticed lots of requests about templating various fields—whether it’s possible, and if not, whether we can make it possible.

We now have two new stories open. 1) To document which fields can be templated. That at least helps people understand whether it’s possible, so that they don’t have to ask or test. 2) To make all fields template-able that can reasonably be templated. I’d like to get the docs done ASAP. I don’t have a firm timeline for templating more fields, but it’s something we’d like to do sooner than later.