talos/pkg/provision/provision.go
Dmitry Sharshakov 653f838b09
feat: support multiple Docker cluster in talosctl cluster create
Dynamically map Kubernetes and Talos API ports to an available port on
the host, so every cluster gets its own unique set of parts.

As part of the changes, refactor the provision library and interfaces,
dropping old weird interfaces replacing with (hopefully) much more
descriprive names.

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
2024-04-04 21:21:39 +04:00

39 lines
1.2 KiB
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package provision provides abstract definitions for Talos cluster provisioners.
package provision
import (
"context"
"io"
"github.com/siderolabs/talos/pkg/machinery/config/generate"
"github.com/siderolabs/talos/pkg/machinery/config/types/v1alpha1"
)
// Provisioner is an interface each provisioner should implement.
//
//nolint:interfacebloat
type Provisioner interface {
Create(context.Context, ClusterRequest, ...Option) (Cluster, error)
Destroy(context.Context, Cluster, ...Option) error
CrashDump(context.Context, Cluster, io.Writer)
Reflect(ctx context.Context, clusterName, stateDirectory string) (Cluster, error)
GenOptions(NetworkRequest) []generate.Option
GetInClusterKubernetesControlPlaneEndpoint(req NetworkRequest, controlPlanePort int) string
GetExternalKubernetesControlPlaneEndpoint(req NetworkRequest, controlPlanePort int) string
GetTalosAPIEndpoints(NetworkRequest) []string
GetFirstInterface() v1alpha1.IfaceSelector
Close() error
UserDiskName(index int) string
}