clusterstate

package
v0.18.0 Latest Latest
Warning

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

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

Documentation

Overview

Package clusterstate stores the small, secret-bearing pieces of coordinator state needed to restore a coordinator from an etcd snapshot.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("cluster state not found")

Functions

func EnsureSealingKey

func EnsureSealingKey(ctx context.Context, log *slog.Logger, client *clientv3.Client, prefix, dataPath string) ([]byte, error)

EnsureSealingKey creates a key only before metadata migration. A restored snapshot without its original sealing key must fail rather than mint a new root that cannot decrypt the cluster's credentials.

func SealingKeyPath

func SealingKeyPath(dataPath string) string

SealingKeyPath is the host-only root key. Back it up separately from etcd; it is not a recoverable cache and must never be uploaded with snapshots.

Types

type Lock

type Lock struct {
	// contains filtered or unexported fields
}

Lock holds a cluster-wide mutex. Writes made through it are fenced by the mutex's create revision and lease, so a holder which pauses past lease expiry cannot overwrite the next holder's work.

func (*Lock) Delete

func (l *Lock) Delete(ctx context.Context, name string) error

func (*Lock) Put

func (l *Lock) Put(ctx context.Context, name string, value []byte) error

func (*Lock) Unlock

func (l *Lock) Unlock()

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store encrypts records before placing them in replicated etcd. The key is derived from a host-only sealing key, which must be backed up separately.

func New

func New(client *clientv3.Client, prefix string, sealingKey []byte) (*Store, error)

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, name string) error

func (*Store) Ensure

func (s *Store) Ensure(ctx context.Context, name string, bootstrap []byte) ([]byte, error)

Ensure returns the authoritative value, atomically installing bootstrap only when no coordinator has created the record yet.

func (*Store) Get

func (s *Store) Get(ctx context.Context, name string) ([]byte, error)

func (*Store) Lock

func (s *Store) Lock(ctx context.Context, name string) (*Lock, error)

Lock serializes cluster-wide mutation such as ACME issuance.

func (*Store) Put

func (s *Store) Put(ctx context.Context, name string, value []byte) error

Jump to

Keyboard shortcuts

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