Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 5d64fe9

Browse files
authored
Merge pull request #89 from mnottale/helm-fix
helm: Fix rendering by prepending 'Values' to variables.
2 parents 5cfa9b7 + fbd30c0 commit 5d64fe9

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

e2e/testdata/helm-expected.chart/templates/stack.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,40 @@ metadata:
1919
uid: ""
2020
spec:
2121
services:
22-
- image: '{{.watcher.image}}'
22+
- image: '{{.Values.watcher.image}}'
2323
name: app-watcher
2424
- deploy:
2525
resources:
2626
limits:
27-
memory: '{{.memory}}'
27+
memory: '{{.Values.memory}}'
2828
health_check:
2929
interval: 2m0s
3030
test:
3131
- /ping
3232
- debug
33-
timeout: '{{.timeout}}'
33+
timeout: '{{.Values.timeout}}'
3434
image: busybox:latest
3535
name: debug
3636
ports:
3737
- mode: ingress
3838
protocol: tcp
39-
target: '{{.aport}}'
39+
target: '{{.Values.aport}}'
4040
- mode: ingress
4141
protocol: tcp
42-
published: '{{.dport}}'
43-
target: '{{.sport}}'
44-
privileged: '{{.privileged}}'
45-
read_only: '{{.read_only}}'
46-
stdin_open: '{{.stdin_open}}'
47-
tty: '{{.tty}}'
42+
published: '{{.Values.dport}}'
43+
target: '{{.Values.sport}}'
44+
privileged: '{{.Values.privileged}}'
45+
read_only: '{{.Values.read_only}}'
46+
stdin_open: '{{.Values.stdin_open}}'
47+
tty: '{{.Values.tty}}'
4848
- deploy:
49-
replicas: '{{.myapp.nginx_replicas}}'
50-
image: nginx:{{.myapp.nginx_version}}
49+
replicas: '{{.Values.myapp.nginx_replicas}}'
50+
image: nginx:{{.Values.myapp.nginx_version}}
5151
name: front
5252
- command:
5353
- monitor
5454
- --source
55-
- '{{.app.name}}-{{.app.version}}'
55+
- '{{.Values.app.name}}-{{.Values.app.version}}'
5656
- $dollar
5757
image: busybox:latest
5858
name: monitor

renderer/helm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func filterVariables(settings map[string]interface{}, variables []string, prefix
100100
// toGoTemplate converts $foo and ${foo} into {{.foo}}
101101
func toGoTemplate(template string) (string, error) {
102102
re := regexp.MustCompile(`(^|[^$])\${?([a-zA-Z0-9_.]+)}?`)
103-
template = re.ReplaceAllString(template, "$1{{.$2}}")
103+
template = re.ReplaceAllString(template, "$1{{.Values.$2}}")
104104
template = strings.Replace(template, "$$", "$", -1)
105105
return template, nil
106106
}

0 commit comments

Comments
 (0)