Skip to content

Commit

Permalink
Add example for per-step values and annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Hannes Hörl <[email protected]>
  • Loading branch information
Hannes Hörl committed Mar 4, 2024
1 parent 5e50f24 commit fda9325
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
108 changes: 108 additions & 0 deletions examples/pkgi-with-config-and-values-per-step.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
apiVersion: data.packaging.carvel.dev/v1alpha1
kind: Package
metadata:
name: thingmajig.acme.corp.0.0.1
spec:
refName: thingmajig.acme.corp
version: 0.0.1
template:
spec:
fetch:
- path: helm-chart
helmChart:
name: nginx
repository:
url: oci://registry-1.docker.io/bitnamicharts
version: 15.12.2
- path: patcher
inline:
paths:
schema.yaml: |
#@data/values-schema
---
#! These validations would fail if we were not able to add data
#! values to the ytt step
#@schema/validation min_len=1
existingServerBlockConfigmap: ""
#@schema/validation min_len=1
customServerBlock: ""
server-block-cm.yaml: |
#@ load("@ytt:data", "data")
---
apiVersion: v1
kind: ConfigMap
metadata:
name: #@ data.values.existingServerBlockConfigmap
data:
custom-server-block.conf: #@ data.values.customServerBlock
template:
- helmTemplate:
path: helm-chart
- ytt:
paths:
- "-"
- patcher
deploy:
- kapp: {}

---
apiVersion: packaging.carvel.dev/v1alpha1
kind: PackageInstall
metadata:
name: thingamajig
annotations:
ext.packaging.carvel.dev/helm-0-template-name: foobar
spec:
serviceAccountName: default-ns-sa
packageRef:
refName: thingmajig.acme.corp
versionSelection:
constraints: 0.0.1
values:
- secretRef:
name: thingamajig-shared-values
templateSteps: [ 0 , 1 ]
- secretRef:
name: thingamajig-helm-values
templateSteps: [ 0 ]
- secretRef:
name: thingamajig-ytt-values
templateSteps: [ 1 ]

---
apiVersion: v1
kind: Secret
metadata:
name: thingamajig-shared-values
stringData:
values.yaml: |
existingServerBlockConfigmap: custom-server-block
---
apiVersion: v1
kind: Secret
metadata:
name: thingamajig-helm-values
stringData:
values.yaml: |
service:
type: ClusterIP
replicaCount: 2
---
apiVersion: v1
kind: Secret
metadata:
name: thingamajig-ytt-values
stringData:
values.yaml: |
customServerBlock: |
server {
listen 0.0.0.0:8080;
location / {
return 200 "hello from kapp-controller, helm, ytt and friends!";
add_header Content-Type text/plain;
}
}
3 changes: 3 additions & 0 deletions hack/test-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ time kapp delete -y -a simple-app-http
time kapp deploy -y -a cue -f examples/cue.yml
time kapp delete -y -a cue

time kapp deploy -y -a step-values-and-config -f examples/pkgi-with-config-and-values-per-step.yaml
time kapp delete -y -a step-values-and-config

kapp delete -y -a rbac

echo EXTERNAL SUCCESS

0 comments on commit fda9325

Please sign in to comment.