1. 04 Nov, 2017 8 commits
    • 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
      Add interface for retrieving environment params · e2d770a7
      Jessica Yuen authored
      The goal of this commit is to add an interface to `metadata.Manager`
      that allows retrieving of all environment params:
      `getEnvironmentParams(envName)`.
      
      This is done by:
      
      1. Adding functionality to the snippet parser to get all environment
      params out of the snippet read from
      `environments/<env>/params.libsonnet`
      
      2. Adding functionality to the snippet parser to get all component
      params out of the snippet read from `components/params.libsonnet`
      
      3. Having the `metadata.Manager` implementation handle the 'joining' of
      params from 1) and 2), and returning that result.
      e2d770a7
    • Jessica Yuen's avatar
      Handle writing of environment params · 173e0082
      Jessica Yuen authored
      This commit will add an interface `SetEnvironmentParams` to
      metadata.Manager that allows setting of env params.
      
      Also implements the logic for parsing the jsonnet snippet to
      append / modify params in simple env param schemas. It will:
      
      1. Update the params if the component exists in the jsonnet
      snippet.
      2. Add the component if it does not exist.
      173e0082
    • Jessica Yuen's avatar
      Implement logic for retrieving component params · ba201148
      Jessica Yuen authored
      This commit will add an interface `GetComponentParams` to
      metadata.Manager that returns a map of parameters for the passed in
      component.
      
      Also implements the logic for parsing the jsonnet snippet to retrieve
      the parameters.
      
      This functionality will later support new commands to list parameters.
      ba201148
    • Jessica Yuen's avatar
      Implement logic for setting component params · 994c4922
      Jessica Yuen authored
      This commit will:
      
      1. Add an interface `SetComponentParams` to metadata.Manager that takes
      a list of parameters and sets those fields for the given component.
      
      2. Add the jsonnet snippet manipulation logic that does the
      'setting'. Parameters are set by:
      
      a. Keeping track of the parameters that are to be modified / added --
      this defaults to the parameters provided to us.
      b. Discovering the current parameters in the existing snippet.
      c. Adding any parameters from (b) that is not in (a).
      d. Swapping out the old parameters with (c) in the snippet based on
      the location text span, and returning the new snippet.
      994c4922
    • 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
    • Jessica Yuen's avatar
      Rewrite system prototype params to use import 'param://...' format · 480edded
      Jessica Yuen authored
      Rewrite system prototype params from `${foo}` format to `import
      'param://foo'` so that they can be parsed correctly by the jsonnet
      snippet.
      480edded
  2. 31 Oct, 2017 4 commits
    • Jessica Yuen's avatar
      Jsonnet Snippet Parser should translate params based on updated spec · 815ffc7c
      Jessica Yuen authored
      This commit will cause the jsonnet snippet parser to parse input of the
      form `import 'param://foo` to `params.foo` as opposed to the previous
      `${foo}`.
      
      ${foo} does not provide an easily accessible way to the params that are
      exposed through the params.libsonnet file. Since parameters are being
      exposed using a local 'params' variable, it makes sense for the jsonnet
      snippet to parse `import param://foo as `params.foo` instead.
      815ffc7c
    • 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
      expansion.
      d55fbed6
    • Jessica Yuen's avatar
      Generate environment param file · 16af8bcc
      Jessica Yuen authored
      This commit will generate the `environments/<env>/params.libsonnet` file
      on `env add <env>`.
      
      The purpose of this file is to allow users to define custom parameters
      on an environment-to-environment basis. It is meant to allow for
      "overrides" to component params.
      16af8bcc
    • Jessica Yuen's avatar
      Generate components/params.libsonnet file · 53af2792
      Jessica Yuen authored
      The purpose of this file is to allow re-parameterization of components
      after they are created.
      
      `components/params.libsonnet` is generated on `ks init`. This file will
      contain a jsonnet obj containing two objs:
      
      1. global: contains user-defined global parameters; accessible to all
      component and environments.
      2. components: contains component-level parameters, defined initially
      from `ks prototype use ...`
      
      These objs are empty by default.
      53af2792
  3. 26 Oct, 2017 9 commits
  4. 25 Oct, 2017 6 commits
  5. 23 Oct, 2017 1 commit
  6. 20 Oct, 2017 1 commit
    • Jessica Yuen's avatar
      Remove link to releases page · 152d34f8
      Jessica Yuen authored
      ksonnet.next isn't released yet. This message remained as a port from
      the original README file in the kubecfg project.
      152d34f8
  7. 19 Oct, 2017 1 commit
  8. 17 Oct, 2017 6 commits
  9. 06 Oct, 2017 4 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
      environments/default/default.jsonnet`.
      6378e75a
    • Jessica Yuen's avatar
      Add test for Manager.LibPaths · fdbdf59a
      Jessica Yuen authored
      fdbdf59a
    • Jessica Yuen's avatar
      Generate per-environment override file · 43896a67
      Jessica Yuen authored
      This commit will generate an "<env-name>.jsonnet" file when an
      environment is created.
      
      For example, the default environment would have the following tree
      structure:
      ├── environments
      │   ├── base.libsonnet
      │   └── default
      │       ├── .metadata
      │       │   ├── k.libsonnet
      │       │   ├── k8s.libsonnet
      │       │   └── swagger.json
      │       ├── default.jsonnet
      │       └── spec.json
      
      The goal of this file is to allow users to extend on base.libsonnet on a
      per-environment basis to allow for custom overrides, such as replica
      count.
      43896a67
    • 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