Given a child zarf definition
# child/zarf.yaml
kind: ZarfPackageConfig
metadata:
name: child-package
values:
files:
- child-values.yaml
components:
- name: database
charts:
- name: example-chart
version: 0.1.0
localPath: "charts/example-chart"
namespace: "database"
values:
- sourcePath: ".app.name"
targetPath: ".appName"
- sourcePath: ".app.replicas"
targetPath: ".replicaCount"
- sourcePath: ".app.image.tag"
targetPath: ".image.tag"
- sourcePath: ".database.host"
targetPath: ".config.database.host"With a child values file:
# child-values.yaml
app:
name:
replicas: 2
image:
tag: 1.1.1
database:
host: localhostThen a parent zarf definition:
# parent/zarf.yaml
kind: ZarfPackageConfig
metadata:
name: parent-package
values:
files:
- parent-values.yaml
components:
- name: database
import:
path: ../child
- name: frontend
charts:
- name: frontend-chart
version: 0.1.0
localPath: "charts/frontend-chart"
namespace: "web"
values:
- sourcePath: ".app.name"
targetPath: ".appName"
- sourcePath: ".app.replicas"
targetPath: ".replicaCount"
- sourcePath: ".app.image.tag"
targetPath: ".image.tag"
- sourcePath: ".database.host"
targetPath: ".config.database.host"
with a parent values file with:
# parent-values.yaml
app:
name:
replicas: 2
image:
tag: 1.1.1Then on import - it would namespace the children values by some key (import name?) - resulting in a package with:
# parent/zarf.yaml
kind: ZarfPackageConfig
metadata:
name: parent-package
values:
files:
- parent-values.yaml
components:
- name: database
charts:
- name: example-chart
version: 0.1.0
localPath: <some path here>
namespace: "database"
values:
- sourcePath: ".database.app.name"
targetPath: ".appName"
- sourcePath: ".database.app.replicas"
targetPath: ".replicaCount"
- sourcePath: ".database.app.image.tag"
targetPath: ".image.tag"
- sourcePath: ".database.database.host"
targetPath: ".config.database.host"
- name: frontend
charts:
- name: frontend-chart
version: 0.1.0
localPath: "charts/frontend-chart"
namespace: "web"
values:
- sourcePath: ".app.name"
targetPath: ".appName"
- sourcePath: ".app.replicas"
targetPath: ".replicaCount"
- sourcePath: ".app.image.tag"
targetPath: ".image.tag"
and the merged values would be:
# values.yaml in the package
app:
name:
replicas: 2
image:
tag: 1.1.1
database:
app:
name:
replicas: 2
image:
tag: 1.1.1
database:
host: localhostGiven a child schema file:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"replicas": {
"type": "integer",
"minimum": 1,
"maximum": 10
},
"storage": {
"type": "string",
"pattern": "^[0-9]+Gi$"
}
},
"required": ["replicas", "storage"]
}We could then wrap the child schema in the parent schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"database": {
"type": "object",
"properties": {
"replicas": {
"type": "integer",
"minimum": 1,
"maximum": 10
},
"storage": {
"type": "string",
"pattern": "^[0-9]+Gi$"
}
},
"required": ["replicas", "storage"]
}
},
"required": ["database"]
}