docker

package
v5.36.4 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package docker provides a Docker-based infrastructure provider.

The Docker provider manages Kubernetes cluster nodes as Docker containers. It supports different container labeling schemes for different distributions:

  • Kind: Uses container name prefix "kind-"
  • K3d: Uses container labels "k3d.cluster" and "k3d.role"
  • Talos: Uses container labels "talos.cluster.name" and "talos.type"

This provider is used by provisioners to perform infrastructure operations while the provisioners handle distribution-specific configuration.

Index

Constants

View Source
const (
	LabelTalosOwned       = "talos.owned"
	LabelTalosClusterName = "talos.cluster.name"
	LabelTalosType        = "talos.type"
)

Talos label constants.

View Source
const (
	LabelK3dCluster = "k3d.cluster"
	LabelK3dRole    = "k3d.role"
)

K3d label constants.

View Source
const (
	DefaultStartTimeout = 30 * time.Second
	DefaultStopTimeout  = 60 * time.Second
)

Default timeouts for Docker operations.

Variables

This section is empty.

Functions

This section is empty.

Types

type LabelScheme

type LabelScheme string

LabelScheme defines how to identify and filter containers for a distribution.

const (
	// LabelSchemeKind uses container name prefix "kind-<cluster>-" to identify nodes.
	LabelSchemeKind LabelScheme = "kind"
	// LabelSchemeK3d uses "k3d.cluster" label to identify nodes.
	LabelSchemeK3d LabelScheme = "k3d"
	// LabelSchemeTalos uses "talos.cluster.name" label to identify nodes.
	LabelSchemeTalos LabelScheme = "talos"
	// LabelSchemeVCluster uses container name prefix "vcluster.cp.<cluster>" to identify nodes.
	LabelSchemeVCluster LabelScheme = "vcluster"
)

type Provider

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

Provider implements provider.Provider for Docker-based clusters.

func NewProvider

func NewProvider(cli client.APIClient, scheme LabelScheme) *Provider

NewProvider creates a new Docker provider with the specified label scheme.

func (*Provider) DeleteNodes

func (p *Provider) DeleteNodes(ctx context.Context, clusterName string) error

DeleteNodes removes all containers for the given cluster. This is a cleanup operation - most provisioners handle deletion through their SDK.

func (*Provider) IsAvailable added in v5.19.0

func (p *Provider) IsAvailable() bool

IsAvailable returns true if the provider is ready for use.

func (*Provider) ListAllClusters

func (p *Provider) ListAllClusters(ctx context.Context) ([]string, error)

ListAllClusters returns the names of all clusters managed by this provider.

func (*Provider) ListNodes

func (p *Provider) ListNodes(ctx context.Context, clusterName string) ([]provider.NodeInfo, error)

ListNodes returns all nodes for the given cluster based on the label scheme.

func (*Provider) NodesExist

func (p *Provider) NodesExist(ctx context.Context, clusterName string) (bool, error)

NodesExist returns true if any nodes exist for the given cluster.

func (*Provider) StartNodes

func (p *Provider) StartNodes(ctx context.Context, clusterName string) error

StartNodes starts all containers for the given cluster.

func (*Provider) StopNodes

func (p *Provider) StopNodes(ctx context.Context, clusterName string) error

StopNodes stops all containers for the given cluster.

Jump to

Keyboard shortcuts

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