-
Run this command to use a data value and schema file together. You can see if you change a value in the
values.yml
to be the incorrect type, you will see an error catches this.ytt -f /values.yml -f schema.yml -f template.yml
-
Generate the OpenAPI schema from the
schema.yml
file.ytt -f schema.yml --data-values-schema-inspect -o openapi-v3 > openapi-schema.yml
-
You can use this OpenAPI schema as documentation, or use it in a a kapp-controller Custom Resource, to document what inputs are allowed in the package.
ytt -f package-template.yml --data-value-file openapi=openapi-schema.yml > package.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:yaml", "yaml") | |
#@ load("@ytt:data", "data") | |
#@ def list_and_read(): | |
#@ files = data.list("/") | |
files: #@ files | |
boms: | |
#@ for/end file in files: | |
- bom_name: #@ file | |
bom_data: #@ data.read(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file contents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:data", "data") | |
#@ load("@ytt:template", "template") | |
_: #@ data.values | |
--- | |
#@ files = data.list("/") | |
Files_in_template: | |
#@ for/end file in files: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spec: | |
replicas: 1 | |
resources: | |
limits: | |
cpu: 400m | |
memory: 600Mi | |
requests: | |
cpu: 400m | |
memory: 600Mi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 # Version of the openapi spec | |
info: | |
version: 1.0.0 # Version of this document | |
title: Openapi schema generated from ytt schema | |
components: | |
schemas: | |
type: object | |
properties: | |
namespace: | |
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 # Version of the openapi spec | |
info: | |
version: 1.0.0 # Version of this document | |
title: Openapi schema generated from ytt schema | |
components: | |
schemas: | |
type: object | |
properties: | |
namespace: | |
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type: object | |
properties: | |
namespace: | |
type: string | |
default: fluent-bit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:data", "data") | |
#@ load("@ytt:library", "library") | |
#@ def antrea_values(): | |
#@ return data.values | |
#@ end | |
type_of_func_return: #@ type(antrea_values()) | |
type_of_dvs: #@ type(data.values) | |
type_of_none: #@ type(None) |
NewerOlder