projectkit

package
v0.0.1-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package projectkit holds the deterministic encoding and Kubernetes object helpers shared by AgentShield plugin projectors.

Every value produced here feeds graph identity qualifiers, configuration digests, attributes, or evidence IDs, so the output format is a stability contract: changing it changes published assertions and retracts the previous ones on the next contribution replacement. Treat any change as a new rule ID in every affected projector.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Digest

func Digest(value any) string

Digest returns the hex SHA-256 of the canonical JSON encoding of value. It panics under the same conditions as MustCanonicalJSON.

func DisplayName

func DisplayName(item *unstructured.Unstructured) string

DisplayName returns namespace/name for namespaced objects and name for cluster-scoped ones. Display names are mutable attributes, never identity.

func KubernetesEventID

func KubernetesEventID(key, resourceVersion, operation string) string

KubernetesEventID is the native event ID the Kubernetes plugin publishes for one operation ("upsert" or "delete") on one revision of the object with ObjectKey key. Projectors cite the same ID through KubernetesEvidenceID or the collection change's EventID, so evidence resolves to its receipt.

func KubernetesEvidenceID

func KubernetesEvidenceID(item *unstructured.Unstructured) string

KubernetesEvidenceID names the Kubernetes observation that supports an assertion. With a resource version it is the KubernetesEventID of that revision's upsert; without one, typically for fixture or synthesized objects, it falls back to the UID alone.

func MustCanonicalJSON

func MustCanonicalJSON(value any) string

MustCanonicalJSON encodes value with encoding/json, which sorts map keys and emits struct fields in declaration order. Callers sort set-like slices first.

Projector inputs are plain strings, numbers, bools, slices, string-keyed maps, and values already decoded from provider JSON, none of which can fail to marshal. A failure therefore means a projector passed an unsupported type such as a channel, func, or non-finite float; MustCanonicalJSON panics rather than returning an empty string that would silently collapse distinct qualifiers and digests into one.

func ObjectKey

func ObjectKey(item *unstructured.Unstructured) string

ObjectKey returns the lowercased apiVersion/kind/UID of item, or "" for nil. The UID makes it stable across renames and distinct across delete/recreate.

func Qualifier

func Qualifier(value any) string

Qualifier returns a 24-hex-character SHA-256 prefix of the canonical JSON encoding of value. Relationship and facet qualifiers use it to distinguish semantically different assertions between the same endpoints without depending on input order or slice positions.

func SecurityDigest

func SecurityDigest(value any) string

SecurityDigest returns Digest prefixed with "sha256:", the form used for graph.SecuritySemantics configuration digests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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