Documentation ¶
Index ¶
- func GetHostName(name string) (string, error)
- func GetHostNameOrNodeName(name string) (string, error)
- func TemplateFunctions() template.FuncMap
- type Builder
- type KubeClientBuildOption
- type Kubeclient
- func (k *Kubeclient) CordonViaPatch(node *corev1.Node, isCordon bool) error
- func (k *Kubeclient) CordonViaUpdate(node *corev1.Node, isCordon bool) error
- func (k *Kubeclient) Get(name string, opts metav1.GetOptions) (*corev1.Node, error)
- func (k *Kubeclient) GetHostName(name string, opts metav1.GetOptions) (string, error)
- func (k *Kubeclient) GetHostNameOrNodeName(name string, opts metav1.GetOptions) (string, error)
- func (k *Kubeclient) List(opts metav1.ListOptions) (*corev1.NodeList, error)
- func (k *Kubeclient) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*corev1.Node, error)
- func (k *Kubeclient) Update(node *corev1.Node) (*corev1.Node, error)
- type ListBuilder
- func (b *ListBuilder) List() *NodeList
- func (b *ListBuilder) WithAPIList(nodes *corev1.NodeList) *ListBuilder
- func (b *ListBuilder) WithAPIObject(nodes ...corev1.Node) *ListBuilder
- func (b *ListBuilder) WithFilter(pred ...Predicate) *ListBuilder
- func (b *ListBuilder) WithObject(nodes ...*Node) *ListBuilder
- type Node
- type NodeList
- type Predicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHostName ¶
GetHostName returns the hostname corresponding to the provided node name
func GetHostNameOrNodeName ¶
GetHostNameOrNodeName returns the hostname corresponding to the provided node name or node name itself if hostname is not available
func TemplateFunctions ¶
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 (*Builder) WithAPINode ¶
WithAPINode builds the node instances based on the provided node
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
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