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

Commit ad51e57

Browse files
author
Matthieu Nottale
committed
Helm: revamp, perform all transforms in the YAML marshaler.
Signed-off-by: Matthieu Nottale <matthieu.nottale@docker.com>
1 parent 7a8946d commit ad51e57

12 files changed

Lines changed: 482 additions & 325 deletions

File tree

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

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,66 @@
1-
apiVersion: compose.docker.com/v1beta2
21
kind: Stack
2+
apiVersion: compose.docker.com/v1beta2
33
metadata:
4-
annotations: {}
5-
clustername: ""
6-
creationtimestamp: "0001-01-01T00:00:00Z"
7-
deletiongraceperiodseconds: null
8-
deletiontimestamp: null
9-
finalizers: []
10-
generatename: ""
11-
generation: 0
12-
initializers: null
13-
labels: {}
144
name: helm
5+
generatename: ""
156
namespace: ""
16-
ownerreferences: []
17-
resourceversion: ""
187
selflink: ""
198
uid: ""
9+
resourceversion: ""
10+
generation: 0
11+
creationtimestamp: "0001-01-01T00:00:00Z"
12+
deletiontimestamp: null
13+
deletiongraceperiodseconds: null
14+
labels: {}
15+
annotations: {}
16+
ownerreferences: []
17+
initializers: null
18+
finalizers: []
19+
clustername: ""
2020
spec:
2121
services:
22-
- image: {{.Values.watcher.image}}
23-
name: app-watcher
24-
- deploy:
22+
- name: app-watcher
23+
image: {{.Values.watcher.image}}
24+
- name: debug
25+
deploy:
2526
resources:
2627
limits:
2728
memory: {{.Values.memory}}
29+
environment:
30+
foo: {{.Values.bar}}
2831
health_check:
29-
interval: 2m0s
3032
test:
3133
- /ping
3234
- debug
3335
timeout: {{.Values.timeout}}
36+
interval: 2m0s
3437
image: busybox:latest
35-
name: debug
38+
labels:
39+
foo: {{.Values.bar}}
3640
ports:
3741
- mode: ingress
38-
protocol: tcp
3942
target: {{.Values.aport}}
40-
- mode: ingress
4143
protocol: tcp
42-
published: {{.Values.dport}}
44+
- mode: ingress
4345
target: {{.Values.sport}}
46+
published: {{.Values.dport}}
47+
protocol: tcp
4448
privileged: {{.Values.privileged}}
4549
read_only: {{.Values.read_only}}
4650
stdin_open: {{.Values.stdin_open}}
4751
tty: {{.Values.tty}}
48-
- deploy:
52+
- name: front
53+
deploy:
4954
replicas: {{.Values.myapp.nginx_replicas}}
55+
environment:
56+
{{.Values.foo}}: {{.Values.bar}}
5057
image: nginx:{{.Values.myapp.nginx_version}}
51-
name: front
52-
- command:
58+
labels:
59+
{{.Values.foo}}: {{.Values.bar}}
60+
- name: monitor
61+
command:
5362
- monitor
5463
- --source
5564
- '{{.Values.app.name}}-{{.Values.app.version}}'
5665
- $dollar
5766
image: busybox:latest
58-
name: monitor

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

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
apiVersion: compose.docker.com/v1beta1
21
kind: Stack
2+
apiVersion: compose.docker.com/v1beta1
33
metadata:
4-
creationTimestamp: null
54
name: helm
5+
generatename: ""
6+
namespace: ""
7+
selflink: ""
8+
uid: ""
9+
resourceversion: ""
10+
generation: 0
11+
creationtimestamp: "0001-01-01T00:00:00Z"
12+
deletiontimestamp: null
13+
deletiongraceperiodseconds: null
14+
labels: {}
15+
annotations: {}
16+
ownerreferences: []
17+
initializers: null
18+
finalizers: []
19+
clustername: ""
620
spec:
721
composeFile: |
22+
version: "3.7"
823
services:
924
app-watcher:
1025
image: {{.Values.watcher.image}}
@@ -13,35 +28,41 @@ spec:
1328
resources:
1429
limits:
1530
memory: {{.Values.memory}}
31+
environment:
32+
foo: {{.Values.bar}}
1633
healthcheck:
17-
interval: 2m0s
1834
test:
1935
- /ping
2036
- debug
2137
timeout: {{.Values.timeout}}
38+
interval: 2m0s
2239
image: busybox:latest
40+
labels:
41+
foo: {{.Values.bar}}
2342
ports:
2443
- mode: ingress
25-
protocol: tcp
2644
target: {{.Values.aport}}
27-
- mode: ingress
2845
protocol: tcp
29-
published: {{.Values.dport}}
46+
- mode: ingress
3047
target: {{.Values.sport}}
48+
published: {{.Values.dport}}
49+
protocol: tcp
3150
privileged: {{.Values.privileged}}
3251
read_only: {{.Values.read_only}}
3352
stdin_open: {{.Values.stdin_open}}
3453
tty: {{.Values.tty}}
3554
front:
3655
deploy:
3756
replicas: {{.Values.myapp.nginx_replicas}}
57+
environment:
58+
{{.Values.foo}}: {{.Values.bar}}
3859
image: nginx:{{.Values.myapp.nginx_version}}
60+
labels:
61+
{{.Values.foo}}: {{.Values.bar}}
3962
monitor:
4063
command:
4164
- monitor
4265
- --source
4366
- '{{.Values.app.name}}-{{.Values.app.version}}'
4467
- $dollar
4568
image: busybox:latest
46-
version: "3.7"
47-
status: {}

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

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,66 @@
1-
apiVersion: compose.docker.com/v1beta2
21
kind: Stack
2+
apiVersion: compose.docker.com/v1beta2
33
metadata:
4-
annotations: {}
5-
clustername: ""
6-
creationtimestamp: "0001-01-01T00:00:00Z"
7-
deletiongraceperiodseconds: null
8-
deletiontimestamp: null
9-
finalizers: []
10-
generatename: ""
11-
generation: 0
12-
initializers: null
13-
labels: {}
144
name: helm
5+
generatename: ""
156
namespace: ""
16-
ownerreferences: []
17-
resourceversion: ""
187
selflink: ""
198
uid: ""
9+
resourceversion: ""
10+
generation: 0
11+
creationtimestamp: "0001-01-01T00:00:00Z"
12+
deletiontimestamp: null
13+
deletiongraceperiodseconds: null
14+
labels: {}
15+
annotations: {}
16+
ownerreferences: []
17+
initializers: null
18+
finalizers: []
19+
clustername: ""
2020
spec:
2121
services:
22-
- image: {{.Values.watcher.image}}
23-
name: app-watcher
24-
- deploy:
22+
- name: app-watcher
23+
image: {{.Values.watcher.image}}
24+
- name: debug
25+
deploy:
2526
resources:
2627
limits:
2728
memory: {{.Values.memory}}
29+
environment:
30+
foo: {{.Values.bar}}
2831
health_check:
29-
interval: 2m0s
3032
test:
3133
- /ping
3234
- debug
3335
timeout: {{.Values.timeout}}
36+
interval: 2m0s
3437
image: busybox:latest
35-
name: debug
38+
labels:
39+
foo: {{.Values.bar}}
3640
ports:
3741
- mode: ingress
38-
protocol: tcp
3942
target: {{.Values.aport}}
40-
- mode: ingress
4143
protocol: tcp
42-
published: {{.Values.dport}}
44+
- mode: ingress
4345
target: {{.Values.sport}}
46+
published: {{.Values.dport}}
47+
protocol: tcp
4448
privileged: {{.Values.privileged}}
4549
read_only: {{.Values.read_only}}
4650
stdin_open: {{.Values.stdin_open}}
4751
tty: {{.Values.tty}}
48-
- deploy:
52+
- name: front
53+
deploy:
4954
replicas: {{.Values.myapp.nginx_replicas}}
55+
environment:
56+
{{.Values.foo}}: {{.Values.bar}}
5057
image: nginx:{{.Values.myapp.nginx_version}}
51-
name: front
52-
- command:
58+
labels:
59+
{{.Values.foo}}: {{.Values.bar}}
60+
- name: monitor
61+
command:
5362
- monitor
5463
- --source
5564
- '{{.Values.app.name}}-{{.Values.app.version}}'
5665
- $dollar
5766
image: busybox:latest
58-
name: monitor

e2e/testdata/helm-expected.chart/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ aport: 10000
22
app:
33
name: myapp
44
version: 0.1.0
5+
bar: barvalue
56
dport: 12000
7+
foo: foovalue
68
memory: "100000000"
79
myapp:
810
debug: false

e2e/testdata/helm.dockerapp/docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ services:
44
image: nginx:${myapp.nginx_version}
55
deploy:
66
replicas: ${myapp.nginx_replicas}
7+
labels:
8+
- $foo=$bar
9+
environment:
10+
- $foo=$bar
711
debug:
812
image: busybox:latest
913
ports:
1014
- $aport
1115
- $sport:$dport
16+
labels:
17+
foo: $bar
18+
environment:
19+
foo: $bar
1220
privileged: ${privileged}
1321
read_only: $read_only
1422
tty: $tty

e2e/testdata/helm.dockerapp/settings.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ sport: 11000
1313
dport: 12000
1414
memory: '100000000'
1515
timeout: 10s
16+
bar: barvalue
17+
foo: foovalue

0 commit comments

Comments
 (0)