Open scottd018 opened 3 years ago
Yeah - I can see how this will be essential in many cases. I'm wondering if we can just use go string formatting to provide prefix, suffix and other options.
@lander2k2 yeah, i think as simple as possible is probably better. The goal being to avoid a complete turn towards templating and provide simple use cases only.
suggestion: we could do something like:
# +operator-builder:field:name=test,type=string,replace=testvalue, replaceWith="$0-dev"
option: testvalue
One common pattern that we see is needing the ability to inject a value, but add a prefix or suffix:
Example 1 Prepend (cert-manager - truncated):
In this example, my namespace is configurable, however I need to append a value to something that is configurable (e.g. security-system + /cert-manager-webhook-ca, where security-system is configured by the marker
certManagerWebhookResourceName
).Example 2 Append (metallb) - truncated:
In this example, my label is configurable, however I need to prepend a value to something that is configurable (e.g. app= + metallb, where metallb is configured by the marker
resourceName
).Proposal:
prefix
andsuffix
fields to the markers.Prefix Example Input:
Prefix Example Output (pseudo-code, showing the variable injection):
Suffix Example Input:
Suffix Example Output (pseudo-code, showing the variable injection):