clusters

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace added in v0.6.3

func CreateNamespace(ctx context.Context, cluster Cluster, namespace string) error

CreateNamespace creates a new namespace in the given cluster provided a name.

func DeleteIngress added in v0.6.1

func DeleteIngress(ctx context.Context, c Cluster, namespace string, ingress runtime.Object) (err error)

DeleteIngress is a helper and function to delete an Ingress object to a cluster handling the version of the Ingress object for the caller so they don't have to. TODO: once we stop supporting old Kubernetes versions <1.19 we can remove this.

func DeployIngress added in v0.6.1

func DeployIngress(ctx context.Context, c Cluster, namespace string, ingress runtime.Object) (err error)

DeployIngress is a helper and function to deploy an Ingress object to a cluster handling the version of the Ingress object for the caller so they don't have to. TODO: once we stop supporting old Kubernetes versions <1.19 we can remove this.

func GetIngressLoadbalancerStatus added in v0.6.1

func GetIngressLoadbalancerStatus(ctx context.Context, c Cluster, namespace string, ingress runtime.Object) (*corev1.LoadBalancerStatus, error)

GetIngressLoadbalancerStatus is a partner to the above DeployIngress function which will given an Ingress object provided by the caller determine the version and pull a fresh copy of the current LoadBalancerStatus for that Ingress object without the caller needing to be aware of which version of Ingress they're using. TODO: once we stop supporting old Kubernetes versions <1.19 we can remove this.

Types

type Addon

type Addon interface {
	// Name indicates the unique name of the Addon
	Name() AddonName

	// Deploy deploys the addon component to a provided cluster.
	Deploy(ctx context.Context, cluster Cluster) error

	// Delete removes the addon component from the given cluster.
	Delete(ctx context.Context, cluster Cluster) error

	// Ready is a non-blocking call which checks the status of the addon on the
	// cluster and reports any runtime.Objects which are still unresolved.
	// If all components are ready, this method will return [], true, nil.
	// If the addon has failed unrecoverably, it will provide an error.
	Ready(ctx context.Context, cluster Cluster) (waitingForObjects []runtime.Object, ready bool, err error)
}

Addon is a loadable component to extend the functionality of a Cluster.

type AddonName

type AddonName string

AddonName indicates a unique name for Addons which can be deployed to Clusters.

type Addons

type Addons map[AddonName]Addon

Addons is a map type for collecting a list of unique Addons.

type Cluster

type Cluster interface {
	// Name indicates the unique name of the running cluster.
	Name() string

	// Type indicates the type of Kubernetes Cluster (e.g. Kind, GKE, e.t.c.)
	Type() Type

	// Version indicates the Kubernetes server version of the cluster.
	Version() (semver.Version, error)

	// Client is the configured *kubernetes.Clientset which can be used to access the Cluster's API
	Client() *kubernetes.Clientset

	// Config provides the *rest.Config for the cluster which is convenient for initiating custom kubernetes.Clientsets.
	Config() *rest.Config

	// Cleanup performance any cleanup and teardown needed to destroy the cluster.
	Cleanup(ctx context.Context) error

	// GetAddon retrieves and Addon object from the cluster if that addon was previously loaded.
	GetAddon(name AddonName) (Addon, error)

	// ListAddons lists the addon components currently loaded into the cluster.
	ListAddons() []Addon

	// DeployAddon deploys a new addon component to the cluster.
	DeployAddon(ctx context.Context, addon Addon) error

	// DeleteAddon removes an existing cluster Addon.
	DeleteAddon(ctx context.Context, addon Addon) error
}

Cluster objects represent a running Kubernetes cluster.

type Type

type Type string

Type indicates the type of Kubernetes cluster (e.g. Kind, GKE, e.t.c.)

Directories

Path Synopsis
addons
types
gke

Jump to

Keyboard shortcuts

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