Skip to content
Snippets Groups Projects
  1. Feb 01, 2018
  2. Dec 12, 2017
  3. Dec 01, 2017
  4. Nov 27, 2017
  5. Nov 21, 2017
    • Jessica Yuen's avatar
      Support renaming of envs to parent & child directories · 385da08e
      Jessica Yuen authored
      Currently, there are limitations around the file system we are using
      that does not easily allow renaming of `us-west/prod` to `us-west`, or
      vice versa - `us-west` to `us-west/prod`.
      
      This commit will handle the logic to allow for that by moving the file
      contents.
      385da08e
  6. Nov 16, 2017
    • Jessica Yuen's avatar
      Rename <env>.jsonnet file to main.jsonnet · f6fc32a1
      Jessica Yuen authored
      Currently, creating a `dev` environment will create a file
      `dev.jsonnet`. Creating a `prod` environment will create a file
      `prod.jsonnet`. This is a little more complex and prone to error than it
      needs to be, especially when we are renaming environments. It will also
      make this file easier to refer to in documentation if we give the file a
      static name -- `main.jsonnet`.
      f6fc32a1
  7. Nov 15, 2017
    • Jessica Yuen's avatar
      Normalize environment server URL · c188bc9b
      Jessica Yuen authored
      As part of the environments feature, we want to be able to deploy to a
      specific cluster given the environment's URI. We cross-check against
      kubecfg for this URI's location. For fail-safe comparison, we probably
      want to normalize these URIs.
      c188bc9b
  8. Nov 09, 2017
  9. 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
      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
  10. Oct 31, 2017
    • 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
  11. Oct 26, 2017
  12. Oct 17, 2017
    • 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
  13. 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 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
      Add .metadata folder to env dir structure · f95863fc
      Jessica Yuen authored
      This change simply hides the environment metadata details that we do not
      want users directly modifying into a .metadata folder.
      f95863fc
  14. Sep 26, 2017
    • Jessica Yuen's avatar
      Fix 'env set' where --name flag is not specified · e5e1a1c1
      Jessica Yuen authored
      There is a bug where if --name is not passed during env set, an error is
      thrown due to failed validation checking on an empty name. This commit
      fixes this bug.
      e5e1a1c1
    • Alex Clemmer's avatar
      Harden `metadata.isValidName` · 4c3488eb
      Alex Clemmer authored
      Currently `metadata.isValidName` will admit names that should be invalid
      (e.g., names with spaces, leading '/' characters) and not admit names
      that should be valid (e.g., names with '.' characters inside).
      
      This commit moves this function into `metadata/interface.go` and hardens
      it against these constraints.
      4c3488eb
  15. Sep 21, 2017
    • 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
  16. Sep 20, 2017
    • Alex Clemmer's avatar
      Adopt 0755 as default permissions for folders · 725347fc
      Alex Clemmer authored
      Under certain circumstances, it is possible for operations to fail
      because of permissions that are too restrictive. Here we adopt the
      default permissions of 0755 (i.e., rwxr-xr-x), which should be a better
      balance of restriction and flexibility.
      725347fc
  17. 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
  18. Sep 18, 2017
    • Alex Clemmer's avatar
      Set default permissions in `metadata.Manager` to 0644 · d6b691cc
      Alex Clemmer authored
      Currently all files and folders created with the `metadata.Manager`
      (which is the core FS management subsystem) are created with permissions
      0777, i.e., everyone has all permissions.
      
      This commit transistions us to a more locked down permissions set, 0644,
      which allows the user to do everything except execute, and everyone else
      to only read.
      
      Since we don't store any app code that needs to be executed, this should
      be suitable for everything.
      
      Fixes #136.
      d6b691cc
    • 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
  19. 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
  20. 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