inventory

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package inventory contains controller-local ownership inventory helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeDigest

func ComputeDigest(entries []releasesv1alpha1.InventoryEntry) string

ComputeDigest returns a deterministic SHA-256 digest of the inventory entries. Entries are sorted by Group, Kind, Namespace, Name, Component, Version before hashing. Returns a string in the format "sha256:<hex>".

func ComputeStaleSet

func ComputeStaleSet(previous, current []releasesv1alpha1.InventoryEntry) []releasesv1alpha1.InventoryEntry

ComputeStaleSet returns entries present in previous but absent from current. Uses K8sIdentityEqual for comparison: matches on Group, Kind, Namespace, and Name only. Version is excluded so API migrations (e.g. v1beta1 → v1) do not produce false stale entries, and Component is excluded so CUE refactors that move a resource between components do not destroy the live object that SSA apply patches in place.

func IdentityEqual

func IdentityEqual(a, b releasesv1alpha1.InventoryEntry) bool

IdentityEqual returns true if two entries identify the same owned resource, component-aware. Compares Group, Kind, Namespace, Name, and Component. Version is excluded to prevent false orphans during Kubernetes API version migrations.

This helper is NOT the comparator used by ComputeStaleSet — that uses K8sIdentityEqual so component renames (same GVK+namespace+name, different component label) do not produce stale entries for live objects that SSA apply patches in place. Callers needing K8s-resource identity (the apiserver view: one live object per GVK+namespace+name) MUST use K8sIdentityEqual.

func K8sIdentityEqual

func K8sIdentityEqual(a, b releasesv1alpha1.InventoryEntry) bool

K8sIdentityEqual returns true if two entries identify the same Kubernetes resource. Compares Group, Kind, Namespace, and Name only (excludes Version and Component).

func NewEntryFromResource

NewEntryFromResource creates an inventory entry from an unstructured Kubernetes resource. Extracts GVK, namespace, name, and the component label.

Types

type Current

type Current = releasesv1alpha1.Inventory

Current is the controller's current ownership inventory view.

Jump to

Keyboard shortcuts

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