Skip to content

Commit fda9325

Browse files
author
Hannes Hörl
committed
Add example for per-step values and annotations
Signed-off-by: Hannes Hörl <[email protected]>
1 parent 5e50f24 commit fda9325

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
apiVersion: data.packaging.carvel.dev/v1alpha1
3+
kind: Package
4+
metadata:
5+
name: thingmajig.acme.corp.0.0.1
6+
spec:
7+
refName: thingmajig.acme.corp
8+
version: 0.0.1
9+
template:
10+
spec:
11+
fetch:
12+
- path: helm-chart
13+
helmChart:
14+
name: nginx
15+
repository:
16+
url: oci://registry-1.docker.io/bitnamicharts
17+
version: 15.12.2
18+
- path: patcher
19+
inline:
20+
paths:
21+
schema.yaml: |
22+
#@data/values-schema
23+
---
24+
#! These validations would fail if we were not able to add data
25+
#! values to the ytt step
26+
27+
#@schema/validation min_len=1
28+
existingServerBlockConfigmap: ""
29+
#@schema/validation min_len=1
30+
customServerBlock: ""
31+
server-block-cm.yaml: |
32+
#@ load("@ytt:data", "data")
33+
---
34+
apiVersion: v1
35+
kind: ConfigMap
36+
metadata:
37+
name: #@ data.values.existingServerBlockConfigmap
38+
data:
39+
custom-server-block.conf: #@ data.values.customServerBlock
40+
template:
41+
- helmTemplate:
42+
path: helm-chart
43+
- ytt:
44+
paths:
45+
- "-"
46+
- patcher
47+
deploy:
48+
- kapp: {}
49+
50+
---
51+
apiVersion: packaging.carvel.dev/v1alpha1
52+
kind: PackageInstall
53+
metadata:
54+
name: thingamajig
55+
annotations:
56+
ext.packaging.carvel.dev/helm-0-template-name: foobar
57+
spec:
58+
serviceAccountName: default-ns-sa
59+
packageRef:
60+
refName: thingmajig.acme.corp
61+
versionSelection:
62+
constraints: 0.0.1
63+
values:
64+
- secretRef:
65+
name: thingamajig-shared-values
66+
templateSteps: [ 0 , 1 ]
67+
- secretRef:
68+
name: thingamajig-helm-values
69+
templateSteps: [ 0 ]
70+
- secretRef:
71+
name: thingamajig-ytt-values
72+
templateSteps: [ 1 ]
73+
74+
---
75+
apiVersion: v1
76+
kind: Secret
77+
metadata:
78+
name: thingamajig-shared-values
79+
stringData:
80+
values.yaml: |
81+
existingServerBlockConfigmap: custom-server-block
82+
83+
---
84+
apiVersion: v1
85+
kind: Secret
86+
metadata:
87+
name: thingamajig-helm-values
88+
stringData:
89+
values.yaml: |
90+
service:
91+
type: ClusterIP
92+
replicaCount: 2
93+
94+
---
95+
apiVersion: v1
96+
kind: Secret
97+
metadata:
98+
name: thingamajig-ytt-values
99+
stringData:
100+
values.yaml: |
101+
customServerBlock: |
102+
server {
103+
listen 0.0.0.0:8080;
104+
location / {
105+
return 200 "hello from kapp-controller, helm, ytt and friends!";
106+
add_header Content-Type text/plain;
107+
}
108+
}

hack/test-examples.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ time kapp delete -y -a simple-app-http
3333
time kapp deploy -y -a cue -f examples/cue.yml
3434
time kapp delete -y -a cue
3535

36+
time kapp deploy -y -a step-values-and-config -f examples/pkgi-with-config-and-values-per-step.yaml
37+
time kapp delete -y -a step-values-and-config
38+
3639
kapp delete -y -a rbac
3740

3841
echo EXTERNAL SUCCESS

0 commit comments

Comments
 (0)