configstoresync

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 8 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 configstoresync holds pure helpers shared by the KonnectConfigStoreSync controller and the conflict field indexer: store key derivation, entry resolution, value building and hashing. Keeping them here (instead of in controller/konnect) lets internal/utils/index import them without creating an import cycle.

Index

Constants

View Source
const (
	// MaxKeyBytes is the Konnect Config Store key size cap (512 bytes).
	// Explicit storeKeys are capped by CRD validation, but derived keys are
	// not: a 63-char namespace, 253-char name and 253-char Split field derive
	// a ~582-byte key. The controller enforces this cap pre-write and reports
	// KeyTooLong instead of pushing.
	MaxKeyBytes = 512
	// MaxValueCharacters is the Konnect Config Store value cap in Unicode code points.
	MaxValueCharacters = 8192

	// CombinedCertificateSubField is the frozen JSON subfield holding the
	// certificate in a Combined mode entry value.
	CombinedCertificateSubField = "certificate"
	// CombinedKeySubField is the frozen JSON subfield holding the private key
	// in a Combined mode entry value.
	CombinedKeySubField = "key"
)

Variables

This section is empty.

Functions

func CombinedValue

func CombinedValue(certPEM, keyPEM []byte) ([]byte, error)

CombinedValue builds the Combined mode entry value from the certificate and key PEM data.

func DerivedKey

func DerivedKey(namespace, name string) string

DerivedKey returns the store key derived from the sync's identity using the length-prefixed format k8s-<len(namespace)>-<namespace>-<len(name)>-<name>. The length prefixes make the encoding unambiguous: no two distinct (namespace, name) pairs can produce the same derived key.

func DuplicateStoreKeys

func DuplicateStoreKeys(entries []ResolvedEntry) []string

DuplicateStoreKeys returns the store keys claimed by more than one resolved entry, or nil when all keys are distinct. Status entries are list-keyed by storeKey, so duplicates would both double-write the same Config Store entry and be rejected by the API server on status update.

func ReferenceSuffixes

ReferenceSuffixes returns the status.references entries for a resolved entry: "<storeKey>/<subfield>" per subfield for Combined mode entries, or "<storeKey>" for Split mode entries.

func ValidateX509KeyPair

func ValidateX509KeyPair(certPEM, keyPEM []byte) (notAfter time.Time, err error)

ValidateX509KeyPair validates that certPEM and keyPEM form a valid x509 certificate/key pair, following the tls.X509KeyPair pattern used by the ingress-controller translator. It returns the leaf certificate's NotAfter expiry. A missing or unparsable cert or key fails validation: there is no bypass.

func ValueHash

func ValueHash(value []byte) string

ValueHash returns the "sha256:<hex>" hash of a value. Status, logs and events only ever carry this hash, never Secret plaintext.

Types

type ResolvedEntry

type ResolvedEntry struct {
	// StoreKey is the resolved Config Store entry key (explicit or derived).
	StoreKey string
	// SourceFields are the Secret data keys whose values produce the value.
	SourceFields []string
	// SubFields are the JSON subfields of the stored value each source field
	// maps to. It is empty for Split mode entries (raw values).
	SubFields []string
}

ResolvedEntry is one Config Store entry a sync manages, with its resolved store key and the Secret data fields that produce its value.

func ResolveEntries

ResolveEntries computes the set of Config Store entries a sync manages from its spec alone (no Secret or store data needed), applying key derivation where no explicit storeKey is set.

A Split entry's explicit storeKey may still equal another entry's derived key: CRD validation checks uniqueness of explicit storeKeys only, so the caller must reject duplicate resolved StoreKeys itself (see DuplicateStoreKeys).

Jump to

Keyboard shortcuts

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