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
- type LabelScheme
- type Provider
- func (p *Provider) DeleteNodes(ctx context.Context, clusterName string) error
- func (p *Provider) IsAvailable() bool
- func (p *Provider) ListAllClusters(ctx context.Context) ([]string, error)
- func (p *Provider) ListNodes(ctx context.Context, clusterName string) ([]provider.NodeInfo, error)
- func (p *Provider) NodesExist(ctx context.Context, clusterName string) (bool, error)
- func (p *Provider) StartNodes(ctx context.Context, clusterName string) error
- func (p *Provider) StopNodes(ctx context.Context, clusterName string) error
Constants ¶
const ( LabelTalosOwned = "talos.owned" LabelTalosClusterName = "talos.cluster.name" LabelTalosType = "talos.type" )
Talos label constants.
const ( LabelK3dCluster = "k3d.cluster" LabelK3dRole = "k3d.role" )
K3d label constants.
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 ¶
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
IsAvailable returns true if the provider is ready for use.
func (*Provider) ListAllClusters ¶
ListAllClusters returns the names of all clusters managed by this provider.
func (*Provider) ListNodes ¶
ListNodes returns all nodes for the given cluster based on the label scheme.
func (*Provider) NodesExist ¶
NodesExist returns true if any nodes exist for the given cluster.
func (*Provider) StartNodes ¶
StartNodes starts all containers for the given cluster.