Documentation
¶
Index ¶
- Constants
- Variables
- func ClusterImagesVolumeName(kubeadmVersion string) string
- func GetKubeadmVersionFromImage(ctx context.Context, podmanClient PodmanClient, nodeImage string) (string, error)
- func PopulatorContainerName(kubeadmVersion string) string
- type Cluster
- func (c *Cluster) EnsureImagesVolume(ctx context.Context, nodeImage string) (string, error)
- func (c *Cluster) GetNodeClusterIP(nodeName string) string
- func (c *Cluster) Init(ctx context.Context, opts InitOptions) error
- func (c *Cluster) Join(ctx context.Context, opts JoinOptions) error
- func (c *Cluster) WaitForCloudInit(ctx context.Context, nodeName string, timeout time.Duration) error
- type Config
- type InitOptions
- type JoinOptions
- type PodmanClient
Constants ¶
const ( ClusterImagesVolumePrefix = "cluster-images" ClusterImagesMountPath = "/var/lib/cluster-images" )
Variables ¶
var ( ErrImageInspect = errors.New("inspecting node image") ErrKubeadmVersionUnknown = errors.New("cannot determine kubeadm version") )
Functions ¶
func ClusterImagesVolumeName ¶
ClusterImagesVolumeName returns the versioned volume name for a given kubeadm version.
func GetKubeadmVersionFromImage ¶
func GetKubeadmVersionFromImage(ctx context.Context, podmanClient PodmanClient, nodeImage string) (string, error)
GetKubeadmVersionFromImage inspects the node image and returns the kubeadm version from its label.
func PopulatorContainerName ¶
PopulatorContainerName returns the populator container name scoped to a kubeadm version.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster represents a Kubernetes cluster
func (*Cluster) EnsureImagesVolume ¶
EnsureImagesVolume creates and populates a versioned cluster-images volume. It inspects the node image for its kubeadm version and creates a volume named cluster-images-<version>. Returns the volume name.
func (*Cluster) GetNodeClusterIP ¶
GetNodeClusterIP returns the cluster IP for a node
func (*Cluster) Init ¶
func (c *Cluster) Init(ctx context.Context, opts InitOptions) error
Init initializes a Kubernetes cluster on the control plane node
type Config ¶
type Config struct {
Name string // Cluster name (default: "bink")
ControlPlane string // Control plane node name (default: "node1")
HostNetworkPopulator bool // Use host networking for the image populator container
Logger *logrus.Logger
PodmanClient PodmanClient
}
Config holds cluster configuration
type InitOptions ¶
InitOptions holds options for cluster initialization
type JoinOptions ¶
type JoinOptions struct {
NodeName string
ControlPlane string
IsControlPlane bool
NodeClusterIP string
Timeout time.Duration
Labels map[string]string
}
JoinOptions holds options for joining a node to the cluster
type PodmanClient ¶
type PodmanClient interface {
EnsureImage(ctx context.Context, image string) error
ImageInspectLabels(ctx context.Context, name string) (map[string]string, error)
VolumeExists(ctx context.Context, name string) (bool, error)
VolumeCreate(ctx context.Context, name string, labels map[string]string) error
ContainerCreate(ctx context.Context, opts *podman.ContainerCreateOptions) (string, error)
ContainerExists(ctx context.Context, name string) (bool, error)
ContainerRemove(ctx context.Context, name string, force bool) error
ContainerCopyContent(ctx context.Context, content []byte, containerName, destPath string, mode int64) error
ContainerExec(ctx context.Context, name string, cmd []string) (string, error)
ContainerExecQuiet(ctx context.Context, name string, cmd []string) error
ContainerRunQuiet(ctx context.Context, image string, cmd []string, volumeMounts []string) error
ContainerWait(ctx context.Context, name string) (int64, error)
GetPublishedPort(ctx context.Context, containerName, containerPort string) (int, error)
}