Skip to content
Snippets Groups Projects
  1. Oct 17, 2017
    • Jessica Yuen's avatar
    • Jessica Yuen's avatar
      Introduce namespace to environments · 38f35db4
      Jessica Yuen authored
      Environments currently have the concept of a server URI, but it is
      ambiguous which cluster namespace to use.
      
      This commit will introduce the concept of namespaces to the env
      commands.
      
      For example,
      `kubecfg env add staging http://mock-staging-uri \
       --namespace=staging-namespace`
      `kubecfg env set staging --namespace=staging-namespace`
      
      The default environment will use the namespace of the default context.
      
      This commit will also update commands that take the <env> arg such as
      `apply` to make use of the env namespace, if specified.
      38f35db4
  2. Sep 21, 2017
    • Alex Clemmer's avatar
      Cause `init` to generate env using current-context · 361a62c0
      Alex Clemmer authored
      When we run `init`, currently we generate a simple environment called
      'default' with no URI. A better idea is to generate the URI from the
      current context of the active kubeconfig file, if it exists.
      361a62c0
    • Jessica Yuen's avatar
      Commands using the <env> arg should deploy to the correct cluster · 13f89a92
      Jessica Yuen authored
      For example, 'apply <env' currently operates as a no-op. With the
      introduction of simple environments in PR #131, 'apply <env>' should
      perform basic validation such that:
      
      1. The user has added the environment that is being deployed against to
      their Ksonnet project.
      
      2. The URI in the environment's spec file that the user wishes to deploy
      to should correspond to at least one cluster location as listed in
      kubeconfig.
      
      If either of those conditions are not satisfied, the kubecfg user will
      receive the corresponding error.
      
      In addition, this commit will set the kubectl --cluster flag to point at
      the cluster listed by the environment URI.
      13f89a92
  3. Sep 19, 2017
    • Jessica Yuen's avatar
      Logging for env subcommands · 5e63dcba
      Jessica Yuen authored
      This commit will add logging to all env subcommands 'list', 'set',
      'add', and 'rm'. It adds both Info level and Debug level logging.
      
      Fixes #137
      5e63dcba
  4. Sep 18, 2017
    • Jessica Yuen's avatar
      Add subcommand 'env set' · f86667a6
      Jessica Yuen authored
      'env set <name>' sets environment fields such as the name, and cluster
      URI. It currently accepts the flags '--name' and '--uri'. Changing the
      name of an environment will also update the directory structure in
      'environments'.
      f86667a6
  5. Sep 15, 2017
    • Jessica Yuen's avatar
      Add subcommand 'env rm' · 530f5777
      Jessica Yuen authored
      'env rm <env-name>' deletes an environment within a ksonnet project.
      This is the same as removing the <env-name> environment directory and
      all files contained.  Empty parent directories will also be removed.
      530f5777
    • Jessica Yuen's avatar
      Add subcommand 'env list' · a169d973
      Jessica Yuen authored
      'env list' will list all environments within a Ksonnet project. Each
      environment will be pretty-printed with it's name and cluster URI
      location.
      a169d973
  6. Sep 13, 2017
    • Jessica Yuen's avatar
      Add subcommand 'env add' · 56777310
      Jessica Yuen authored
      'env add <env-name> <env-uri>' will create a new environment within a
      ksonnet project, by generating a new directory, 'env-name', within the
      'envs' directory. Each environment will contain environment-specfic
      files. Notably, a new environment-specific file is 'spec.json'.
      'spec.json' currently only contains the 'env-uri' of the Kubernetes
      cluster located at the added environment.
      
      Below is an example directory structure for the environment
      'us-west/staging':
      
      app-name/
        .gitignore           Default .gitignore; can customize VCS
        .ksonnet/            Metadata for ksonnet
        environments/        Env specs (defaults: dev, test, prod)
          default/           [Default generated environment.]
          us-west/           [Example of user-generated env]
            staging/
              k.libsonnet
              k8s.libsonnet
              swagger.json
              spec.json      [This will contain the uri of the environment]
        components/          Top-level Kubernetes objects defining application
        lib/                 user-written .libsonnet files
        vendor/              mixin libraries, prototypes
      56777310
  7. Sep 07, 2017
    • Alex Clemmer's avatar
      Deprecate `update` subcommand; introduce `apply` · 94a18089
      Alex Clemmer authored
      This commit is a follow-up to the discussion in the ksonnet.next design
      doc, in which users consistently expressed their preference that the
      `update` command be called `apply`.
      
      NOTE: We have renamed `pkg/kubecfg/update_test.go` ->
      `pkg/kubecfg/apply_test.go`, but we copy the `update`'s integration test
      file. The reason is that the `update` unit tests actually test things
      like GC (rather than the command itself), so the file name is
      inconsequential. On the other hand, the integration tests test the
      commands themselves, so it is important to have two copies, one for
      `update` and one for `apply`.
      94a18089
    • Alex Clemmer's avatar
      Include `lib/` and `vendor/lib` when expanding templates · bc77be8e
      Alex Clemmer authored
      Currently, if the user wants to deploy a ksonnet application, and that
      application uses some vendored library, or something in the `lib/`
      directory, they will have to pass the appropriate `-J` flags into the
      command themselves.
      
      This commit will automatically add these whenever we're in an app
      directory and a command is issued. In particular, even if the user
      passes in the `-f` flag (rather than an environment name), we'll still
      add library paths to the command if we're in a ksonnet app directory.
      This is meant to capture the case that a user wants to update one
      resource in particular in a ksonnet application.
      bc77be8e
  8. Sep 01, 2017
    • Jessica Yuen's avatar
      Refactor cmd/ application logic to pkg/ · f7d6436d
      Jessica Yuen authored
      This commit will separate the application level logic for the 'show', 'delete',
      'validate', and 'diff' commands from the Cobra logic in the cmd/ package.  The
      application level logic will be placed in pkg/kubecfg/.
      f7d6436d
  9. Aug 30, 2017
    • Alex Clemmer's avatar
      Make delete, diff, show, update, and validate aware of ksonnet apps · af3f0f6c
      Alex Clemmer authored
      The ksonnet.next design doc specifies the core kubecfg verbs (i.e., the
      ones listed above) to all have the form:
      
        kubecfg <verb> [<env-name>|-f <file-or-dir>]
      
      That is to say, each of these should be able to take either an
      environment name, or a `-f` flag with a list of files and directories to
      apply `verb` on. In the case of the environment, we will apply `verb` to
      every component in the `components/` directory.
      
      This commit implements this behavior for all these verbs.
      af3f0f6c
    • Alex Clemmer's avatar
      Implement `init` subcommand · 83799252
      Alex Clemmer authored
      This commit will implement the first version of the `init` subcommand.
      This subcommand initializes a ksonnet application, including generating
      the default directory tree and generating the appropriate ksonnet-lib.
      83799252
    • Angus Lees's avatar
      Trivial debugging log message fixes · b2123661
      Angus Lees authored
      Noticed and then audited in the course of other work.
  10. Aug 08, 2017