cluster

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package cluster provides functions to access, check, and inspect Chubo clusters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crashdump

func Crashdump(ctx context.Context, cluster provision.Cluster, logWriter io.Writer, zipFilePath string)

Crashdump is a no-op in chubo builds.

Chubo support collection is handled by dedicated chuboctl support flows.

func MapProvisionNodeInfosToNodeInfosByType

func MapProvisionNodeInfosToNodeInfosByType(nodes []provision.NodeInfo) (map[machine.Type][]NodeInfo, error)

MapProvisionNodeInfosToNodeInfosByType maps provision.NodeInfos to cluster.NodeInfos, grouping them by machine type.

func NodesMatch

func NodesMatch(expected, actual []NodeInfo) error

NodesMatch asserts that the provided expected set of nodes match the actual set of nodes.

Each expectedNode IPs should have a non-empty intersection with actualNode IPs.

func SaveClusterLogsArchive

func SaveClusterLogsArchive(statePath, archivePath string)

SaveClusterLogsArchive saves all logs from the cluster state directory to a gzip archive.

Types

type APIBootstrapper

type APIBootstrapper struct {
	ClientProvider
	Info
}

APIBootstrapper bootstraps cluster via Chubo API.

func (*APIBootstrapper) ApplyConfig

ApplyConfig on the node via the API using insecure mode.

func (*APIBootstrapper) Bootstrap

func (s *APIBootstrapper) Bootstrap(ctx context.Context, out io.Writer) error

Bootstrap the cluster via the API.

Bootstrap implements Bootstrapper interface.

type ApplyConfigClient

type ApplyConfigClient struct {
	ClientProvider
	Info
}

ApplyConfigClient client to apply config.

type Bootstrapper

type Bootstrapper interface {
	Bootstrap(ctx context.Context, out io.Writer) error
}

Bootstrapper performs cluster bootstrap.

type ClientProvider

type ClientProvider interface {
	// Client returns an OS client instance for default (if no endpoints are given) or
	// specific endpoint.
	Client(endpoints ...string) (*client.Client, error)
	// Close client connections.
	Close() error
}

ClientProvider builds an OS client by endpoint.

Client instance should be cached and closed when Close() is called.

type ConfigClientProvider

type ConfigClientProvider struct {
	// DefaultClient to be used when using default endpoints.
	//
	// Not required, if missing client will be constructed from the config.
	DefaultClient *client.Client

	// ChuboConfig is the primary client configuration.
	ChuboConfig *clientconfig.Config

	// TalosConfig is a legacy compatibility alias.
	TalosConfig *clientconfig.Config
	// contains filtered or unexported fields
}

ConfigClientProvider builds an OS client from client config.

func (*ConfigClientProvider) Client

func (c *ConfigClientProvider) Client(endpoints ...string) (*client.Client, error)

Client returns OS client instance for default (if no endpoints are given) or specific endpoints.

Client implements ClientProvider interface.

func (*ConfigClientProvider) Close

func (c *ConfigClientProvider) Close() error

Close all the client connections.

type CrashDumper

type CrashDumper interface {
	CrashDump(ctx context.Context, out io.Writer)
}

CrashDumper captures cluster state to the specified writer for debugging.

type Info

type Info interface {
	// Nodes returns list of all node infos.
	Nodes() []NodeInfo
	// NodesByType return list of node endpoints by type.
	NodesByType(machine.Type) []NodeInfo
}

Info describes the cluster.

type LocalClientProvider

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

LocalClientProvider builds an OS client to connect to same-node apid instance over file socket.

func (*LocalClientProvider) Client

func (c *LocalClientProvider) Client(endpoints ...string) (*client.Client, error)

Client returns an OS client instance for default (if no endpoints are given) or specific endpoints.

Client implements ClientProvider interface.

func (*LocalClientProvider) Close

func (c *LocalClientProvider) Close() error

Close all the client connections.

type NodeInfo

type NodeInfo struct {
	InternalIP netip.Addr
	IPs        []netip.Addr
}

NodeInfo describes a cluster node.

func IPToNodeInfo

func IPToNodeInfo(ip string) (*NodeInfo, error)

IPToNodeInfo converts a node internal IP to a NodeInfo.

func IPsToNodeInfos

func IPsToNodeInfos(ips []string) ([]NodeInfo, error)

IPsToNodeInfos converts list of IPs to a list of NodeInfos.

func MapProvisionNodeInfosToClusterNodeInfos

func MapProvisionNodeInfosToClusterNodeInfos(nodes []provision.NodeInfo) ([]NodeInfo, error)

MapProvisionNodeInfosToClusterNodeInfos maps provision.NodeInfos to cluster.NodeInfos.

Directories

Path Synopsis
Package check provides set of checks to verify cluster readiness.
Package check provides set of checks to verify cluster readiness.