Documentation ¶
Overview ¶
Package apply is a client-side substitute for `Kubernetes server side apply`. It tries to guess the right thing to do without any type-specific knowledge. Instead of generating a PATCH request, it does the patching locally and returns a full object with the ResourceVersion intact.
credit: https://github.com/AmitKumarDas/metac/tree/master/dynamic/apply
Index ¶
- func GetLastApplied(obj *unstructured.Unstructured) (map[string]interface{}, error)
- func GetLastAppliedByAnnKey(obj *unstructured.Unstructured, annKey string) (map[string]interface{}, error)
- func Merge(observed, lastApplied, desired map[string]interface{}) (map[string]interface{}, error)
- func SanitizeLastAppliedByAnnKey(last map[string]interface{}, annKey string)
- func SetLastApplied(obj *unstructured.Unstructured, lastApplied map[string]interface{}) error
- func SetLastAppliedByAnnKey(obj *unstructured.Unstructured, lastApplied map[string]interface{}, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLastApplied ¶
func GetLastApplied(obj *unstructured.Unstructured) (map[string]interface{}, error)
GetLastApplied returns the last applied state of the given object. Last applied state is derived based on a predefined annotation key to store last applied state.
func GetLastAppliedByAnnKey ¶
func GetLastAppliedByAnnKey(obj *unstructured.Unstructured, annKey string) (map[string]interface{}, error)
GetLastAppliedByAnnKey returns the last applied state of the given object based on the provided annotation
func Merge ¶
Merge updates the observed object with the desired changes. Merge is based on a 3-way apply that takes in observed state, last applied state & desired state into consideration.
func SanitizeLastAppliedByAnnKey ¶
SanitizeLastAppliedByAnnKey sanitizes the last applied state by removing last applied state related info (i.e. its own info) to avoid building up of nested last applied states.
In other words, last applied state might have an annotation that stores the previous last applied state which in turn might have an annotation that stores the previous to previous last applied state. This nested annotation gets added everytime a reconcile event happens for the resource that needs to be applied against Kubernetes cluster.
func SetLastApplied ¶
func SetLastApplied(obj *unstructured.Unstructured, lastApplied map[string]interface{}) error
SetLastApplied sets the last applied state against a predefined annotation key
func SetLastAppliedByAnnKey ¶
func SetLastAppliedByAnnKey( obj *unstructured.Unstructured, lastApplied map[string]interface{}, annKey string, ) error
SetLastAppliedByAnnKey sets the last applied state against the provided annotation key
Types ¶
This section is empty.