Add types for prototype params and templates
This commit will fix #116 by introducing two new constructs to the prototype specification schema: 1. Mandatory types for prototype parameters. This lets us accept bare words on the command line, and then "do the right thing" when emitting JSON or Jsonnet. For example, say a template produces a `core.v1.Service` that exposes a port with a `--targetPort` flag. When the user passes a number (e.g., `80`) in, we should _not_ put quote marks around it, since we want to expose port `80`. When the user passes a string (e.g., `"nginxPort"`), we _should_ put quote marks around it, to denote that we're exposing the port with that name. In order to do this, we need to know they "type" of the parameter (in this case, `NumberOrString`). 2. Mandatory template types. A template can have a JSON, YAML, or Jsonent flavor, and we default to using Jsonnet. This is useful mostly to make type parameters less error-prone (since one set of parameters corresponds to one set of templates), but it also significantly de-bloats the output of commands like `search`, since one fully-qualified name can correspond to multiple flavors of the same template.
Showing
- cmd/prototype.go 44 additions, 16 deletionscmd/prototype.go
- prototype/prototype_test.go 10 additions, 10 deletionsprototype/prototype_test.go
- prototype/specification.go 156 additions, 13 deletionsprototype/specification.go
- prototype/systemPrototypes.go 136 additions, 22 deletionsprototype/systemPrototypes.go
Please register or sign in to comment