validate command ΒΆ
nais validate path/to/nais.yamlUse multiple arguments to validate multiple files:
nais validate path/to/nais.yaml path/to/another/nais.yamlAvailable flags:
| Flag | Required | Short | Description |
|---|---|---|---|
| vars-file | No | -f | path to FILE containing template variables, must be JSON or YAML format |
| var | No | template variable in KEY=VALUE form, can either be a comma separated list or specified multiple times. | |
| verbose | No | -v | print all the template variables and final resources after templating |
All flags must be specified before arguments:
nais validate [--vars-file path/to/vars.(yaml|json)] [--var key=value] path/to/nais.yamlSee the templating section for examples.
Supported Resources ΒΆ
The following resource kinds are supported:
Templating ΒΆ
A templated YAML file can look like this:
apiVersion: nais.io/v1alpha1
kind: Application
metadata:
name: {{app}}
namespace: some-team
labels:
team: some-team
spec:
image: {{image}}To validate a templated file, provide a variable file or specify the variables as flags.
Variable File ΒΆ
The variable file must be in either JSON or YAML format:
{
"app": "some-app",
"image": "some-image"
}app: some-app
image: some-imageSpecify the path to the variable file with the --vars-file flag:
nais validate --vars-file vars.yaml nais.yamlVariable Flags ΒΆ
Specify variables in the key=value form with the --var flag.
Multiple variables can be provided as a comma separated list of pairs:
nais validate --var app=app,image=image nais.yaml...or by specifying the --var flag multiple times:
nais validate --var app=app --var image=image nais.yamlIf both a variable file and variable flags are provided:
nais validate --vars-file vars.yaml --var image=some-other-image nais.yaml...the flags will override any variables set by the file:
nais validate --vars-file vars.yaml --var image=some-other-image -v nais.yaml
[π] Setting template variable 'app' to 'some-app'
[π] Setting template variable 'image' to 'some-image'
[β οΈ] Overwriting template variable 'image'; previous value was 'some-image'
[π] Setting template variable 'image' to 'some-other-image'
...Verbose Output ΒΆ
The --verbose (shorthand -v) flag prints additional information, such as template variables set and the final templated resources:
nais validate --vars-file vars.yaml --verbose nais.yaml[π] Setting template variable 'app' to 'some-app'
[π] Setting template variable 'image' to 'some-image'
[π¨οΈ] Printing "nais.yaml"...
---
apiVersion: nais.io/v1alpha1
kind: Application
metadata:
name: some-app
namespace: some-team
labels:
team: some-team
spec:
image: some-image
[β
] "nais.yaml" is valid