status

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStatusFilePath

func GetStatusFilePath() string

GetStatusFilePath returns the appropriate status directory path Uses /run/aks-flex-node/status.json when running as systemd service (RuntimeDirectory creates this) Uses /tmp/aks-flex-node/status.json for direct user execution (testing/development)

func MarkKubeletUnhealthyBestEffort added in v0.0.17

func MarkKubeletUnhealthyBestEffort(logger *logrus.Logger)

MarkKubeletUnhealthyBestEffort updates the existing status snapshot (or creates a minimal one) to clearly indicate the kubelet is unhealthy.

This is intended to influence NeedsBootstrap() without deleting the entire status file.

func MarkKubeletUnhealthyBestEffortAtPath added in v0.0.17

func MarkKubeletUnhealthyBestEffortAtPath(logger *logrus.Logger, statusFilePath string, now time.Time)

MarkKubeletUnhealthyBestEffortAtPath is the path-based variant used by tests and any callers that want to control where the status snapshot is written.

If now is zero, time.Now() is used.

func RemoveStatusFileBestEffort added in v0.0.17

func RemoveStatusFileBestEffort(logger *logrus.Logger)

RemoveStatusFileBestEffort removes the current node status file.

It is intentionally best-effort: failure to remove the file should not crash the agent, but it helps ensure subsequent health checks re-collect status from scratch.

func RemoveStatusFileBestEffortAtPath added in v0.0.17

func RemoveStatusFileBestEffortAtPath(logger *logrus.Logger, statusFilePath string)

func WriteStatusToFile added in v0.0.17

func WriteStatusToFile(path string, nodeStatus *NodeStatus) error

WriteStatusToFile persists the node status snapshot to a JSON file. It writes atomically to avoid partial writes.

Types

type ArcStatus

type ArcStatus struct {
	Registered    bool      `json:"registered"`
	Connected     bool      `json:"connected"`
	MachineName   string    `json:"machineName"`
	ResourceID    string    `json:"resourceId,omitempty"`
	Location      string    `json:"location,omitempty"`
	ResourceGroup string    `json:"resourceGroup,omitempty"`
	LastHeartbeat time.Time `json:"lastHeartbeat,omitempty"`
	AgentVersion  string    `json:"agentVersion,omitempty"`
}

ArcStatus contains Azure Arc machine registration and connection status

type Collector

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

Collector collects system and node status information

func NewCollector

func NewCollector(cfg *config.Config, logger *logrus.Logger, agentVersion string) *Collector

NewCollector creates a new status collector

func (*Collector) CollectStatus

func (c *Collector) CollectStatus(ctx context.Context) (*NodeStatus, error)

CollectStatus collects essential node status information

func (*Collector) NeedsBootstrap

func (c *Collector) NeedsBootstrap(ctx context.Context) bool

NeedsBootstrap checks if the node needs to be (re)bootstrapped based on status file

type LastUpdatedBy added in v0.0.17

type LastUpdatedBy string
const (
	LastUpdatedByUnspecified                  LastUpdatedBy = ""
	LastUpdatedByStatusCollectionLoop         LastUpdatedBy = "StatusCollectionLoop"
	LastUpdatedByDriftDetectionAndRemediation LastUpdatedBy = "DriftDetectionAndRemediation"
)

type LastUpdatedReason added in v0.0.17

type LastUpdatedReason string
const (
	LastUpdatedReasonUnspecified            LastUpdatedReason = ""
	LastUpdatedReasonPeriodicStatusLoop     LastUpdatedReason = "perodicStatusLoop"
	LastUpdatedReasonKubernetesVersionDrift LastUpdatedReason = "kubernetesVersionDrift"
)

type NodeStatus

type NodeStatus struct {
	// Component versions
	KubeletVersion    string `json:"kubeletVersion"`
	RuncVersion       string `json:"runcVersion"`
	ContainerdVersion string `json:"containerdVersion"`

	// Service status
	KubeletRunning bool   `json:"kubeletRunning"`
	KubeletReady   string `json:"kubeletReady"`

	ContainerdRunning bool `json:"containerdRunning"`

	// Azure Arc status
	ArcStatus ArcStatus `json:"arcStatus"`

	// Metadata
	LastUpdated       time.Time         `json:"lastUpdated"`
	LastUpdatedBy     LastUpdatedBy     `json:"lastUpdatedBy,omitempty"`
	LastUpdatedReason LastUpdatedReason `json:"lastUpdatedReason,omitempty"`
	AgentVersion      string            `json:"agentVersion"`
}

NodeStatus represents the current status and health information of the AKS edge node

func LoadStatus added in v0.0.17

func LoadStatus() (*NodeStatus, error)

LoadStatus loads the node status snapshot from the default path.

func LoadStatusFromFile added in v0.0.17

func LoadStatusFromFile(path string) (*NodeStatus, error)

LoadStatusFromFile loads the node status snapshot from a JSON file.

Jump to

Keyboard shortcuts

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