Documentation ¶
Overview ¶
Package clusterstack contains functions related to clusterstacks.
Index ¶
Constants ¶
const ( // ClusterStacksDownloadDirectory is the cluster stack download directory. ClusterStacksDownloadDirectory = "cluster-stacks" // NodeImageDownloadDirectory is the node image untar directory. NodeImageDownloadDirectory = "node-images" )
const (
// Separator defines the separator for cluster stack strings.
Separator = "-"
)
Variables ¶
var ( // ErrInvalidFormat indicates a cluster stack string has an invalid format. ErrInvalidFormat = fmt.Errorf("invalid format") // ErrInvalidProvider indicates a cluster stack string has an invalid provider. ErrInvalidProvider = fmt.Errorf("invalid provider") // ErrInvalidName indicates a cluster stack string has an invalid name. ErrInvalidName = fmt.Errorf("invalid name") )
Functions ¶
This section is empty.
Types ¶
type ClusterStack ¶
type ClusterStack struct { Provider string Name string KubernetesVersion kubernetesversion.KubernetesVersion Version version.Version }
ClusterStack contains all properties defining a cluster stack.
func New ¶
func New(provider, name, kubernetesVersion, csVersion string) (ClusterStack, error)
New returns a ClusterStack based on a cluster stack properties and the version is in the form of - "v1", "v1-alpha.1", etc.
func NewFromClusterClassProperties ¶
func NewFromClusterClassProperties(str string) (ClusterStack, error)
NewFromClusterClassProperties returns a ClusterStack based on a cluster stack string. e.g. - "docker-ferrol-1-27-v1", "docker-ferrol-1-27-v1-alpha.1", etc.
func NewFromClusterStackReleaseProperties ¶
func NewFromClusterStackReleaseProperties(str string) (ClusterStack, error)
NewFromClusterStackReleaseProperties returns a ClusterStack based on a cluster stack string. e.g. - "docker-ferrol-1-27-v1", "docker-ferrol-1-27-v1-alpha-1", etc.
func (*ClusterStack) String ¶
func (cs *ClusterStack) String() string
String returns cluster stack with "-" notation.
func (*ClusterStack) StringWithDot ¶
func (cs *ClusterStack) StringWithDot() string
StringWithDot returns cluster stack with semver "." notation.
func (*ClusterStack) Validate ¶
func (cs *ClusterStack) Validate() error
Validate validates a given ClusterStack.
type ClusterStacks ¶
type ClusterStacks []ClusterStack
ClusterStacks implements sort.Interface for []ClusterStack based on the release name / tag.
func (ClusterStacks) Contains ¶
func (r ClusterStacks) Contains(name string) bool
Contains return if releases slice contains the given name or not.
func (ClusterStacks) Latest ¶
func (r ClusterStacks) Latest() *ClusterStack
Latest returns the latest release from the slice. If the slice is empty, it returns nil. The slice is expected to be sorted.
func (ClusterStacks) Less ¶
func (r ClusterStacks) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (ClusterStacks) Swap ¶
func (r ClusterStacks) Swap(i, j int)
Swap swaps the elements with indexes i and j.