cluster

package
v1.11.5 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterDetector

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

handles detection of running clusters on the node

func NewClusterDetector

func NewClusterDetector(nodeID string, clusterType config.ClusterType) *ClusterDetector

creates a new cluster detector

func (*ClusterDetector) DetectCluster

func (cd *ClusterDetector) DetectCluster() (*ClusterInfo, error)

checks if there's a cluster running on the node

func (*ClusterDetector) GetKubeconfig

func (cd *ClusterDetector) GetKubeconfig(clusterInfo *ClusterInfo) ([]byte, error)

retrieves the kubeconfig content from the detected cluster

func (*ClusterDetector) ValidateKubeconfig

func (cd *ClusterDetector) ValidateKubeconfig(kubeconfigData []byte) error

performs basic validation of kubeconfig content

type ClusterInfo

type ClusterInfo struct {
	Type           string    `json:"type"`           // k3s
	Status         string    `json:"status"`         // running, stopped, error
	Version        string    `json:"version"`        // cluster version
	KubeconfigPath string    `json:"kubeconfigPath"` // path to kubeconfig file
	DetectedAt     time.Time `json:"detectedAt"`     // when cluster was detected
}

represents detected cluster information

type KubeconfigManager

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

manages kubeconfig lifecycle and communication with host manager tracks the last known kubeconfig and only notifies host manager on changes to avoid unnecessary updates

func NewKubeconfigManager

func NewKubeconfigManager(hostmgrClient *hostmgr_client.Client, nodeID string) *KubeconfigManager

creates a new kubeconfig manager

func (*KubeconfigManager) ClearKubeconfig

func (km *KubeconfigManager) ClearKubeconfig(ctx context.Context, confs *config.NodeAgentConfig) error

set the kubeconfig to nil and notify host manager to clear it avoid having stale kubeconfig data in host manager when cluster is deleted or becomes unreachable

func (*KubeconfigManager) GetClusterStatus

func (km *KubeconfigManager) GetClusterStatus(clusterInfo *ClusterInfo) string

returns a formatted string describing the current cluster status

func (*KubeconfigManager) GetLastKubeconfig

func (km *KubeconfigManager) GetLastKubeconfig() []byte

returns the last known kubeconfig

func (*KubeconfigManager) HasKubeconfig

func (km *KubeconfigManager) HasKubeconfig() bool

returns true if a kubeconfig is currently tracked

func (*KubeconfigManager) KubeconfigSize

func (km *KubeconfigManager) KubeconfigSize() int

returns the size of the current kubeconfig in bytes

func (*KubeconfigManager) NotifyKubeconfig

func (km *KubeconfigManager) NotifyKubeconfig(ctx context.Context, kubeconfigData []byte, clusterInfo *ClusterInfo, confs *config.NodeAgentConfig) error

sends kubeconfig data to the host manager

Jump to

Keyboard shortcuts

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