Skip to content
Snippets Groups Projects
  1. Oct 26, 2017
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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