v1alpha1

package
v1.11.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHostName

func GetHostName(name string) (string, error)

GetHostName returns the hostname corresponding to the provided node name

func GetHostNameOrNodeName

func GetHostNameOrNodeName(name string) (string, error)

GetHostNameOrNodeName returns the hostname corresponding to the provided node name or node name itself if hostname is not available

func TemplateFunctions

func TemplateFunctions() template.FuncMap

TemplateFunctions exposes a few functions as go template functions

Types

type Builder

type Builder struct {
	Node *Node
}

Builder is the builder object for Pod

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns new instance of Builder

func (*Builder) WithAPINode

func (b *Builder) WithAPINode(node *corev1.Node) *Builder

WithAPINode builds the node instances based on the provided node

func (*Builder) WithTaints

func (b *Builder) WithTaints(taintsToAdd []corev1.Taint) *Builder

WithTaints add taints to the Node resource

type KubeClientBuildOption

type KubeClientBuildOption func(*Kubeclient)

KubeClientBuildOption defines the abstraction to build a kubeclient instance

func WithKubeConfigPath

func WithKubeConfigPath(path string) KubeClientBuildOption

WithKubeConfigPath sets the kubeConfig path against client instance

type Kubeclient

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

Kubeclient enables kubernetes API operations on node instance

func KubeClientInstanceOrDie

func KubeClientInstanceOrDie() *Kubeclient

KubeClientInstanceOrDie returns the singleton instance of Kubeclient

Usage:

Caller code will use syntax(-es) as shown below:

```go import (

node "github.com/openebs/maya/pkg/kubernetes/node/v1alpha1"

)

node.KubeClientInstanceOrDie().Get(...) node.KubeClientInstanceOrDie().Create(...) node.KubeClientInstanceOrDie().Update(...) node.KubeClientInstanceOrDie().List(...) ```

func NewKubeClient

func NewKubeClient(opts ...KubeClientBuildOption) *Kubeclient

NewKubeClient returns a new instance of kubeclient meant for node

func (*Kubeclient) CordonViaPatch

func (k *Kubeclient) CordonViaPatch(node *corev1.Node, isCordon bool) error

CordonViaPatch cordon/uncordon node in cluster using patch

func (*Kubeclient) CordonViaUpdate

func (k *Kubeclient) CordonViaUpdate(node *corev1.Node, isCordon bool) error

CordonViaUpdate cordon/uncordon node in cluster using update

func (*Kubeclient) Get

func (k *Kubeclient) Get(name string, opts metav1.GetOptions) (*corev1.Node, error)

Get returns a node resource instances present in kubernetes cluster

func (*Kubeclient) GetHostName

func (k *Kubeclient) GetHostName(name string, opts metav1.GetOptions) (string, error)

GetHostName returns a hostname corresponding to the provided node name

func (*Kubeclient) GetHostNameOrNodeName

func (k *Kubeclient) GetHostNameOrNodeName(
	name string,
	opts metav1.GetOptions,
) (string, error)

GetHostNameOrNodeName returns a hostname corresponding to the provided node name or returns the node name if hostname is not available

func (*Kubeclient) List

func (k *Kubeclient) List(opts metav1.ListOptions) (*corev1.NodeList, error)

List returns a list of nodes instances present in kubernetes cluster

func (*Kubeclient) Patch

func (k *Kubeclient) Patch(name string,
	pt types.PatchType,
	data []byte,
	subresources ...string) (*corev1.Node, error)

Patch patches the Node in kubernetes cluster

func (*Kubeclient) Update

func (k *Kubeclient) Update(node *corev1.Node) (*corev1.Node, error)

Update updates the Node in kubernetes cluster

type ListBuilder

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

ListBuilder enables building an instance of NodeList

func NewListBuilder

func NewListBuilder() *ListBuilder

NewListBuilder returns a instance of ListBuilder

func (*ListBuilder) List

func (b *ListBuilder) List() *NodeList

List returns the list of node instances that was built by this builder

func (*ListBuilder) WithAPIList

func (b *ListBuilder) WithAPIList(nodes *corev1.NodeList) *ListBuilder

WithAPIList builds the list of node instances based on the provided node list

func (*ListBuilder) WithAPIObject

func (b *ListBuilder) WithAPIObject(nodes ...corev1.Node) *ListBuilder

WithAPIObject builds the list of node instances based on node api instances

func (*ListBuilder) WithFilter

func (b *ListBuilder) WithFilter(pred ...Predicate) *ListBuilder

WithFilter add filters on which the node has to be filtered

func (*ListBuilder) WithObject

func (b *ListBuilder) WithObject(nodes ...*Node) *ListBuilder

WithObject builds the list of node instances based on the provided node list instance

type Node

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

Node holds the api's node object

func (*Node) IsReady

func (n *Node) IsReady() bool

IsReady retuns true if the node is in ready state

type NodeList

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

NodeList holds the list of node instances

func (*NodeList) Len

func (n *NodeList) Len() int

Len returns the number of items present in the NodeList

func (*NodeList) ToAPIList

func (n *NodeList) ToAPIList() *corev1.NodeList

ToAPIList converts NodeList to API NodeList

type Predicate

type Predicate func(*Node) bool

Predicate defines an abstraction to determine conditional checks against the provided node instance

func IsReady

func IsReady() Predicate

IsReady is a Predicate to filter out nodes which are in running state

Jump to

Keyboard shortcuts

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