Documentation
¶
Index ¶
- Constants
- Variables
- type MemStore
- func (s *MemStore) Delete(ctx context.Context, owner OwnerRef, rolloutGeneration int64) error
- func (s *MemStore) Get(ctx context.Context, owner OwnerRef, rolloutGeneration int64) (payload []byte, configHash string, err error)
- func (s *MemStore) ListByOwner(ctx context.Context, owner OwnerRef) (rolloutGenerations []int64, err error)
- func (s *MemStore) Put(ctx context.Context, owner OwnerRef, rolloutGeneration int64, ...) error
- type OwnerRef
- type PayloadStore
- type SecretBackedStore
- func (s *SecretBackedStore) Delete(ctx context.Context, owner OwnerRef, rolloutGeneration int64) error
- func (s *SecretBackedStore) Get(ctx context.Context, owner OwnerRef, rolloutGeneration int64) (payload []byte, configHash string, err error)
- func (s *SecretBackedStore) ListByOwner(ctx context.Context, owner OwnerRef) (rolloutGenerations []int64, err error)
- func (s *SecretBackedStore) Put(ctx context.Context, owner OwnerRef, rolloutGeneration int64, ...) error
Constants ¶
const ( LabelOwnerNamespace = "hypershift.openshift.io/ignition-payload-owner-namespace" LabelOwnerName = "hypershift.openshift.io/ignition-payload-owner-name" // Exact values stored in annotations (no length limit) are the source of truth for // equality matching; labels carry a fixed-length digest so List selectors stay effective // regardless of value length. AnnotationOwnerNamespaceExact = "hypershift.openshift.io/ignition-payload-owner-namespace-exact" AnnotationOwnerNameExact = "hypershift.openshift.io/ignition-payload-owner-name-exact" // AnnotationRolloutGeneration records the rollout generation this entry serves; it is the // second half of the store key, recovered by ListByOwner for the sweep/cleanup paths. AnnotationRolloutGeneration = "hypershift.openshift.io/ignition-payload-rollout-generation" // AnnotationConfigHash records the payload-identity hash of the stored bytes, so the // generator can skip regeneration when it already matches (idempotent generation). AnnotationConfigHash = "hypershift.openshift.io/ignition-payload-config-hash" )
Label and annotation keys for SecretBackedStore.
Variables ¶
var ErrNotFound = errors.New("ignition payload not found")
ErrNotFound is returned when a (owner, rolloutGeneration) identity has no store entry.
Functions ¶
This section is empty.
Types ¶
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
MemStore is an in-memory PayloadStore for testing.
func (*MemStore) ListByOwner ¶
type PayloadStore ¶
type PayloadStore interface {
// Put stores payload under (owner, rolloutGeneration), (re)setting the configHash it
// records. If the entry already exists its bytes/configHash are overwritten in place
// (last-write-wins; the Policy A refresh path).
Put(ctx context.Context, owner OwnerRef, rolloutGeneration int64, configHash string, payload []byte) error
// Get returns the payload bytes and the recorded configHash for (owner, rolloutGeneration),
// or ErrNotFound. The serving tier uses payload; the generator compares configHash for
// idempotent regeneration.
Get(ctx context.Context, owner OwnerRef, rolloutGeneration int64) (payload []byte, configHash string, err error)
// Delete removes the entry for (owner, rolloutGeneration). No-op (nil) if already absent.
Delete(ctx context.Context, owner OwnerRef, rolloutGeneration int64) error
// ListByOwner returns all rolloutGenerations owned by owner (empty slice if none), for the
// inline per-CR sweep and the store-cleanup finalizer.
ListByOwner(ctx context.Context, owner OwnerRef) (rolloutGenerations []int64, err error)
}
PayloadStore stores rendered ignition payloads out-of-band from the CRD, keyed by the rollout identity (owner + rolloutGeneration). It never stores or keys on the bearer token: the token is minted by the generator, lives only in the userdata Secret, and is verified statelessly by the serving tier. Keying on the generation (rather than on rolloutHash) keeps serving identity stable across a rolloutHash formula rebaseline, which rewrites rolloutHash without advancing rolloutGeneration. Each entry records the payload-identity hash (configHash) of its content for idempotent generation and observability. Implementations are backend-independent.
type SecretBackedStore ¶
type SecretBackedStore struct {
// contains filtered or unexported fields
}
SecretBackedStore is a Secret-backed PayloadStore.
func NewSecretBackedStore ¶
func NewSecretBackedStore(cfg *rest.Config, namespace string) (*SecretBackedStore, error)
NewSecretBackedStore creates a Secret-backed PayloadStore. It builds its own uncached client from cfg so reads go straight to the API server regardless of any informer cache state — the stateless, scaled serving tier must observe payloads the generator just wrote, and the store also performs writes (so a read-only API reader is insufficient).