1. 13 Nov, 2017 1 commit
    • Jessica Yuen's avatar
      Provide access to ExtCodes when the '-f' flag is provided · c97220f4
      Jessica Yuen authored
      Currently, ExtCodes are only provided when the 'env' flag is present in
      commands. The result is errors occuring when we run commands such as `ks
      show default -f components/guestbook-ui.jsonnet`, where the params
      ExtVar is needed. This commit fixes that scenario.
  2. 08 Nov, 2017 3 commits
    • Jessica Yuen's avatar
      Jsonnet handling of component names with special characters · ce2d567d
      Jessica Yuen authored
      Currently, if a component name contains a special character, ex:
      foo-bar, this translates to the jsonnet identifier: foo-bar, which is
      invalid syntax.
      This change will quote component names where there are special
    • Alex Clemmer's avatar
      Add `vendor/` to Jsonnet paths · 5327cf5c
      Alex Clemmer authored
      This resolves the first half of #68. When we `generate` using a
      prototype from a vendored dependency, it often results in a compilation
      error when we `apply`, because these prototypes usually depend on code
      that exists in the dependency, and `vendor/` is not a part of the
      Jsonnet search path.
      This commit resolves this problem by adding it to the search path.
    • Jessica Yuen's avatar
      Pass overrides by reference when initiating client · beddf415
      Jessica Yuen authored
      This fixes the bug where objects weren't being deployed to the cluster
      specified by the environment. This bug occurred because overrides (ex:
      cluster, namespace) were being lost because we weren't applying the
      changes to the correct override object. To fix this, we needed to pass
      the overrides by reference.
  3. 31 Oct, 2017 1 commit
    • Jessica Yuen's avatar
      Expand environment params.libsonnet · d55fbed6
      Jessica Yuen authored
      Expose the import path to environments/:env/params.libsonnet as an
      ExtCode so that it is made accessible to component files during
  4. 26 Oct, 2017 2 commits
    • Jessica Yuen's avatar
      Rename environment uri references to server · 3c9e07e9
      Jessica Yuen authored
      'server' is consistent with what is used by clientgo. 'uri' only
      introduces new language to ksonnet with the same meaning.
    • Jessica Yuen's avatar
      Support `diff` between two environments · 2687c6d8
      Jessica Yuen authored
      This change enables the user to diff between two environments that are
      either local or remote.
      `kubecfg diff local:dev local:prod` will diff between the expanded
      templates for each environment on disk.
      `kubecfg diff remote:dev remote:prod` will diff between two remote
      environment clusters. It does this by first expanding the component
      templates of each environment. Then, the live objects are fetched from
      each of the clusters and the diff is performed against the live objects.
      `kubecfg diff local:dev remote:prod` is also an option. This will diff
      between the expanded templates for 'dev' on disk and the live objects
      on 'prod's server.
  5. 25 Oct, 2017 2 commits
    • Jessica Yuen's avatar
      Set env namespace to default when namespace not provided · 209a5abf
      Jessica Yuen authored
      `ks env set foo --namespace=""` and `ks env add foo` will both set the
      namespace to 'default' in the environment's spec.json file.
    • Jessica Yuen's avatar
      Init env metadata from provided context · e3e35d30
      Jessica Yuen authored
      `ks env add myenv --context=dev` will initialize the environment URI
      and namespace based on the context `dev`, as specfied in the
      kubeconfig file. The same applies for `ks init foo --context=dev`.
      If both the context and uri argument is not provided, the current
      context is used.
      This change will also remove uri as a mandatory arg in `ks env add`.
      The uri will be moved to a flag. It cannot be used at the same time as
  6. 17 Oct, 2017 3 commits
  7. 06 Oct, 2017 2 commits
    • Jessica Yuen's avatar
      Expand environment .jsonnet file · 6378e75a
      Jessica Yuen authored
      Commands that take `env` as a param currently expand all files in the
      `components` directory. This is no longer necessary with the
      introduction of `base.libsonnet` and the per-environment override
      `<env>.jsonnet` file.
      This commit will simply expand the single `<env>.jsonnet` file (which
      will implicitly expand all component files). The case of running
      `ksonnet apply default`, is equivalent to running `ksonnet apply -f
    • Jessica Yuen's avatar
      Generate base.libsonnet in environments/ · 4b50beb8
      Jessica Yuen authored
      base.libsonnet is a generated file that exists at the root of the
      environments directory. This file is generated for all ksonnet projects.
      The main goal of this file is to import all components in the components
      directory, so that environments are able to easily extend / override any
      one of these components in a modular structure.
  8. 05 Oct, 2017 1 commit
    • Jessica Yuen's avatar
      Remove unnecessary param from defaultNamespace() · c95cde93
      Jessica Yuen authored
      The `clientConfig` param currently being passed is not needed, because
      it exists as a package level var in root. It also makes little sense to
      pass a custom `clientConfig` because if `overrides.Context.Namespace` is
      populated, the namespace that is returned is configured as an override
      in the package level `clientConfig` and not the `clientConfig` in the
  9. 03 Oct, 2017 1 commit
    • Jessica Yuen's avatar
      Construct base components object · c97498df
      Jessica Yuen authored
      In order to support environment heirarchy, we need to be able to
      reference all components. This commit will implement component imports
      as k-v pairs ex: foo: "import/foo.jsonnet" as a Jsonnet object. This
      jsonnet object will then be assigned as an ExtCode so that it can be
      referenced by a base.libsonnet file which environments can build /
      override upon.
  10. 27 Sep, 2017 1 commit
  11. 21 Sep, 2017 4 commits
    • Alex Clemmer's avatar
      Remove client-go flags from commands that don't use them · f9723645
      Alex Clemmer authored
      Fixes #108.
    • Alex Clemmer's avatar
      Fix improper elision of -J flags · 4509a351
      Alex Clemmer authored
      Currently if we use a command like `apply default -f
      components/whatever.yaml`, kubecfg will fail to emit flags that add
      ksonnet-lib to the -J paths. This means that, while a command like
      `apply default` will correctly linke against (e.g.) `k.libsonnet`,
      adding the `-f` flag will not.
      This commit will correct this problem for all commands of this form.
    • 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
      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.
    • Jessica Yuen's avatar
      Make Files and Environment not be mutually exclusive · 184756d8
      Jessica Yuen authored
      Currently, commands take either an <env> or a '-f' argument but not
      both. With this commit, we are allowing both args to be provided. The
      behavior is expand the files passed by the '-f' flag and deploy the
      objects to <env>.
  12. 19 Sep, 2017 1 commit
    • Jessica Yuen's avatar
      Set default log level to 'Info' · 3ca68ad8
      Jessica Yuen authored
      Currently 'Info' level logs are only shown with the '-v' flag. This
      makes commands without the '-v' flag of little use to users, especially
      on success cases, due to no output.
      This commit will set the default log level to 'Info', and passing a '-v'
      flag will log at a 'Debug' level.
  13. 18 Sep, 2017 1 commit
    • 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
  14. 08 Sep, 2017 1 commit
    • Jessica Yuen's avatar
      Change directory structure generated by 'init' to support envs · 1e656f24
      Jessica Yuen authored
      This commit will remove the vendor/lib and vendor/schema directories
      generated by 'init'. An 'environments' directory will be created from
      the root app directory, with the default environment directory 'dev'
      and it's containing contents rooted at 'environments'.
      The intention of environments are to represent the deployment
      environments of Kubernete clusters, with the following example
      directory structure:
  15. 07 Sep, 2017 2 commits
    • 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`.
    • 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.
  16. 06 Sep, 2017 1 commit
  17. 05 Sep, 2017 1 commit
  18. 02 Sep, 2017 2 commits
  19. 01 Sep, 2017 1 commit
    • 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/.
  20. 30 Aug, 2017 2 commits
    • 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.
    • Alex Clemmer's avatar
      Add a template expander abstraction · 86c5ad02
      Alex Clemmer authored
      This commit will introduce the `template.Expander` abstraction, which is
      meant to abstract over an invocation of the Jsonnet VM. Specifically, it
      provides facilities for users to provide (e.g.) Jpaths, ext vars, and so
      The main justification for this change is:
      * We need a common way for the `pkg` and `cmd` packages to interact with
        the Jsonnet VM.
      * The `utils` package is already too much of a catch-all.
      * It's easier to think about an invocation of the Jsonnet VM when we
        additionally encapsulate the parameters we pass to it on every
        invocation in kubecfg.
  21. 08 Aug, 2017 1 commit
  22. 02 Aug, 2017 1 commit
  23. 07 Jul, 2017 1 commit
  24. 06 Jul, 2017 2 commits
  25. 30 Jun, 2017 2 commits
    • Angus Lees's avatar
      Switch logging from glog to logrus · e7f9b9fd
      Angus Lees authored
      Improve interactive output experience by switching to a logging
      library (logrus) that allows customising the output format.
      This also removes the glog command line flags.  Replaced with a
      simpler `--verbose`/`-v` option:
      - quiet by default (warnings and errors only)
      - `-v` for progress info
      - `-vv` for debug
      Fixes #34
    • Angus Lees's avatar
      Add per-file license headers · 3d8873ce
      Angus Lees authored
      Fixes #35