How kubernetes-sigs/kustomize works
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: kusttarget.go Target assembly · commands.go Command routing · kustomizer.go Kustomizer · main.go Kustomize CLI
Components 22
CLI and Commands
- Kustomize CLI
kustomize/main.go - Command routing
kustomize/commands/commands.go - Edit commands
kustomize/commands/edit/all.go - Localization command
kustomize/commands/localize/localize.go
Build and Loading
- Kustomizer
api/krusty/kustomizer.go - Target assembly
api/internal/target/kusttarget.go - Config and resource loader
api/internal/loader/loader.go - Filesystem abstraction
kyaml/filesys/filesystem.go
Resource Processing
- Resource accumulator
api/internal/accumulator/resaccumulator.go - Resource collection
api/resmap/resmap.go - Resource generators
api/internal/generators/configmap.go - Built-in transformers
api/internal/builtins/doc.go - Transformation filters
api/filters/filtersutil/setters.go - YAML input and output
kyaml/kio/kio.go - OpenAPI schemas
kyaml/openapi/openapi.go
Plugins and Functions
- Plugin loading
api/internal/plugins/loader/loader.go - Plugin compiler
api/internal/plugins/compiler/compiler.go - KRM function framework
kyaml/fn/framework/framework.go
Configuration Tools
- Config CLI
cmd/config/kubectl-krm/main.go - Config operations
cmd/config/configcobra/cmds.go
Other components
- Kustomize user
- kubectl
Connections 21
- 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