clustermanager

package
v0.1.13-beta3 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package clustermanager manages clusters, nodes, drivers and versions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCluster

func DeleteCluster(clustername string, force bool) error

DeleteCluster deletes a cluster. Currently, the cluster must be empty.

func ForEachCluster

func ForEachCluster(f func(*Cluster) bool)

ForEachCluster iterates over clusters

func ForEachDriver

func ForEachDriver(f func(*Driver) bool)

ForEachDriver iterates over drivers

func IsValidName

func IsValidName(name string) bool

IsValidName checks for the validity of a name. Valid names are up to 10 characters long, must start with a lowercase letter, and may contain lowercase letters and digits only.

func IsValidPort

func IsValidPort(portnumber int) bool

IsValidPort checks for the validity of a port number.

func NewEmptyCluster

func NewEmptyCluster(name string, k8sversion string, drivername string) error

NewEmptyCluster creates a new, empty cluster

func ValidateClusterName

func ValidateClusterName(name string) error

ValidateClusterName checks for the validity of a cluster name. It uses IsValidname to check name validity, and also checks if a cluster name already exists.

Types

type Cluster

type Cluster struct {
	Name string

	DriverName string

	K8sVersion string

	NetworkName string

	Nodes map[string]*Node

	Type string
	// contains filtered or unexported fields
}

Cluster is a cluster

func GetCluster

func GetCluster(name string) (*Cluster, bool)

GetCluster gets a named cluster, or nil if not present

func (*Cluster) CheckHostport

func (c *Cluster) CheckHostport(hostport int) error

CheckHostport checks if a host port is occupied in the current cluster.

func (*Cluster) DeleteNode

func (c *Cluster) DeleteNode(nodename string, force bool) error

DeleteNode deletes a node completely. By default, a node is not deleted if it is running. The force parameter causes the node to be stopped and deleted. In some rare cases for some drivers, manual cleanup may be needed after a forced delete.

func (*Cluster) NewUninitializedNode

func (c *Cluster) NewUninitializedNode(nodename string) (*Node, error)

NewUninitializedNode adds a node, but does not join it to a kubernetes cluster

func (*Cluster) ValidateNodeName

func (c *Cluster) ValidateNodeName(name string) error

ValidateNodeName checks for the validity of a node name. It uses IsValidname to check name validity, and also checks if a node name already exists in the cluster.

type Driver

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

Driver is a kutti driver

func GetDriver

func GetDriver(drivername string) (*Driver, bool)

GetDriver gets the specified driver OR an error

func (*Driver) Description

func (d *Driver) Description() string

Description is a one-line decription of the driver

func (*Driver) ForEachVersion

func (d *Driver) ForEachVersion(f func(*Version) bool) error

ForEachVersion iterates over available versions for this driver

func (*Driver) GetVersion

func (d *Driver) GetVersion(version string) (*Version, error)

GetVersion gets the specified version, or nil

func (*Driver) Name

func (d *Driver) Name() string

Name is the name of the driver

func (*Driver) RequiresPortForwarding

func (d *Driver) RequiresPortForwarding() bool

RequiresPortForwarding specifies if the driver's networks use NAT, and therefore require host ports to be forwarded

func (*Driver) Status

func (d *Driver) Status() string

Status returns the driver status

func (*Driver) UpdateVersions

func (d *Driver) UpdateVersions() error

UpdateVersions fetches the latest list of available versions for this driver

type Node

type Node struct {
	ClusterName string
	Name        string
	Type        string

	Ports map[int]int
	// contains filtered or unexported fields
}

Node is a node

func (*Node) CheckHostport

func (n *Node) CheckHostport(hostport int) error

CheckHostport checks if a host port is occupied in the current cluster.

func (*Node) Cluster

func (n *Node) Cluster() *Cluster

Cluster returns the cluster this node belongs to

func (*Node) ForceStop

func (n *Node) ForceStop() error

ForceStop stops a node forcibly

func (*Node) ForwardPort

func (n *Node) ForwardPort(hostport int, nodeport int) error

ForwardPort forwards a port of the node to the specified host port

func (*Node) ForwardSSHPort

func (n *Node) ForwardSSHPort(hostport int) error

ForwardSSHPort forwards the node's SSH port

func (*Node) Start

func (n *Node) Start() error

Start starts a node

func (*Node) Status

func (n *Node) Status() string

Status returns the current node status

func (*Node) Stop

func (n *Node) Stop() error

Stop starts a node

func (*Node) UnforwardPort

func (n *Node) UnforwardPort(nodeport int) error

UnforwardPort removes any mapping of the specified node port

type Version

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

Version is a Kubernetes version that may be available to create a cluster

func (*Version) Fetch

func (v *Version) Fetch() error

Fetch downloads a version image

func (*Version) FromFile

func (v *Version) FromFile(filename string) error

FromFile imports a version image from the specified file

func (*Version) K8sversion

func (v *Version) K8sversion() string

K8sversion returns the Kubernetes version string

func (*Version) PurgeLocal

func (v *Version) PurgeLocal() error

PurgeLocal removes the local cached copy of a version image

func (*Version) Status

func (v *Version) Status() string

Status returns the local availability of the version image

Jump to

Keyboard shortcuts

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