Skip to content
Snippets Groups Projects
  1. Nov 06, 2017
    • Alex Clemmer's avatar
      Emit `app.yaml` after init · 4dd0dd7a
      Alex Clemmer authored
      When the user calls `ks init <whatever>`, we need to emit an `app.yaml`
      for the new project. This commit will introduce such behavior.
      4dd0dd7a
  2. Nov 04, 2017
    • Jessica Yuen's avatar
      Introduce command: `ks param diff <env1> <env2> [--component]` · 6a6704fc
      Jessica Yuen authored
      Pretty prints differences between the component parameters of two
      environments.
      
      A component flag is accepted to diff against a single component. By
      default, the diff is performed against all components.
      6a6704fc
    • Jessica Yuen's avatar
      Introduce command: 'ks param list [component] [--env=<env>]' · eabd30c5
      Jessica Yuen authored
      Pretty prints component or environment parameters.
      
      This command will display all parameters for the component specified. If
      a component is not specified, parameters for all components will be
      listed.
      
      Furthermore, parameters can be listed on a per-environment basis.
      
      Examples:
      
      List all component parameters
        ks param list
      
      List all parameters for the component "guestbook"
        ks param list guestbook
      
      List all parameters for the environment "dev"
        ks param list --env=dev
      
      List all parameters for the component "guestbook" in the environment
      "dev"
        ks param list guestbook --env=dev`,
      eabd30c5
    • Jessica Yuen's avatar
      Introduce commands: 'ks param' and 'ks param set' · 8fc6c76c
      Jessica Yuen authored
      Parameters are the customizable fields defining ksonnet components. For
      example, replica count, component name, or deployment image.
      
      Parameters are also able to be defined separately across environments.
      Meaning, this supports features to allow a "development" environment to
      only run a single replication instance for it's components, whereas
      allowing a "production" environment to run more replication instances to
      meet heavier production load demands.
      
      'ks param set' is defined as follows:
        'ks param set <component-name> <param-key> <param-value>'
      
      Examples:
      
      Updates the replica count of the 'guestbook' component to 4.
        'ks param set guestbook replicas 4'
      
      Updates the replica count of the 'guestbook' component to 2 for the
      environment 'dev'
        'ks param set guestbook replicas 2 --env=dev'
      8fc6c76c
    • Jessica Yuen's avatar
      Append component params on generate · 82617551
      Jessica Yuen authored
      This commit will append both mandatory and optional  prototype
      parameters to the component params.libsonnet file on `ks gen foo ...`.
      
      Default values will be used for optional params where the user does not
      specify flags to `ks gen foo ...`.
      
      Because we are trying to append to jsonnet, we will have to traverse the
      AST to first identify the location of where to insert the new component
      params. New components will be inserted at the bottom of the components
      object, with the params ordered alphabetically.
      82617551
    • Jessica Yuen's avatar
      Parse system prototypes using the jsonnet snippet parser · 995f7496
      Jessica Yuen authored
      We are currently parsing system prototypes using the default TextMate
      snippet which does not take into account the translation of params of
      format `import 'param://foo`. The jsonnet snippet parser does take this
      into account.
      995f7496
  3. Oct 31, 2017
  4. Oct 26, 2017
    • Jessica Yuen's avatar
      Remove flags already defined by clientgo · 6661d25b
      Jessica Yuen authored
      No need to redefine these flags as they are already specified in the
      clientgo flag bindings.
      6661d25b
    • 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.
      3c9e07e9
    • Alex Clemmer's avatar
      c3fcf414
    • 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.
      
      i.e.,
      
      `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.
      2687c6d8
  5. Oct 25, 2017
    • Jessica Yuen's avatar
      Remove client-go bindings from cmd · a4be77c4
      Jessica Yuen authored
      For now, client-go bindings will be removed from the diff command.
      
      Doing this because when diffing between multiple remote environments, it
      becomes ambiguous which environment cluster the flags should belong to.
      a4be77c4
    • 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.
      209a5abf
    • 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
      `context`.
      e3e35d30
  6. Oct 19, 2017
  7. Oct 17, 2017
  8. Oct 06, 2017
    • 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
      environments/default/default.jsonnet`.
      6378e75a
    • 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.
      4b50beb8
  9. Oct 05, 2017
    • 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
      param.
      c95cde93
  10. Oct 03, 2017
    • 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.
      c97498df
  11. Sep 27, 2017
  12. Sep 26, 2017
    • Alex Clemmer's avatar
      Implement 'prototype preview' · 64f78b42
      Alex Clemmer authored
      Currently the command 'prototype use' expands a prototype and prints to
      stdout. This is useful, but most of the time, users want to simply dump
      the result in 'components/'
      
      This command implements this print-to-stdout behavior in a new command,
      'prototype-preview', and reimplements 'prototype use' to drop the
      expanded prototype into 'components/'.
      
      The new form of this command is:
      
        ksonnet prototype use <prototype-name> <component-name> [type] [flags]
      
      So, for example, a command like:
      
        ksonnet prototype use deployment nginx-depl [...]
      
      would expand the 'deployment' prototype, and place it in
      'components/nginx-depl.jsonnet' (since Jsonnet is the default template
      expansion). Alternatively, something like this:
      
        ksonnet prototype use deployment nginx-depl yaml [...]
      
      would expand the prototype and place it in 'components/nginx-depl.yaml'
      (assuming that there is a YAML version of this template.
      64f78b42
  13. Sep 22, 2017
  14. Sep 21, 2017
    • Alex Clemmer's avatar
      Remove client-go flags from commands that don't use them · f9723645
      Alex Clemmer authored
      Fixes #108.
      f9723645
    • Alex Clemmer's avatar
      Add `prototype list` command · f70428dd
      Alex Clemmer authored
      The `prototype list` command lists all known prototypes. It is
      functionally equivalent to a `prototype search` that returns all
      prototypes.
      f70428dd
    • 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
    • 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.
      4509a351
    • 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
    • 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>.
      184756d8
  15. Sep 19, 2017
    • 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.
      3ca68ad8
    • Alex Clemmer's avatar
      Add to 'env' command documentation · 9e9ba873
      Alex Clemmer authored
      Fixes #139.
      9e9ba873
  16. 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
  17. 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
  18. 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
  19. Sep 11, 2017
    • Alex Clemmer's avatar
      Add pretty-printing for `prototype search` results · fd0251bc
      Alex Clemmer authored
      When a user runs `prototype search`, we'd like for the output to include
      the name, description, and available template types, and we'd like that
      output to be padded for readability. For example, if the user runs
      `prototype search io.`, we'd like to output something like this:
      
         io.whatever.pkg.foo    Foo's main template    [jsonnet, yaml]
         io.whatever.pkg.foobar Foobar's main template [jsonnet,   yaml, json]
      
      This commit will introduce this style of padded output to the `prototype
      search` subcommand.
      fd0251bc
    • Alex Clemmer's avatar
      Add types for prototype params and templates · 358e6c25
      Alex Clemmer authored
      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.
      358e6c25
  20. Sep 08, 2017