Categorygithub.com/eddycharly/k8s-yaml-diff
repositorypackage
0.1.0
Repository: https://github.com/eddycharly/k8s-yaml-diff.git
Documentation: pkg.go.dev

# README

k8s-yaml-diff

A simple tools to compare two files containing k8s resources.

Install

TODO

Invoke

Mandatory arguments:

  • source the path to the source file containing k8s manifests
  • target the path to the target file containing k8s manifests

Optional arguments:

  • mode should be either full (default) or diff. In diff mode, report will contain only resources that change.
  • normalize when specified, yaml objects are normalized once loaded.

Exemple:

k8s-yaml-diff --mode full --source ./test/source.yaml --target ./test/target.yaml

It will output a simple report in markdown format as shown below.


Changes report [full] 1

Kind (Version)NamespaceNameBA:eyes:
Namespace (v1)dev:white_check_mark::white_check_mark:
Namespace (v1)only-in-source:white_check_mark::red_circle:2
Namespace (v1)only-in-target:red_circle::white_check_mark:3
Namespace (v1)prod:white_check_mark::white_check_mark:
Namespace (v1)test:white_check_mark::white_check_mark:4
RBACDefinition (v1beta1)rbac:white_check_mark::white_check_mark:5

Footnotes

  1. Legend

    • B : Before
    • A : After
  2. v1 / Namespace / only-in-source

    --- source
    +++ target
    @@ -1,4 +1 @@
    -apiVersion: v1
    -kind: Namespace
    -metadata:
    -  name: only-in-source
    
  3. v1 / Namespace / only-in-target

    --- source
    +++ target
    @@ -1 +1,4 @@
    +apiVersion: v1
    +kind: Namespace
    +metadata:
    +  name: only-in-target
    
  4. v1 / Namespace / test

    --- source
    +++ target
    @@ -3,4 +3,4 @@
     metadata:
       name: test
       labels:
    -    origin: source
    +    origin: target
    
  5. rbacmanager.reactiveops.io / v1beta1 / RBACDefinition / rbac

    --- source
    +++ target
    @@ -8,4 +8,4 @@
           - kind: User
             name: eddycharly
         clusterRoleBindings:
    -      - clusterRole: view
    +      - clusterRole: edit