numaproj-labs / numaplane

Apache License 2.0
1 stars 5 forks source link

Templating capability #122

Open juliev0 opened 4 months ago

juliev0 commented 4 months ago

Summary

Similar to ArgoCD, we plan to add the capability of a "generator" which will be able to create key/value pairs to pass into a spec that uses templating in the form of {{....}}.

This will likely be used by both the Controller for parsing the GitSyncSet definitions across clusters, as well as by the Agent within its ConfigMap.

To that end, we first need the capability of passing a map of key/value pairs into a string of text which contains templates denoted by double curly braces surrounding keys, and producing a result string where the double curly braces have been replaced by the keys' values.

Example: Inputs:

  1. Map: "cluster"-> "staging-usw2-k8s", "hostname" -> "numaflow.ipmsaasppdusw2.iks2.a.intuit.com"
  2. String:
    My cluster's name is {{cluster}}
    and you can get to its site at {{hostname}}

Output:

My cluster's name is staging-usw2-k8s
and you can get to its site at numaflow.ipmsaasppdusw2.iks2.a.intuit.com

Use Cases

When would you use this?


Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

juliev0 commented 4 months ago

We can decide whether we are fine with just simple templating (i.e. find and replace), or if we want something fancier to evaluate expressions - ArgoCD offers multiple possibilities, which we probably don't need but it's here for reference.

Note that Argo Workflows even has code that does a simple find and replace...