Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MutateIfApplicable ¶
func MutateIfApplicable[T runtime.Object]( obj *unstructured.Unstructured, vars map[string]apiextensionsv1.JSON, holderRef *runtimehooksv1.HolderReference, patchSelector clusterv1.PatchSelector, log logr.Logger, mutFn func(T) error, ) error
MutateIfApplicable applies the typed mutFn function to the unstructured input if the input matches the holderRef and patchSelector. This is used by handlers to reduce the boilerplate required there.
This function makes it easier for handlers to work with typed objects, while ensuring that patches properly work with minimal input documents. While it would feel more natural to work purely with typed objects, due to the semantics of `omitempty` and non-pointer struct fields, it is required to work with unstructured objects for input and output. This leads to minimal patches, regardless of the completeness of the input type.
Types ¶
This section is empty.