gomplate throw error "map has no entry for key \"spectra\" #1185
-
I am trying to run gomplate on my overlay kustomization directory and running into an error ERR error="template: spectra/kustomization.yaml:7:23: executing "spectra/kustomization.yaml" at <.spectra.instance.name>: map has no entry for key "spectra"" Here is my directory structure and file content. Appreciate any input on what is wrong here ? Thanks in advance ! kustomize file 1) ./base/config.yaml file 2) ./spectra/kustomization.yaml resources:
namespace: "{{ .spectra.instance.name }}" commonLabels: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @rameshkjha, thanks for filing this - I've converted it to a discussion since this isn't a bug report or feature request. The
You can also use the context as an alternative which makes for nicer (IMO) syntax, but there are tradeoffs. For your usage I'd recommend it. To use that you need the $ gomplate ... --context config=./base/config.yaml
... Then, you can access the context and the datasources attached to it with
There's a special-case available as well, most useful if you know you'll only ever have a single datasource on the context, which is to use $ gomplate ... --context .=./base/config.yaml
... Then you can use syntax like you listed:
Please read the docs for further information around datasources and the context. Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Marking it as answered. |
Beta Was this translation helpful? Give feedback.
Hi @rameshkjha, thanks for filing this - I've converted it to a discussion since this isn't a bug report or feature request.
The
--datasource
flag defines a datasource that can be accessed with thedatasource
/ds
function. You're using it to define a datasource namedconfig
. So in this case you could access it with something like this:You can also use the context as an alternative which makes for nicer (IMO) syntax, but there are tradeoffs. For your usage I'd recommend it. To use that you need the
--context
/-c
flag:Then, you can access the context and the datasources attached to…