node

package
v0.37.4 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ServerVersion is used to parse out the version of the API running
	ServerVersion = `(Server Version:\s)+(.*)`
)

Variables

This section is empty.

Functions

func AreAllReady

func AreAllReady(nodeCount int) bool

AreAllReady returns a bool depending on cluster state

func Version

func Version() (string, error)

Version get the version of the server

func WaitOnReady

func WaitOnReady(nodeCount int, sleep, duration time.Duration) bool

WaitOnReady will block until all nodes are in ready state

Types

type Address

type Address struct {
	Address string `json:"address"`
	Type    string `json:"type"`
}

Address contains an address and a type

type Condition

type Condition struct {
	LastHeartbeatTime  time.Time `json:"lastHeartbeatTime"`
	LastTransitionTime time.Time `json:"lastTransitionTime"`
	Message            string    `json:"message"`
	Reason             string    `json:"reason"`
	Status             string    `json:"status"`
	Type               string    `json:"type"`
}

Condition contains various status information

type Info

type Info struct {
	ContainerRuntimeVersion string `json:"containerRuntimeVersion"`
	KubeProxyVersion        string `json:"kubeProxyVersion"`
	KubeletProxyVersion     string `json:"kubeletVersion"`
	OperatingSystem         string `json:"operatingSystem"`
	OSImage                 string `json:"osImage"`
}

Info contains node information like what version the kubelet is running

type List

type List struct {
	Nodes []Node `json:"items"`
}

List is used to parse out Nodes from a list

func Get

func Get() (*List, error)

Get returns the current nodes for a given kubeconfig

func GetReady added in v0.35.0

func GetReady() (*List, error)

GetReady returns the current nodes for a given kubeconfig

type Metadata

type Metadata struct {
	Name        string            `json:"name"`
	CreatedAt   time.Time         `json:"creationTimestamp"`
	Labels      map[string]string `json:"labels"`
	Annotations map[string]string `json:"annotations"`
}

Metadata contains things like name and created at

type Node

type Node struct {
	Status   Status   `json:"status"`
	Metadata Metadata `json:"metadata"`
	Spec     Spec     `json:"spec"`
}

Node represents the kubernetes Node Resource

func GetByAnnotations added in v0.33.0

func GetByAnnotations(key, value string) ([]Node, error)

GetByAnnotations will return a []Node of all nodes that have a matching annotation

func GetByLabel added in v0.33.0

func GetByLabel(label string) ([]Node, error)

GetByLabel will return a []Node of all nodes that have a matching label

func GetByPrefix

func GetByPrefix(prefix string) ([]Node, error)

GetByPrefix will return a []Node of all nodes that have a name that match the prefix

func GetByTaint added in v0.33.0

func GetByTaint(key, value, effect string) ([]Node, error)

GetByTaint will return a []Node of all nodes that have a matching taint

func (*Node) HasSubstring added in v0.36.0

func (n *Node) HasSubstring(substrings []string) bool

HasSubstring determines if a node name matches includes the passed in substring

func (*Node) IsLinux added in v0.35.0

func (n *Node) IsLinux() bool

IsLinux checks for a Linux node

func (*Node) IsReady added in v0.35.0

func (n *Node) IsReady() bool

IsReady returns if the node is in a Ready state

func (*Node) IsUbuntu added in v0.35.0

func (n *Node) IsUbuntu() bool

IsUbuntu checks for an Ubuntu-backed node

func (*Node) IsWindows added in v0.37.0

func (n *Node) IsWindows() bool

IsWindows checks for a Windows node

type Spec added in v0.33.0

type Spec struct {
	Taints []Taint `json:"taints"`
}

Spec contains things like taints

type Status

type Status struct {
	NodeInfo      Info        `json:"nodeInfo"`
	NodeAddresses []Address   `json:"addresses"`
	Conditions    []Condition `json:"conditions"`
}

Status parses information from the status key

func (*Status) GetAddressByType

func (ns *Status) GetAddressByType(t string) *Address

GetAddressByType will return the Address object for a given Kubernetes node

type Taint added in v0.33.0

type Taint struct {
	Effect string `json:"effect"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

Taint defines a Node Taint

Jump to

Keyboard shortcuts

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