
Make env-name a required param in "env commands"

Fixes #100.
This commit will transition the ksonnet CLI away from accepting either a
list of files or an environment (or both). A detailed explanation
follows.
Historically, the ksonnet CLI has had several "environment commands".
These commands (e.g., `apply`, `diff`, `delete`, `show`, etc.) all took
one of the following:
1. An environment name. For example, `apply us-west/dev` will `apply`
everything in the `components/` directory to the cluster denoted by
`us-west/dev`.
2. A set of files. For example, `apply -f foo.jsonnet -f bar.jsonnet`
would apply those two specific Jsonnet files to the server
specified by the current context in $KUBECONFIG.
3. Both an environment name and a set of files. For example,
`apply us-west/dev -f foo.jsonnet -f bar.jsonnet` would `apply`
those two files to the cluster denoted by the `us-west/dev`
environment.
This "duality" remained in place primarily because it was important for
the ksonnet CLI to maintain functional compatibility (though not strict
CLI-level app compatibility) with the kubecfg tool.
Some time ago the ksonnet CLI was forked from the kubecfg CLI, but it is
only in this commit that we abandon this duality. Specifically, this
commit will _require_ the environment name for all commands. For
example, the form of `apply` will now be:
`apply <env-name> [-f <file>]`.
There are main parts to this:
1. Refactoring core abstractions that supports this "duality".
Specifically, removing the `cmd.envSpec` type and several
functions, such as `cmd.parseEnvCmd`.
2. Updating the tests to reflect this new directory structure.
Signed-off-by:
Jessica Yuen <im.jessicayuen@gmail.com>
Showing
- Makefile 1 addition, 5 deletionsMakefile
- cmd/apply.go 8 additions, 7 deletionscmd/apply.go
- cmd/delete.go 8 additions, 7 deletionscmd/delete.go
- cmd/diff.go 9 additions, 7 deletionscmd/diff.go
- cmd/root.go 83 additions, 66 deletionscmd/root.go
- cmd/root_test.go 5 additions, 1 deletioncmd/root_test.go
- cmd/show.go 10 additions, 9 deletionscmd/show.go
- cmd/show_test.go 23 additions, 4 deletionscmd/show_test.go
- cmd/validate.go 6 additions, 4 deletionscmd/validate.go
- docs/cli-reference/ks_apply.md 1 addition, 1 deletiondocs/cli-reference/ks_apply.md
- docs/cli-reference/ks_delete.md 1 addition, 1 deletiondocs/cli-reference/ks_delete.md
- docs/cli-reference/ks_diff.md 1 addition, 1 deletiondocs/cli-reference/ks_diff.md
- docs/cli-reference/ks_show.md 1 addition, 1 deletiondocs/cli-reference/ks_show.md
- docs/cli-reference/ks_validate.md 1 addition, 1 deletiondocs/cli-reference/ks_validate.md
- testdata/testapp/.ksonnet/registries/incubator/93cd219c5ef77adaade43da0f95a4bebd6acc422.yaml 39 additions, 0 deletions...s/incubator/93cd219c5ef77adaade43da0f95a4bebd6acc422.yaml
- testdata/testapp/app.yaml 11 additions, 0 deletionstestdata/testapp/app.yaml
- testdata/testapp/components/params.libsonnet 13 additions, 0 deletionstestdata/testapp/components/params.libsonnet
- testdata/testapp/components/test-ns-json.json 10 additions, 0 deletionstestdata/testapp/components/test-ns-json.json
- testdata/testapp/components/test-ns-yaml.yaml 7 additions, 0 deletionstestdata/testapp/components/test-ns-yaml.yaml
- testdata/testapp/components/test-ns.jsonnet 10 additions, 0 deletionstestdata/testapp/components/test-ns.jsonnet
Please register or sign in to comment