Documentation ¶
Index ¶
Constants ¶
const BaseKustomizationPath = "/kustomize/base/kustomization.yaml"
BaseKustomizationPath is the location for the base kustomization.yaml file. This controller expects to find this file among the read files from the embed reference. This is the file that, after parse, is send over to all registered KMutators for further transformations.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FSMutator ¶
type FSMutator func(context.Context, filesys.FileSystem) error
FSMutator is a function that is intended to mutate a embed files prior to rendering them as a kustomize graph.
type KustomizeMutator ¶
type KustomizeMutator func(context.Context, *types.Kustomization) error
KustomizeMutator is a function that is intended to mutate a Kustomization struct.
type ObjectMutator ¶
ObjectMutator is a function that is intended to mutate a Kubernetes object.
type Option ¶
type Option func(*Renderer)
Option is a function that sets an option in a Renderer.
func WithFSMutator ¶
WithFSMutator register a filesystem mutator into the controller. FS mutators are called before the Kustomize and Object mutators, allows for fine grained changes on the filesystem prior to rendering objects with kustomize.
func WithKustomizeMutator ¶
func WithKustomizeMutator(mutator KustomizeMutator) Option
WithKustomizeMutator register a Kustomization mutator into the controller.
func WithObjectMutator ¶
func WithObjectMutator(mutator ObjectMutator) Option
WithObjectMutator register an Object mutator into the controller.
func WithUnstructured ¶
func WithUnstructured() Option
WithUnstructured uses unstructured objects instead of typed ones.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer is a base controller to provide some tooling around rendering and creating resources based in a kustomize directory struct. Files are expected to be injected into this controller by means of an embed.FS struct. The filesystem struct, inside the embed.FS struct, is expected to comply with the following layout:
/kustomize /kustomize/base/kustomization.yaml /kustomize/base/object_a.yaml /kustomize/base/object_a.yaml /kustomize/overlay0/kustomization.yaml /kustomize/overlay0/object_c.yaml /kustomize/overlay1/kustomization.yaml /kustomize/overlay1/object_d.yaml
In other words, we have a base kustomization under base/ directory and each other directory is treated as an overlay to be applied on top of base.
func NewRenderer ¶
NewRenderer returns a kustomize renderer reading and applying files provided by the embed.FS reference. Files are read from 'emb' into a filesys.FileSystem representation and then used as argument to Kustomize when generating objects.
func (*Renderer) Render ¶
Render applies provided overlay and creates objects in the kubernetes API using internal client. In case of failures there is no rollback so it is possible that this ends up partially creating the objects (returns at the first failure). Prior to object creation this function feeds all registered OMutators with the objects allowing for last time adjusts. Mutations in the default kustomization.yaml are also executed here.