kubernetes-envvar

command module
v0.0.0-...-e8561cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2017 License: GPL-3.0 Imports: 7 Imported by: 0

README

Kubernetes-envvar

Build Status Coverage Status GoDoc Go Report Card

Small cli application to read environment variables from Kubernetes' deployment.yaml, export them and run a command in the "new" environment

This is a WORK IN PROGRESS!!!

Motivation

I've been using Kubernetes for a while now and using environment variables to configure my applications and each environment (staging, production, etc) has got its own deployment.yaml and when the number of environment variables grows past two it gets annoying to run an application locally pointing to a different environment (e.g. staging).

So I decided to write this wee tool to do the "monkey job" of reading the deployment.yaml and exporting the environment variables

Usage

$ ./kubernetes-envvar <type: d|t> <filepath> <command and args>

Arguments:

  • Type: It's either t or d depending on the structure of the yaml file.
  • Filepath: Is the path to the Kubernetes' deployment.yaml
  • Command: Is the command and it's args.

TODO

  • Remove ugly workaround helm templates
  • Parse/replace environment variables on the command and it's arguments
  • Parse deployment.yaml in a more generic way
  • Review the logging/debug messages
  • Return the return code of the command run

Licence

GPLv3

Documentation

Overview

kubernetes-envvar is a cli application to export the environment variables from Kubernetes' deployment.yamal.

kubernetes-envvar reads and exports the environment variables in Kubernetes' deployment.yaml and them and runs a command in the "new" environment

Usage:

kubernetes-envvar <type: d|t> <filepath> <command and args>

Arguments:

type: d|t
  d: means a simple deployment file (see example/deployment.yaml)
  t: means a helm deployment.yaml using template (see example/deploymentWithTemplate.yaml)

filepath:
  is the deployment.yaml filepath

command and args:
  is the command to be run and its args. They're going to be passed directly to exec.Command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL