validate command¶
Use multiple arguments to validate multiple files:
Available flags:
Flag | Required | Short | Description |
---|---|---|---|
vars | No | 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:
See 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:
Specify the path to the variable file with the --vars
flag:
Variable Flags¶
Specify variables in the key=value
form with the --var
flag.
Multiple variables can be provided as a comma separated list of pairs:
...or by specifying the --var
flag multiple times:
If both a variable file and variable flags are provided:
...the flags will override any variables set by the file:
nais validate --vars 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:
[📝] 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