Documentation
¶
Overview ¶
Package vclusterprovisioner implements the cluster provisioner interface for vCluster's Docker driver (Vind). It uses the vCluster Go SDK for Create and Delete operations and delegates Start/Stop/List/Exists to the Docker infrastructure provider.
Index ¶
- Variables
- func CleanupRegistries(ctx context.Context, mirrorSpecs []registry.MirrorSpec, clusterName string, ...) error
- func ConfigureContainerdRegistryMirrors(ctx context.Context, clusterName string, mirrorSpecs []registry.MirrorSpec, ...) error
- func ConnectRegistriesToNetwork(ctx context.Context, mirrorSpecs []registry.MirrorSpec, clusterName string, ...) error
- func SetupRegistries(ctx context.Context, clusterName string, dockerClient client.APIClient, ...) error
- type Provisioner
- func (p *Provisioner) Create(ctx context.Context, name string) error
- func (p *Provisioner) Delete(ctx context.Context, name string) error
- func (p *Provisioner) Exists(ctx context.Context, name string) (bool, error)
- func (p *Provisioner) List(ctx context.Context) ([]string, error)
- func (p *Provisioner) SetProvider(prov provider.Provider)
- func (p *Provisioner) Start(ctx context.Context, name string) error
- func (p *Provisioner) Stop(ctx context.Context, name string) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoVClusterNodes is returned when no VCluster nodes are found for a cluster. ErrNoVClusterNodes = errors.New("no VCluster nodes found for cluster") // ErrExecFailed is re-exported from the registry package for consistency. ErrExecFailed = registry.ErrExecFailed )
Static errors for the vcluster provisioner package.
Functions ¶
func CleanupRegistries ¶
func CleanupRegistries( ctx context.Context, mirrorSpecs []registry.MirrorSpec, clusterName string, dockerClient client.APIClient, deleteVolumes bool, ) error
CleanupRegistries removes registries that are no longer in use.
func ConfigureContainerdRegistryMirrors ¶
func ConfigureContainerdRegistryMirrors( ctx context.Context, clusterName string, mirrorSpecs []registry.MirrorSpec, dockerClient client.APIClient, _ io.Writer, ) error
ConfigureContainerdRegistryMirrors injects hosts.toml files directly into VCluster nodes to configure containerd to use the local registry mirrors. This is called after the cluster is created and registries are connected to the network.
VCluster nodes are Docker containers with containerd, so the same hosts.toml injection approach used by Kind works here. The function targets containers matching the vcluster.cp.<name> and vcluster.node.<name>.* naming convention.
func ConnectRegistriesToNetwork ¶
func ConnectRegistriesToNetwork( ctx context.Context, mirrorSpecs []registry.MirrorSpec, clusterName string, dockerClient client.APIClient, writer io.Writer, ) error
ConnectRegistriesToNetwork connects existing registries to the VCluster Docker network. This should be called after the VCluster cluster is created and the network exists.
func SetupRegistries ¶
func SetupRegistries( ctx context.Context, clusterName string, dockerClient client.APIClient, mirrorSpecs []registry.MirrorSpec, writer io.Writer, ) error
SetupRegistries creates mirror registries based on mirror specifications. Registries are created without network attachment first, as the VCluster network doesn't exist until after the cluster is created.
Types ¶
type Provisioner ¶
type Provisioner struct {
// contains filtered or unexported fields
}
Provisioner implements the cluster provisioner interface for vCluster's Docker driver (Vind). Create and Delete use the vCluster Go SDK directly, while Start/Stop/List/Exists delegate to the Docker infrastructure provider.
func CreateProvisioner ¶
func CreateProvisioner( name string, valuesPath string, disableFlannel bool, ) (*Provisioner, error)
CreateProvisioner creates a Provisioner from the given configuration.
Parameters:
- name: default cluster name
- valuesPath: optional path to a vcluster.yaml values file
- disableFlannel: disable the built-in flannel CNI
func NewProvisioner ¶
func NewProvisioner( name string, valuesPath string, disableFlannel bool, infraProvider provider.Provider, ) *Provisioner
NewProvisioner constructs a new vCluster provisioner.
Parameters:
- name: default cluster name (used when no name is passed to methods)
- valuesPath: optional path to a vcluster.yaml values file
- disableFlannel: disable the built-in flannel CNI in the vCluster
- infraProvider: Docker infrastructure provider for Start/Stop/List/Exists
func (*Provisioner) Create ¶
func (p *Provisioner) Create(ctx context.Context, name string) error
Create provisions a vCluster using the Docker driver via the vCluster Go SDK.
Cluster creation and connect are split into two phases because the SDK's ConnectDocker has a hardcoded 3-minute readiness timeout (waitForVCluster) which is too short for CI runners. We retry ConnectDocker up to connectMaxAttempts times, giving an effective timeout of ~9 minutes.
On CI runners (GitHub Actions), the SDK's install-standalone.sh may fail because systemd inside the privileged container hasn't initialized D-Bus yet. When this happens the container is already running, so we wait for D-Bus readiness and re-run the install script.
On Linux, this method ensures the br_netfilter kernel module is loaded before creating the cluster, as it's required for Docker bridge networking features.
func (*Provisioner) Delete ¶
func (p *Provisioner) Delete(ctx context.Context, name string) error
Delete removes a vCluster using the Docker driver via the vCluster Go SDK. Returns clustererr.ErrClusterNotFound if the cluster does not exist.
func (*Provisioner) Exists ¶
Exists checks if a vCluster cluster exists by querying the Docker infrastructure provider.
func (*Provisioner) List ¶
func (p *Provisioner) List(ctx context.Context) ([]string, error)
List returns all vCluster clusters by querying the Docker infrastructure provider.
func (*Provisioner) SetProvider ¶
func (p *Provisioner) SetProvider(prov provider.Provider)
SetProvider sets the infrastructure provider for node operations. This implements the ProviderAware interface.