Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including multi-line files via gomplate breaks the config #28

Open
simt2 opened this issue Oct 29, 2018 · 0 comments
Open

Including multi-line files via gomplate breaks the config #28

simt2 opened this issue Oct 29, 2018 · 0 comments

Comments

@simt2
Copy link
Contributor

simt2 commented Oct 29, 2018

I tried to include a multi-line file via gomplate like this:
mh.yaml

targetContext: minikube

gomplate:
  datasources:
  - "cassandra-grafana-dashboard=./cassandra-grafana-dashboard.json"
  datasourceheaders: []

rawCassandraGrafanaDashboard:
  resources:
  - apiVersion: v1
    metadata:
      name: cassandra-grafana-dashboard
    kind: ConfigMap
    spec:
      data:
        cassandra-dashboard.json: |-
[[ include "cassandra-grafana-dashboard" | indent 10 ]]

Running mh simulate fails with:

WARN[0000] Failed to load mh config. Please consider exporting environment variable: MH_CONFIG.  configFile=/Users/sitesar/src/go/src/github.com/cisco-sso/mh/main.yaml configFileEnv=/Users/sitesar/src/go/src/github.com/cisco-sso/mh/main.yaml configFileEnvPresent=true configFileFlag= configFileOrigin=env configFileUsed=/Users/sitesar/src/go/src/github.com/cisco-sso/mh/main.yaml err="While parsing config: yaml: line 18: could not find expected ':'"
FATA[0000] `kubectl config current-context` does not match configured targetContext  command=simulate currentContext=minikube targetContext=localhost

mh parses MH_CONFIG before it runs any command to sanity check the kubectl context, but with this kind of templating, MH_CONFIG isn't valid YAML anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant