Documentation
¶
Overview ¶
Package executor defines the executor interface and registry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = NewRegistry()
DefaultRegistry is the global executor registry.
Functions ¶
Types ¶
type AWSConnectorConfig ¶
type AWSConnectorConfig = awsutil.AWSConnectorConfig
AWSConnectorConfig holds AWS connector settings.
type ConnectorConfig ¶
type ConnectorConfig struct {
// AWS holds AWS-specific configuration.
AWS *AWSConnectorConfig
// K8S holds Kubernetes-specific configuration.
K8S *K8SConnectorConfig
}
ConnectorConfig holds resolved connector settings.
type ErrorList ¶ added in v1.6.2
type ErrorList struct {
// contains filtered or unexported fields
}
ErrorList is a thread-safe accumulator for errors. It is useful when multiple goroutines may encounter errors and the caller wants to collect them for later reporting instead of failing fast.
type Executor ¶
type Executor interface {
// Type returns the executor type identifier.
Type() string
// Validate validates the executor spec.
Validate(spec Spec) error
// Shutdown performs the hibernation operation.
// Restore data should be saved incrementally via spec.ReportStateCallback.
// Returns a Result with a summary message on success.
Shutdown(ctx context.Context, log logr.Logger, spec Spec) (*Result, error)
// WakeUp performs the restore operation using saved restore data.
// Returns a Result with a summary message on success.
WakeUp(ctx context.Context, log logr.Logger, spec Spec, restore RestoreData) (*Result, error)
}
Executor is the interface that all executors must implement.
type K8SConnectorConfig ¶
type K8SConnectorConfig = k8sutil.K8SConnectorConfig
K8SConnectorConfig holds Kubernetes connector settings.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds registered executors.
type ReportStateCallback ¶ added in v1.6.0
ReportStateCallback is a callback for incremental restore data persistence. Executors call this after each successful sub-resource operation to save restore data incrementally, preventing data loss on partial failures. Any data reported through this callback is inherently "live" — the executor just captured it from the actual cloud/cluster API.
Parameters:
key: Resource-specific key (e.g., instanceID, nodeGroupName) value: Resource state (will be JSON-marshaled by callback implementation)
type RestoreData ¶
type RestoreData struct {
// Type of the executor that produced this data.
Type string `json:"type"`
// Data is a unified map of resource key → resource state (as JSON).
// Keys are executor-specific:
// - EC2: instanceID (e.g., "i-1234567890abcdef0")
// - EKS: nodeGroupName (e.g., "ng-1")
// - Karpenter: nodePoolName (e.g., "default")
// - WorkloadScaler: namespace/kind/name (e.g., "team-a/Deployment/api")
// - RDS: instanceID or clusterID with prefix (e.g., "instance:my-db", "cluster:my-cluster")
// - Noop: operation ID (e.g., "noop-12345")
Data map[string]json.RawMessage `json:"data"`
// IsLive indicates whether data was captured from actual resource state via API (true)
// or is cached/unknown state (false). When true, hibernator has direct knowledge of the
// resource state from a fresh API call. When false, the data may be stale or from an
// incomplete lifecycle. High-quality data (IsLive=true) is preserved over low-quality
// data (IsLive=false) during save operations.
IsLive bool `json:"isLive"`
}
RestoreData holds restore metadata produced by Shutdown.
type Result ¶ added in v1.6.0
type Result struct {
// Message is a human-readable summary of what the executor did.
// For successful operations, this describes the action taken (e.g., "scaled 3 node groups to zero").
// For failed operations, the error message is used instead.
Message string
// ElapsedMs is the wall-clock execution time in milliseconds.
// This field is populated by the runner after the executor returns;
// executor implementations should leave it at zero.
ElapsedMs int64
}
Result holds the outcome of an executor operation.
type Spec ¶
type Spec struct {
// TargetName is the name of the target.
TargetName string
// TargetType is the type of the target (eks, rds, ec2).
TargetType string
// Parameters is the executor-specific configuration.
Parameters json.RawMessage
// ConnectorConfig holds resolved connector configuration.
ConnectorConfig ConnectorConfig
// ReportStateCallback is an optional callback for incremental persistence.
// If provided, executors should call this after each successful sub-resource
// operation to enable partial-success data preservation.
ReportStateCallback ReportStateCallback
}
Spec holds target execution parameters.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ec2 implements the EC2 executor for hibernating EC2 instances.
|
Package ec2 implements the EC2 executor for hibernating EC2 instances. |
|
Package eks implements the EKS executor for hibernating EKS Managed Node Groups.
|
Package eks implements the EKS executor for hibernating EKS Managed Node Groups. |
|
Package noop implements a no-operation executor for testing hibernation workflows without external dependencies.
|
Package noop implements a no-operation executor for testing hibernation workflows without external dependencies. |
|
Package rds implements the RDS executor for hibernating RDS instances.
|
Package rds implements the RDS executor for hibernating RDS instances. |