appsTemplates and multiple desired state files
Hello. First of all congratulations for your work. This project is really very nice.
I would like to being able to define appsTemplates in one DSF and use them in other DSF. But, I'm getting this error:
$ helmsman -debug -subst-env-values -f main.yaml -f teleport.yaml
_ _
| | | |
| |__ ___| |_ __ ___ ___ _ __ ___ __ _ _ __
| '_ \ / _ \ | '_ ` _ \/ __| '_ ` _ \ / _` | '_ \
| | | | __/ | | | | | \__ \ | | | | | (_| | | | |
|_| |_|\___|_|_| |_| |_|___/_| |_| |_|\__,_|_| |_| version: v3.0.0
A Helm-Charts-as-Code tool.
2020-01-19 13:57:20 DEBUG: helm version --short -c
2020-01-19 13:57:20 DEBUG: kubectl version --client --short
2020-01-19 13:57:20 DEBUG: kubectl
2020-01-19 13:57:21 DEBUG: helm
2020-01-19 13:57:21 DEBUG: helm plugin list
2020-01-19 13:57:21 INFO: Parsed YAML [[ main.yaml ]] successfully and found [ 0 ] apps
2020-01-19 13:57:21 CRITICAL: yaml: unknown anchor 'defaults' referenced
This is the content of main.yaml:
helmRepos:
my: "s3://my.s3.helm.repo"
appsTemplates:
defaults: &defaults
wait: true
helmFlags:
- "--atomic"
This is the content of teleport.yaml:
namespaces:
teleport:
apps:
teleport:
name: "teleport"
<<: *defaults
namespace: "teleport"
enabled: $TELEPORT_ENABLED
chart: "my/teleport"
version: "$TELEPORT_VERSION"
protected: $TELEPORT_PROTECTION
valuesFile: "values/teleport.yaml"
Is it a helmsman's well know behavior or a bug or mergo limitation?
Hi @galindro,
appsTemplates was not introduced with such mergo tool in mind back then. Since I'm not familiarise with mergo, I can only tell that an anchor of &defaults in YAML can be referenced only in the same YAML file it was originally defined. So your specific use case is that you're having more than one DSF (which are not standalone) and you are merging them into one before running Helmsman with final file?
Hi @mkubaczyk Actually I'm not merging them before execute helmsman. I'm just using helmsman multiple DSF feature. Therefore, what I'm trying to do is to reuse the a defined appsTemplates that lives in one DSF among multiple DSFs.
appsTemplates is actually ignored by Helmsman and that's why it doesn't get merged. But I'm also not sure if it would make any difference, merging happens after unmarshelling and the anchors and aliases are handled during unmarshaling. I think this is more like a yaml limitation.
This issue has been marked stale due to an inactivity.