Expand description
Kustomize build operations.
Ported from internal/backends/kustomize/{interface,client}.go. Go
builds in process against the kustomize Go library (krusty),
never shelling out to a kustomize binary – there is no Rust
equivalent of krusty to link against. This port instead shells out
to the real kustomize build binary via [xianyun_executor::exec:: CommandRunner] (the same mechanism every other backend in this
crate uses), which gives generator (secretGenerator/
configMapGenerator) and replacements support – and kustomize’s
own remote-target resolution – for free, rather than hand-rolling a
partial reimplementation of kustomize’s YAML processing semantics.
See PORT_NOTES.md for the full design rationale.
FileSystem (this crate’s own invention, not a port of sigs.k8s. io/kustomize/kyaml/filesys.FileSystem) still exists so unit tests can
stay hermetic: Client::build walks and reads the kustomize
directory through this trait, stages a copy on a real temporary
directory (the real kustomize binary can only read from disk), and
then invokes the real binary against that staging copy. A remote
target (file://...//overlay?ref=..., https://..., …) bypasses
FileSystem and staging entirely: kustomize resolves those itself
(shallow git clone included), so the target string is passed straight
through to the binary.
Modules§
- remote
- Remote kustomize target helpers.
Structs§
- Client
- Ported from
Clientinclient.go. - Disk
File System - The real on-disk
FileSystem: Go’s zero-argumentNewClientdefaults tofilesys.MakeFsOnDisk(), and production callers of this port’sClient::newneed the equivalent – everyFileSystemimplementor elsewhere in the workspace is test-only (an in-memory map), since nothing needed a real-disk one until a production caller (thedeployer::kustomizemanager) had an on-disk kustomization directory, built bybuiltin::materialize_builtin_overlay, to build.
Enums§
- Kustomize
Error - Ported from the error
Client::Buildwraps:kustomizer.Run/resources.AsYamlfailures, and context cancellation.
Traits§
- Backend
- Ported from the
Backendinterface ininterface.go. - File
System - Ported from the subset of
sigs.k8s.io/kustomize/kyaml/filesys. FileSystemthatClient::buildneeds:WriteFile/ReadFile(for test fixtures to populate a hermetic directory tree) pluswalk, which this port adds soClient::buildcan enumerate every file under a directory to stage it onto real disk before invoking the realkustomizebinary.walkdefaults to “unsupported” so existingFileSystemimplementors elsewhere in the workspace (which predate this method) keep compiling without needing to implement it themselves; an implementor that wants its fixtures to exercise real generator/replacement builds throughClient::buildmust override it.