spec

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ManagedClusterSpecSchemaVersion is incremented when the persisted JSON schema changes.
	ManagedClusterSpecSchemaVersion = 1
)

Variables

This section is empty.

Functions

func GetManagedClusterSpecFilePath

func GetManagedClusterSpecFilePath() string

GetManagedClusterSpecFilePath returns the path where the managed cluster spec snapshot is stored.

func GetSpecDir

func GetSpecDir() string

GetSpecDir returns the appropriate directory for spec artifacts. Uses /run/aks-flex-node when running as aks-flex-node user (systemd service) Uses /tmp/aks-flex-node for direct user execution (testing/development)

Types

type ManagedClusterClient

type ManagedClusterClient interface {
	Get(ctx context.Context, resourceGroupName, resourceName string, options *armcontainerservice.ManagedClustersClientGetOptions) (armcontainerservice.ManagedClustersClientGetResponse, error)
}

ManagedClusterClient is the subset of the Azure SDK managed clusters client we need. It exists to allow lightweight mocking in unit tests.

type ManagedClusterSpec

type ManagedClusterSpec struct {
	SchemaVersion int `json:"schemaVersion"`

	ClusterResourceID string `json:"clusterResourceId,omitempty"`
	ClusterName       string `json:"clusterName,omitempty"`
	ResourceGroup     string `json:"resourceGroup,omitempty"`

	// KubernetesVersion is kept as a first-class field because many components care about it.
	KubernetesVersion        string `json:"kubernetesVersion,omitempty"`        // "e.g., 1.32"
	CurrentKubernetesVersion string `json:"currentKubernetesVersion,omitempty"` // "e.g., 1.32.7"
	Fqdn                     string `json:"fqdn,omitempty"`

	// metadata
	CollectedAt time.Time `json:"collectedAt"`
}

ManagedClusterSpec is the persisted spec snapshot of the target AKS managed cluster. It is intentionally extensible so we can add more fields over time without rewriting the collector.

type ManagedClusterSpecCollector

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

ManagedClusterSpecCollector collects spec from the target AKS managed cluster and persists it to a local file for later checking.

func NewManagedClusterSpecCollector

func NewManagedClusterSpecCollector(cfg *config.Config, logger *logrus.Logger) *ManagedClusterSpecCollector

NewManagedClusterSpecCollector creates a collector that writes to the default spec path. The Azure client is created lazily on the first Collect call.

func NewManagedClusterSpecCollectorWithClient

func NewManagedClusterSpecCollectorWithClient(cfg *config.Config, logger *logrus.Logger, client ManagedClusterClient, outputPath string) *ManagedClusterSpecCollector

NewManagedClusterSpecCollectorWithClient allows injecting a ManagedClusterClient and output path (primarily for tests).

func (*ManagedClusterSpecCollector) AddEnricher

AddEnricher appends a spec enricher.

func (*ManagedClusterSpecCollector) Collect

Collect queries the Azure managed cluster resource to retrieve a spec snapshot. It writes a JSON payload to the configured output path and returns the collected spec.

type ManagedClusterSpecEnricher

type ManagedClusterSpecEnricher func(spec *ManagedClusterSpec, resp armcontainerservice.ManagedClustersClientGetResponse) error

ManagedClusterSpecEnricher enriches the collected spec snapshot based on the managed cluster response. It enables adding more spec signals in the future without changing the collector control-flow.

Jump to

Keyboard shortcuts

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