Documentation
¶
Index ¶
- func LoadFS(content embed.FS) (filesys.FileSystem, error)
- type FSMutator
- type KustomizeMutator
- type ObjectMutator
- type Option
- func WithFSMutator(mutator FSMutator) Option
- func WithFieldOwner(owner string) Option
- func WithForceOwnership() Option
- func WithKustomizeMutator(mutator KustomizeMutator) Option
- func WithObjectMutator(mutator ObjectMutator) Option
- func WithPostApplyAction(action PostApplyAction) Option
- func WithUnstructured() Option
- type PostApplyAction
- type Renderer
Constants ¶
This section is empty.
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 WithFieldOwner ¶
WithFieldOwner specifies the string to be used when patching objects. This sets the field manager on the patch request.
func WithForceOwnership ¶
func WithForceOwnership() Option
WithForceOwnership sets the force ownership option during calls to Patch.
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 WithPostApplyAction ¶
func WithPostApplyAction(action PostApplyAction) Option
WithPostApplyAction register a post apply action into the controller. Post apply actions are called after the object is created in the API server. These actions are called sequentially and the creation of new objects is resumed once all actions return no error.
func WithUnstructured ¶
func WithUnstructured() Option
WithUnstructured uses unstructured objects instead of typed ones.
type PostApplyAction ¶
PostApplyAction is a function that is intended to be executed after the creation of an object. These functions are called after each object is created. The creation of new objects resumes once these functions returns no error.
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/overlay0/kustomization.yaml /kustomize/overlay0/object_c.yaml /kustomize/overlay1/kustomization.yaml /kustomize/overlay1/object_d.yaml /kustomize/overlay2/kustomization.yaml /kustomize/overlay2/patch.yaml
The structure above can be read as three different overlays, one can refer to the others by means of the kustomization.yaml file. The kustomization.yaml file is expected to be a valid kustomize file. The other files are expected to be valid Kubernetes objects or patches.
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) Apply ¶
Apply 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.