Coder Social home page Coder Social logo

devops-utils's Introduction

Common DevOps utilities in a docker image

What's inside

How to use it

Add a shortcut

For a shortcut we need to consider aws and kubernetes credentials.
To avoid typing all that stuff every time, we can add a shell function to our profile:

# devops utils
dou() {
  local kube_config_dir="${HOME}/.dou/kube"
  local aws_config_dir="${HOME}/.dou/aws"
  
  # create kube config dir 
  if [ ! -d "${kube_config_dir}" ]; then
    mkdir -p "${kube_config_dir}"
  fi
  
  # create aws config dir 
  if [ ! -d "${aws_config_dir}" ]; then
    mkdir -p "${aws_config_dir}"
  fi
  
  env | grep "DOU_VERSION_" > "${HOME}/.dou/versions.env"
  
  # use -it if intent bash or sh
  docker_interactivity_flags="-i"
  arguments="${@}"
  if [ "${arguments}" = "bash" ] ||
    [ "${arguments}" = "/bin/bash" ] ||
    [ "${arguments}" = "sh" ] ||
    [ "${arguments}" = "/bin/sh" ]; then
    docker_interactivity_flags="-it"  
  fi
  
  # run the image with the command
  docker run --rm ${docker_interactivity_flags} \
    --env-file "${HOME}/.dou/versions.env" \
    -v "${HOME}/.dou/kube:/root/.kube" \
    -v "${HOME}/.dou/aws:/root/.aws" \
    -v "$(pwd):/workspace" \
    kickthemooon/devops-utils \
    $@
}

Running this shortcut function creates a configuration directory under:

$HOME/.dou

This is used for configuration files of aws, kubectl and others

Versions

To see installed versions for each tool run:

dou info

By default, the highest versions are used.
You can also take a look at versions.yaml.

Change versions

You can change versions by using env variables (DOU_VERSION_[TOOL_NAME]):

DOU_VERSION_KUBECTL="1.15.3" dou kubectl version --client

Usage examples

# jq
cat some.json | dou jq

# yq
cat some.json | dou yq

# helm
dou helm

# terraform
dou terraform

# aws-cli
dou aws

# bash
dou bash

# helm / kubernetes validation
dou helm template app ./chart | dou kubeconform

devops-utils's People

Contributors

kickthemooon avatar

Stargazers

 avatar App Service avatar  avatar

Watchers

 avatar

devops-utils's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.