kustomtree

A tool to sort Kustomize manifests into kind based directories

Stars
4

kustomtree go

This is a command line tool for refactoring of Kustomize manifests.

It sorts manifests into kind based directories. For example,

.
├── deployment
│   └── hello-world.yaml
├── service
│   └── hello-world.yaml
├── ingress
│   └── hello-world.yaml
└── kustomization.yaml

It finds kustomization.yaml and performs the following steps for each kustomization.yaml:

  1. Run kustomize build.
  2. Find Kubernetes resources in files specified in resources and patchesStrategicMerge.
  3. Move a Kubernetes resource into a file of KIND/NAME.yaml.
    • Placeholder (like -${FOO}) is removed.
    • Special character (:) is replaced with -.
  4. Run kustomize build.
  5. Verify that the rendered manifests of 2 and 4 are same.
    This ensures no breaking change in refactoring.

Getting Started

go get github.com/int128/kustomtree

Exclude path

You can exclude manifest(s) from refactoring by -exclude-path-regexp flag.

For example, pass -exclude-path-regexp=^vendor/ to exclude files in vendor directory, like:

.
├── deployment
│   └── hello-world.yaml
├── vendor
│   └── generated.yaml
└── kustomization.yaml

Contributions

This is an open source software. Feel free to open issues and pull requests.

Package Rankings
Top 9.86% on Proxy.golang.org
Badges
Extracted from project README
go