Documentation
¶
Overview ¶
Package managedfields provides utilities for extracting and comparing Kubernetes objects based on their managed fields for Server-Side Apply.
Index ¶
- func Compare(current, desired *unstructured.Unstructured) (*typed.Comparison, error)
- func ExtractAsUnstructured(obj runtime.Object, fieldManager string) (*unstructured.Unstructured, error)
- func GetObjectType(obj runtime.Object) (typed.ParseableType, error)
- func NeedsUpdate(current, desired *unstructured.Unstructured) (bool, error)
- func PruneEmptyFields(u *unstructured.Unstructured)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
func Compare(current, desired *unstructured.Unstructured) (*typed.Comparison, error)
Compare calculates the difference between the current (extracted) and desired objects. Returns a typed.Comparison that contains Added, Modified, and Removed field sets.
func ExtractAsUnstructured ¶
func ExtractAsUnstructured(obj runtime.Object, fieldManager string) (*unstructured.Unstructured, error)
ExtractAsUnstructured extracts the managed fields for a given field manager from a runtime.Object, returning an unstructured.Unstructured containing only the fields managed by that manager. Returns nil if no managed fields entry is found, or an error if extraction fails.
func GetObjectType ¶
func GetObjectType(obj runtime.Object) (typed.ParseableType, error)
GetObjectType returns a ParseableType for the given object using the Kubernetes schema.
func NeedsUpdate ¶
func NeedsUpdate(current, desired *unstructured.Unstructured) (bool, error)
NeedsUpdate checks if the current object needs to be updated to match the desired state. Returns true if there are any differences (additions, modifications, or removals).
func PruneEmptyFields ¶
func PruneEmptyFields(u *unstructured.Unstructured)
PruneEmptyFields removes empty maps, slices, and zero-value fields from the provided unstructured.Unstructured object. This is useful before comparison to avoid false positives.
Types ¶
This section is empty.