Home function "env" not defined
Reply: 1

function "env" not defined

Sheena
1#
Sheena Published in 2018-01-10 11:39:49Z

I'm pretty new to helm and go templates so please bear with me

I have a template called secrets.yaml:

apiVersion: v1
kind: Secret
metadata:
  name: fooo-secrets
  labels:
    app: {{ template "fooo.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
type: Opaque # TODO
data:
  SUPER_SECRET: {{env SUPER_SECRET | quote }} <--- the problem line

I got env from sprig. The idea is that I can load up my secrets into my local environment and then deploy from there.

But when I lint my chart:

> helm lint fooo                                                   [13:29]
==> Linting fooo
[INFO] Chart.yaml: icon is recommended
[ERROR] templates/: parse error in "drone_ci/templates/secrets.yaml": template: drone_ci/templates/secrets.yaml:12: function "env" not defined

What am I doing wrong here?

Radek 'Goblin' Pieczonka
2#
Radek 'Goblin' Pieczonka Reply to 2018-01-10 12:07:29Z

to pass this to a helm chart you should use values.

Instead of {{env SUPER_SECRET | quote }} use {{ .Values.secret }} and then when you run helm run it as for example helm install chart --set secret=${SUPER_SECRET}

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.316467 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO