Skip to content
  • Alex Clemmer's avatar
    💪 Make env-name a required param in "env commands" · 4923a3f5
    Alex Clemmer authored
    
    
    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: default avatarJessica Yuen <im.jessicayuen@gmail.com>
    4923a3f5