Documentation
¶
Index ¶
- Variables
- func UnmarshalManifest(manifest string) ([]*unstructured.Unstructured, error)
- type Base
- type Checker
- func NewBlockNodeChecker(sm state.Manager, newHelm func() (HelmManager, error), ...) (Checker[state.BlockNodeState], error)
- func NewClusterChecker(sm state.Manager, clusterExists ClusterProbe) (Checker[state.ClusterState], error)
- func NewMachineChecker(sm state.Manager, sandboxBinDir, stateDir string) (Checker[state.MachineState], error)
- type CheckerOption
- type Checkers
- type ClusterProbe
- type HelmManager
- type KubeClient
Constants ¶
This section is empty.
Variables ¶
var ErrFlushError = errorx.NewType(ErrNamespace, "flush_error")
var ErrNamespace = errorx.NewNamespace("reality")
Functions ¶
func UnmarshalManifest ¶
func UnmarshalManifest(manifest string) ([]*unstructured.Unstructured, error)
UnmarshalManifest parses a Helm release manifest (possibly multi-doc YAML) and returns a slice of Unstructured objects (one per non-empty document).
Types ¶
type Checker ¶
type Checker[T any] interface { FlushState(st T) error RefreshState(ctx context.Context) (T, error) }
Checker is the composite abstraction for accessing the current state of the
func NewBlockNodeChecker ¶
func NewBlockNodeChecker( sm state.Manager, newHelm func() (HelmManager, error), newKube func() (KubeClient, error), clusterExists ClusterProbe, ) (Checker[state.BlockNodeState], error)
NewBlockNodeChecker constructs a blockNodeChecker. In production pass helm2.NewManager, kube.NewClient and kube.ClusterExists. In tests swap them for fakes.
func NewClusterChecker ¶
func NewClusterChecker(sm state.Manager, clusterExists ClusterProbe) (Checker[state.ClusterState], error)
NewClusterChecker constructs a clusterChecker with the given probe. In production pass kube.ClusterExists; in tests pass a fake.
func NewMachineChecker ¶
func NewMachineChecker(sm state.Manager, sandboxBinDir, stateDir string) (Checker[state.MachineState], error)
NewMachineChecker constructs a machineChecker. sandboxBinDir and stateDir may be empty strings; the checker will fall back to models.Paths() values at call time.
type CheckerOption ¶
type CheckerOption func(*checkerConfig)
CheckerOption configures the Checker.
func WithClusterProbe ¶
func WithClusterProbe(fn ClusterProbe) CheckerOption
func WithHelmFactory ¶
func WithHelmFactory(fn func() (HelmManager, error)) CheckerOption
func WithKubeFactory ¶
func WithKubeFactory(fn func() (KubeClient, error)) CheckerOption
func WithSandboxBinDir ¶
func WithSandboxBinDir(dir string) CheckerOption
func WithStateDir ¶
func WithStateDir(dir string) CheckerOption
type Checkers ¶
type Checkers struct {
Cluster Checker[state.ClusterState]
Machine Checker[state.MachineState]
BlockNode Checker[state.BlockNodeState]
}
Checkers is the aggregate of all reality checkers, providing a single entry point for callers to access the current state of the cluster, machines, and block node.
func NewCheckers ¶
func NewCheckers(sm state.Manager, opts ...CheckerOption) (Checkers, error)
NewCheckers constructs a Checker composed of three focused sub-checkers. Production defaults are applied; use CheckerOption to override for tests.
type ClusterProbe ¶
ClusterProbe abstracts the package-level kube.ClusterExists check. Exported so callers can provide fakes in tests.
type HelmManager ¶
HelmManager is the subset of helm2.Manager used by the BlockNode checker. Swap in a fake for unit tests.
type KubeClient ¶
type KubeClient interface {
List(ctx context.Context, kind kube.ResourceKind, namespace string, opts kube.WaitOptions) (*unstructured.UnstructuredList, error)
}
KubeClient is the subset of kube.Client used by the BlockNode checker.