# kubernetes-sigs/kustomize architecture

> Architecture diagram of the GitHub repository kubernetes-sigs/kustomize, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kubernetes-sigs/kustomize
- Repository: https://github.com/kubernetes-sigs/kustomize

## Overview

Kustomize builds Kubernetes configuration from a kustomization file and raw YAML resources, applying declared generators and transformations to produce customized YAML without changing the source files. The main path runs from the CLI through the build command and Kustomizer into target loading and resource accumulation, then generates and transforms resources before output. Overlays and bases, editing and localization commands, and plugin-based extensions are separate product capabilities. The README describes the user workflow; the tree supports the subsystem paths, but unsampled implementation details limit some internal wiring.

Main entry points: [`api/internal/target/kusttarget.go`](https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/target/kusttarget.go) (Target assembly), [`kustomize/commands/commands.go`](https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/commands/commands.go) (Command routing), [`api/krusty/kustomizer.go`](https://github.com/kubernetes-sigs/kustomize/blob/master/api/krusty/kustomizer.go) (Kustomizer), [`kustomize/main.go`](https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/main.go) (Kustomize CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and Commands"]
  node_cli["Kustomize CLI<br/>[main.go]"]
  node_commands["Command routing<br/>[commands.go]"]
  node_edit["Edit commands<br/>[all.go]"]
  node_localize["Localization command<br/>[localize.go]"]
end

subgraph group_build["Build and Loading"]
  node_buildengine["Kustomizer<br/>[kustomizer.go]"]
  node_target["Target assembly<br/>[kusttarget.go]"]
  node_loader["Config and resource loader<br/>[loader.go]"]
  node_filesystem["Filesystem abstraction<br/>[filesystem.go]"]
end

subgraph group_resources["Resource Processing"]
  node_accumulator["Resource accumulator<br/>[resaccumulator.go]"]
  node_resmap["Resource collection<br/>[resmap.go]"]
  node_generators["Resource generators<br/>[configmap.go]"]
  node_transformers["Built-in transformers<br/>[doc.go]"]
  node_filters["Transformation filters<br/>[setters.go]"]
  node_yamlio["YAML input and output<br/>[kio.go]"]
  node_openapi["OpenAPI schemas<br/>[openapi.go]"]
end

subgraph group_extensions["Plugins and Functions"]
  node_plugins["Plugin loading<br/>[loader.go]"]
  node_plugincompiler["Plugin compiler<br/>[compiler.go]"]
  node_fnframework["KRM function framework<br/>[framework.go]"]
end

subgraph group_config["Configuration Tools"]
  node_configcli["Config CLI<br/>[main.go]"]
  node_configcommands["Config operations<br/>[cmds.go]"]
end

node_user(("Kustomize user"))
node_kubectl(("kubectl"))

node_user -->|"runs"| node_cli
node_cli -->|"executes"| node_commands
node_commands -->|"builds"| node_buildengine
node_commands -->|"dispatches"| node_edit
node_commands -->|"dispatches"| node_localize
node_buildengine -->|"assembles target"| node_target
node_target -->|"loads configuration"| node_loader
node_loader -->|"reads files"| node_filesystem
node_target -->|"accumulates resources"| node_accumulator
node_accumulator -->|"maintains resources"| node_resmap
node_target -->|"runs generators"| node_generators
node_target -->|"runs transformations"| node_transformers
node_transformers -->|"uses filters"| node_filters
node_target -->|"loads plugins"| node_plugins
node_plugins -->|"compiles plugins"| node_plugincompiler
node_target -.->|"runs functions"| node_fnframework
node_buildengine -->|"writes YAML"| node_yamlio
node_user -->|"runs"| node_configcli
node_configcli -->|"dispatches"| node_configcommands
node_kubectl -.->|"embeds build"| node_cli
node_target -.->|"uses schemas"| node_openapi

click node_cli "https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/main.go"
click node_commands "https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/commands/commands.go"
click node_edit "https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/commands/edit/all.go"
click node_localize "https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/commands/localize/localize.go"
click node_buildengine "https://github.com/kubernetes-sigs/kustomize/blob/master/api/krusty/kustomizer.go"
click node_target "https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/target/kusttarget.go"
click node_loader "https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/loader/loader.go"
click node_filesystem "https://github.com/kubernetes-sigs/kustomize/blob/master/kyaml/filesys/filesystem.go"
click node_accumulator "https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/accumulator/resaccumulator.go"
click node_resmap "https://github.com/kubernetes-sigs/kustomize/blob/master/api/resmap/resmap.go"
click node_generators "https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/generators/configmap.go"
click node_transformers "https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/builtins/doc.go"
click node_filters "https://github.com/kubernetes-sigs/kustomize/blob/master/api/filters/filtersutil/setters.go"
click node_yamlio "https://github.com/kubernetes-sigs/kustomize/blob/master/kyaml/kio/kio.go"
click node_plugins "https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/plugins/loader/loader.go"
click node_plugincompiler "https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/plugins/compiler/compiler.go"
click node_fnframework "https://github.com/kubernetes-sigs/kustomize/blob/master/kyaml/fn/framework/framework.go"
click node_configcli "https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/kubectl-krm/main.go"
click node_configcommands "https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/configcobra/cmds.go"
click node_openapi "https://github.com/kubernetes-sigs/kustomize/blob/master/kyaml/openapi/openapi.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_commands,node_edit,node_localize,node_user toneBlue
class node_buildengine,node_target,node_loader,node_filesystem toneAmber
class node_accumulator,node_resmap,node_generators,node_transformers,node_filters,node_yamlio,node_openapi toneMint
class node_plugins,node_plugincompiler,node_fnframework toneRose
class node_configcli,node_configcommands,node_kubectl toneIndigo
```

## Components

### CLI and Commands

- [Kustomize CLI](https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/main.go): `kustomize/main.go`
- [Command routing](https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/commands/commands.go): `kustomize/commands/commands.go`
- [Edit commands](https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/commands/edit/all.go): `kustomize/commands/edit/all.go`
- [Localization command](https://github.com/kubernetes-sigs/kustomize/blob/master/kustomize/commands/localize/localize.go): `kustomize/commands/localize/localize.go`

### Build and Loading

- [Kustomizer](https://github.com/kubernetes-sigs/kustomize/blob/master/api/krusty/kustomizer.go): `api/krusty/kustomizer.go`
- [Target assembly](https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/target/kusttarget.go): `api/internal/target/kusttarget.go`
- [Config and resource loader](https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/loader/loader.go): `api/internal/loader/loader.go`
- [Filesystem abstraction](https://github.com/kubernetes-sigs/kustomize/blob/master/kyaml/filesys/filesystem.go): `kyaml/filesys/filesystem.go`

### Resource Processing

- [Resource accumulator](https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/accumulator/resaccumulator.go): `api/internal/accumulator/resaccumulator.go`
- [Resource collection](https://github.com/kubernetes-sigs/kustomize/blob/master/api/resmap/resmap.go): `api/resmap/resmap.go`
- [Resource generators](https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/generators/configmap.go): `api/internal/generators/configmap.go`
- [Built-in transformers](https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/builtins/doc.go): `api/internal/builtins/doc.go`
- [Transformation filters](https://github.com/kubernetes-sigs/kustomize/blob/master/api/filters/filtersutil/setters.go): `api/filters/filtersutil/setters.go`
- [YAML input and output](https://github.com/kubernetes-sigs/kustomize/blob/master/kyaml/kio/kio.go): `kyaml/kio/kio.go`
- [OpenAPI schemas](https://github.com/kubernetes-sigs/kustomize/blob/master/kyaml/openapi/openapi.go): `kyaml/openapi/openapi.go`

### Plugins and Functions

- [Plugin loading](https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/plugins/loader/loader.go): `api/internal/plugins/loader/loader.go`
- [Plugin compiler](https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/plugins/compiler/compiler.go): `api/internal/plugins/compiler/compiler.go`
- [KRM function framework](https://github.com/kubernetes-sigs/kustomize/blob/master/kyaml/fn/framework/framework.go): `kyaml/fn/framework/framework.go`

### Configuration Tools

- [Config CLI](https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/kubectl-krm/main.go): `cmd/config/kubectl-krm/main.go`
- [Config operations](https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/configcobra/cmds.go): `cmd/config/configcobra/cmds.go`

### Other components

- **Kustomize user**
- **kubectl**

## Connections

- Kustomize user → Kustomize CLI: runs
- Kustomize CLI → Command routing: executes
- Command routing → Kustomizer: builds
- Command routing → Edit commands: dispatches
- Command routing → Localization command: dispatches
- Kustomizer → Target assembly: assembles target
- Target assembly → Config and resource loader: loads configuration
- Config and resource loader → Filesystem abstraction: reads files
- Target assembly → Resource accumulator: accumulates resources
- Resource accumulator → Resource collection: maintains resources
- Target assembly → Resource generators: runs generators
- Target assembly → Built-in transformers: runs transformations
- Built-in transformers → Transformation filters: uses filters
- Target assembly → Plugin loading: loads plugins
- Plugin loading → Plugin compiler: compiles plugins
- Target assembly → KRM function framework: runs functions
- Kustomizer → YAML input and output: writes YAML
- Kustomize user → Config CLI: runs
- Config CLI → Config operations: dispatches
- kubectl → Kustomize CLI: embeds build
- Target assembly → OpenAPI schemas: uses schemas
