cache

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyStripAnnotationsTransform

func ApplyStripAnnotationsTransform(obj client.Object) error

ApplyStripAnnotationsTransform applies the strip transform directly to an object. This is a convenience function for cases where you need to strip fields from an object outside of the cache transform context.

Note: This function never returns an error in practice, but returns error to satisfy the TransformFunc interface.

func StripAnnotations

func StripAnnotations() toolscache.TransformFunc

StripAnnotations returns a cache transform function that removes memory-heavy annotation fields that aren't needed for controller operations. This significantly reduces memory usage in informer caches by removing: - kubectl.kubernetes.io/last-applied-configuration annotation (can be very large)

Use this function as a DefaultTransform in controller-runtime cache.Options to reduce memory overhead across all cached objects.

Example:

cacheOptions := cache.Options{
    DefaultTransform: cacheutil.StripAnnotations(),
}

func StripManagedFieldsAndAnnotations

func StripManagedFieldsAndAnnotations() toolscache.TransformFunc

StripManagedFieldsAndAnnotations returns a cache transform function that removes memory-heavy fields that aren't needed for controller operations. This significantly reduces memory usage in informer caches by removing: - Managed fields (can be several KB per object) - kubectl.kubernetes.io/last-applied-configuration annotation (can be very large)

Use this function as a DefaultTransform in controller-runtime cache.Options to reduce memory overhead across all cached objects.

Example:

cacheOptions := cache.Options{
    DefaultTransform: cacheutil.StripManagedFieldsAndAnnotations(),
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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