Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configs per step #1499

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/config/crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,10 @@ spec:
name:
type: string
type: object
templateSteps:
items:
type: integer
type: array
type: object
type: array
type: object
Expand Down
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: thingamajig.acme.corp.0.0.1
spec:
refName: thingamajig.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: thingamajig.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
2 changes: 2 additions & 0 deletions pkg/apis/packaging/v1alpha1/package_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ type PackageRef struct {
type PackageInstallValues struct {
// +optional
SecretRef *PackageInstallValuesSecretRef `json:"secretRef,omitempty"`
// +optional
TemplateSteps []int `json:"templateSteps,omitempty"`
}

type PackageInstallValuesSecretRef struct {
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/packaging/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading