Git Product home page Git Product logo

kubediff's Introduction

kubediff

Table of Contents

Showcase

showcase The showcase demonstrates an upgrade of agones

Kubediff Kubectl diff
comparison_kubediff comparison_original
Notice that kubediff has removed the hated managedFields

About The Project

What

Used to sanity check and understand what has changed between environments.

This cli tool written in Rust is a wrapper around kubectl diff and is supposed to diff one or multiple projects instead of single files against any environment you want, be it docker-desktop, dev, prod.

It takes a glob pattern to one or more projects and beautifies the output so you can get an understanding on what differences there are.

Why

Ever asked yourself, what is deployed on my cluster? Or,

  • are all changes applied to the cluster?
  • What differences are there between the environments?
  • What have I forgotten to deploy?
  • Has something changed without us knowing it?
  • Forgot to add a change in git after hotfixing it in prod? Well, look no further...well a couple of lines further, I guess...

How

We will loop over the projects files and run kubectl build, then pipe the output into kubectl diff and then process the output of that to make it pretty.

Getting Started

Prerequisite

  • yq is needed for less clutter (can be made optional fairly easy)

Installation

Download and extract the binary.

KUBEDIFF_VERSION=0.1.5 && \
KUBEDIFF_OS=x86_64-unknown-linux-gnu && \
wget "https://github.com/Ramilito/kubediff/releases/download/${KUBEDIFF_VERSION}/kubediff_${KUBEDIFF_VERSION}_${KUBEDIFF_OS}.tar.gz" && \
mkdir -p $HOME/.kube/kubediff && tar zxpf kubediff_${KUBEDIFF_VERSION}_${KUBEDIFF_OS}.tar.gz -C $HOME/.kube/kubediff

Add it to your PATH in .zshrc/.bashrc.

export PATH="$PATH:/home/$USER/.kube/kubediff"

Usage

Configuration

Se the available commands by running kubediff -h

Regular usage would be to list your projects in the config.yaml file located at the install directory

Few projects, will use the kustomization file located at that path:

configs:
    include:
        - "~/projectone/serviceone/k8s"
        - "~/projecttwo/servicetwo/k8s"

Many projects (monorepo), will use glob pattern to find all services:

configs:
    include:
        - "~/monorepo/Services/**/k8s"

Many environments, will suffix the variable to end of the paths in config.yaml, example below will look in "~/monorepo/Services/**/k8s/dev"

kubediff -e dev

You can also bypass the config by passing either -path or -inplace argument:

kubediff -p ~/path-to-dir-or-file
kubediff -i 

Roadmap

  • Remove, make optional or include dependency on yq
  • Change theme with input

Troubleshooting

kubediff's People

Contributors

ramilito avatar

Stargazers

Mattias Cockburn avatar Luís Guimarães avatar Valentine Ezeja avatar  avatar x-dean avatar Sri avatar Lucas Riutzel avatar Carlos dC avatar manuel.cruanes avatar  avatar  avatar Alexander Råsten avatar Kit Sirota avatar Alexander Miroshnichenko avatar  avatar Christian VDZ avatar Claudio Pastorini avatar Shawn avatar Felipe Bocolowski avatar  avatar  avatar  avatar Tim Schrumpf avatar Frank avatar Apurva avatar Pavel Tishkov avatar josephedward avatar Tao Hansen avatar Rachid Zarouali avatar Fabio Knoedt avatar  avatar Thiago Rider Augusto avatar Adrien DEVIENNE avatar Magno Logan avatar Ivan Tomica avatar Ikiru Yoshizaki avatar houseme avatar Rodrigo Cosme avatar Gonzalo Cheliz avatar  avatar  avatar Maksim avatar Able Lv avatar Michal Kozák avatar Christian Heggland avatar  avatar Nishant avatar Bryan A. S. avatar Jeffrey Doto avatar Kevin Kirkpatrick avatar  avatar Martijn Pepping avatar Marcel Heers avatar  avatar Dieter De Meyer avatar Akif Feyzioğlu avatar Timothy Colbert avatar Marius Rugan avatar Vincent Quéméner avatar cocoonk1d avatar Justin Garrison avatar Cem Anaral avatar  avatar Vincent Palmer avatar Adrian Izdebski avatar Derek Rushing avatar Borko avatar Ashwin Francis avatar Necatican Yıldırım avatar Manuel Rüger avatar Keiran Smith avatar Chris Burton avatar mr.shintla avatar Chris "Not So" Short avatar Stefan Genov avatar Mark Penner avatar Lukáš Fuchs avatar Maksym Lisogorskyi avatar Frank avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kubediff's Issues

Faster runs

Is your feature request related to a problem? Please describe.

There should be a way to run each file on a thread or gather them and run them in batches.

Describe the solution you'd like

Use multithreading to lower the execution time.

Describe alternatives you've considered

Waiting for ever

Additional context

Bypass config file for quick checks

Is your feature request related to a problem? Please describe.

I'm getting annoyed at having to modify the .kube/kubediff/config file for just a quick sanity check

Describe the solution you'd like

A way to run kubediff quickly against a single project/build.
Running from current directory

kubediff -i 

Running a specific path

kubediff -p some-path

LogLevel

Is your feature request related to a problem? Please describe.

A way to set log level as a default in config and use command line argument to override

Describe the solution you'd like

The default log level should be Error. Then we should be able to increase it to Warning and Info

Describe alternatives you've considered

Always printing everything or not printing anything

Threadpooling

Is your feature request related to a problem? Please describe.

Since we use threads for each Kustomize resource, it can lead to a large thread count.

Describe the solution you'd like

Introduce threadpooliing

Describe alternatives you've considered

Buying more cpu cores....

Additional context

Extending key/value filtering

Is your feature request related to a problem? Please describe.

The current annotation deletion is buggy and hard to extend:

  .metadata.annotations == with_entries(select(.key == "kubectl.kubernetes.io/last-applied-configuration"))

It also seems to just delete all the annotations instead of the key matched.

Describe the solution you'd like

This is easier to deal with:

  .metadata.annotations["kubectl.kubernetes.io/last-applied-configuration"],

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.