Gradle plugin that helps to diff Kubernetes manifests that are managed and built with Kustomize.
Apply the plugin to your Kustomize project in the build.gradle.kts file:
plugins {
id("io.github.mikethebeer.gradle.kdiff") version "0.1.0"
}The plugin adds a group of tasks kdiff to your project:
-
kDiffVersion: Prints the version of the plugin and thekdiffcommand line tool. -
installKustomize: Installs thekustomizecommand line tool. Required bykdiffto work.
Note: This task is only supported on Linux and MacOS. If you want to use it on Windows, you have to download and install
kustomizemanually for example by using the Chocolatey package manager.
installKDiff: Installs thekdiffcommand line tool. This is a wrapper aroundkustomizethat adds the ability to diff manifests between different branches.
Note: By default,
kdiffwill use thekustomizeexecutable that is installed next to thekdiffexecutable. If you want to use a differentkustomizeexecutable, you can set it as the--kustomizeargument inkdiff.
The kdiff CLI will be installed into the build/bin directory of your project. You can add this directory to your
.gitignore file in order to avoid committing the CLI to your repository.
./build/bin/kdiff <path-to-kustomize-file> -b <remote-branch>Example:
./build/bin/kdiff k8s/ -b origin/masterkdiff will then create a temporary directory and clone the remote branch into it. It will then run kustomize build
on both the local and the remote branch and diff the resulting manifests.
- Currently, only diffs against remote (pushed) branches are supported. Diffs against local branches are not supported yet.