managedfields

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package managedfields provides utilities for extracting and comparing Kubernetes objects based on their managed fields for Server-Side Apply.

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL