Documentation ¶
Overview ¶
Package kubernetes provides an interface to manage a kubernetes cluster with the help of kind en kubernetes' client-go modules. Use the Builder to create a new cluster.
Index ¶
- type Cluster
- func (c Cluster) GetNodes() (*corev1.NodeList, error)
- func (c *Cluster) GetNumberOfNodes() (int, error)
- func (c *Cluster) GetNumberOfPods(namespace string) (int, error)
- func (c *Cluster) GetNumberOfReadyNodes() (int, error)
- func (c Cluster) GetPods(namespace string) (*corev1.PodList, error)
- func (c *Cluster) RemoveAllApateletsFromCluster() error
- func (c Cluster) RemoveNodeFromCluster(nodename string) error
- func (c Cluster) RemoveNodesFromCluster(uuids []uuid.UUID) error
- func (c *Cluster) Shutdown() error
- type ClusterAPI
- type ClusterManager
- type ClusterManagerHandler
- type KinDClusterManager
- type UnmanagedClusterManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { KubeConfig *kubeconfig.KubeConfig // contains filtered or unexported fields }
Cluster object can be used to interact with kubernetes clusters. It abstracts away calls to the kubernetes client-go api.
func (Cluster) GetNodes ¶
GetNodes returns the number of nodes in the cluster, or an error if it couldn't get these.
func (*Cluster) GetNumberOfNodes ¶
GetNumberOfNodes returns the number of nodes in the cluster, or an error if it couldn't get these.
func (*Cluster) GetNumberOfPods ¶
GetNumberOfPods returns the number of pods in the cluster, or an error if it couldn't get these.
func (*Cluster) GetNumberOfReadyNodes ¶
GetNumberOfReadyNodes returns the number of nodes in the cluster, or an error if it couldn't get these.
func (*Cluster) RemoveAllApateletsFromCluster ¶
RemoveAllApateletsFromCluster removes all apatelets from the Kubernetes cluster.
func (Cluster) RemoveNodeFromCluster ¶
RemoveNodeFromCluster removes a node with a given name from the cluster.
func (Cluster) RemoveNodesFromCluster ¶
RemoveNodesFromCluster removes all apatelet nodes with the given uuids from the cluster.
type ClusterAPI ¶
type ClusterAPI interface { GetNodes() (*corev1.NodeList, error) GetPods(namespace string) (*corev1.PodList, error) GetNumberOfNodes() (int, error) GetNumberOfReadyNodes() (int, error) GetNumberOfPods(namespace string) (int, error) RemoveAllApateletsFromCluster() error RemoveNodesFromCluster(uuids []uuid.UUID) error RemoveNodeFromCluster(nodename string) error }
ClusterAPI are API calls for a cluster connection
type ClusterManager ¶
type ClusterManager interface { // GetKubeConfig returns the KubeConfig by this cluster. This is also the place where one can create the cluster if necessary. GetKubeConfig() (*kubeconfig.KubeConfig, error) // Shutdown is called when the program exits. This can be used to clean up a cluster if necessary. Shutdown(*Cluster) error }
ClusterManager contains utilities to handle connecting / creating a cluster and shutting it down if necessary.
type ClusterManagerHandler ¶
type ClusterManagerHandler struct {
// contains filtered or unexported fields
}
ClusterManagerHandler contains utilities to create cluster objects based on a certain manager.
func NewClusterManagerHandler ¶
func NewClusterManagerHandler() ClusterManagerHandler
NewClusterManagerHandler creates a new ClusterManagerHandler, depending on what environment variables have been set
func (*ClusterManagerHandler) NewCluster ¶
func (cmh *ClusterManagerHandler) NewCluster() (*Cluster, error)
NewCluster creates a new cluster object by calling GetKubeConfig on its manager
func (*ClusterManagerHandler) NewClusterFromKubeConfig ¶
func (cmh *ClusterManagerHandler) NewClusterFromKubeConfig(kubeConfig *kubeconfig.KubeConfig) (*Cluster, error)
NewClusterFromKubeConfig creates a new KubernetesCluster from a location of a kubeconfig.
type KinDClusterManager ¶
type KinDClusterManager struct{}
KinDClusterManager is a struct which implements ClusterManager by creating a kind cluster.
func (*KinDClusterManager) GetKubeConfig ¶
func (k *KinDClusterManager) GetKubeConfig() (*kubeconfig.KubeConfig, error)
GetKubeConfig validates the cluster name, creates the Kind cluster and returns its kubeconfig.
func (*KinDClusterManager) Shutdown ¶
func (k *KinDClusterManager) Shutdown(*Cluster) error
Shutdown deletes the KinD cluster.
type UnmanagedClusterManager ¶
type UnmanagedClusterManager struct{}
UnmanagedClusterManager is a struct which implements ClusterManager by writing the given kubeconfig to a file.
func (*UnmanagedClusterManager) GetKubeConfig ¶
func (u *UnmanagedClusterManager) GetKubeConfig() (*kubeconfig.KubeConfig, error)
GetKubeConfig writes the given kubeconfig and returns it as a struct.
func (*UnmanagedClusterManager) Shutdown ¶
func (u *UnmanagedClusterManager) Shutdown(cluster *Cluster) error
Shutdown currently does nothing.
Directories ¶
Path | Synopsis |
---|---|
Package kubeconfig provides the ability to create, read, and manage the kubeconfig file/bytes.
|
Package kubeconfig provides the ability to create, read, and manage the kubeconfig file/bytes. |
Package mock_kubernetes is a generated GoMock package.
|
Package mock_kubernetes is a generated GoMock package. |
Package node contains some utilities to describe Kubernetes nodes
|
Package node contains some utilities to describe Kubernetes nodes |