Documentation
¶
Index ¶
Constants ¶
const KubernetesVersionFindingID = "kubernetes-version"
Variables ¶
This section is empty.
Functions ¶
func DetectAndRemediateFromFiles ¶
func DetectAndRemediateFromFiles( ctx context.Context, cfg *config.Config, logger *logrus.Logger, bootstrapInProgress *int32, detectors []Detector, conn *grpc.ClientConn, ) error
DetectAndRemediateFromFiles loads spec/status snapshots from disk, runs all detectors, and (if needed) performs remediation.
Remediation attempts are guarded by bootstrapInProgress to avoid concurrent executions.
conn must be a usable components API connection; drift remediation never creates its own in-memory connection.
Types ¶
type Detector ¶
type Detector interface {
Name() string
Detect(ctx context.Context, cfg *config.Config, specSnap *spec.ManagedClusterSpec, statusSnap *status.NodeStatus) ([]Finding, error)
}
Detector compares desired spec and current status and returns any drift findings. Detectors should be pure (no side effects) and fast.
func DefaultDetectors ¶
func DefaultDetectors() []Detector
DefaultDetectors returns the default set of drift detectors enabled by the agent.
The daemon can choose to use this helper to avoid wiring each detector manually, while still keeping detector selection injectable for tests and future customization.
type Finding ¶
type Finding struct {
ID string
Title string
Details string
Remediation Remediation
}
Finding represents a detected drift between desired spec and current node state. Findings should be small and composable so multiple detectors can return multiple findings.
func DetectAll ¶
func DetectAll( ctx context.Context, detectors []Detector, cfg *config.Config, specSnap *spec.ManagedClusterSpec, statusSnap *status.NodeStatus, ) ([]Finding, error)
DetectAll runs all detectors, returning aggregated findings. If some detectors error, the error is returned (joined) along with any findings.
type KubernetesVersionDetector ¶
type KubernetesVersionDetector struct{}
func NewKubernetesVersionDetector ¶
func NewKubernetesVersionDetector() *KubernetesVersionDetector
func (*KubernetesVersionDetector) Detect ¶
func (d *KubernetesVersionDetector) Detect( ctx context.Context, _ *config.Config, specSnap *spec.ManagedClusterSpec, statusSnap *status.NodeStatus, ) ([]Finding, error)
func (*KubernetesVersionDetector) Name ¶
func (d *KubernetesVersionDetector) Name() string
type Remediation ¶
type Remediation struct {
// Action indicates the remediation strategy.
// If unset, the finding is informational and won't trigger remediation.
Action RemediationAction
// KubernetesVersion, when set, indicates the desired Kubernetes version that should be
// used during bootstrap (e.g., to trigger kubelet upgrade).
KubernetesVersion string
}
Remediation describes what the agent should do to address a drift. This is intentionally a minimal set of knobs; it can be extended as new remediation types are needed (e.g., restart services, rewrite config files, run targeted installers).
type RemediationAction ¶
type RemediationAction string
RemediationAction indicates what kind of action should be taken to remediate a drift. Empty value means "unspecified" and will fall back to legacy behavior.
const ( RemediationActionUnspecified RemediationAction = "" RemediationActionKubernetesUpgrade RemediationAction = "kubernetes-upgrade" )