clusterinfo

package
v0.0.0-...-41647a6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInitialization = errors.New("initialization")

ErrInitialization is returned when client initialization fails

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a resource could not be found

Functions

This section is empty.

Types

type Client

type Client interface {
	Nodes() NodesClient
}

Client is used to interface with a Kubernetes cluster

func NewClientInsideCluster

func NewClientInsideCluster() (Client, error)

NewClientInsideCluster initializes a Client for use inside of a cluster

func NewClientOutsideCluster

func NewClientOutsideCluster(opts ...NewClientOutsideClusterOption) (Client, error)

NewClientOutsideCluster initializes a Client for use outside of a cluster. Optional options can be passed to alter default parameters

type NewClientOutsideClusterOption

type NewClientOutsideClusterOption interface {
	// contains filtered or unexported methods
}

NewClientOutsideClusterOption can be passed when initializing a Client for use outside a cluster to alter default parameters

func WithConfigLocation

func WithConfigLocation(absolutePath string) NewClientOutsideClusterOption

WithConfigLocation is an option to set a custom Kubernetes config location

type Node

type Node struct {
	Name       string        `json:"name"`
	Hostname   string        `json:"hostname"`
	InternalIP string        `json:"internal_ip"`
	Resources  NodeResources `json:"resources"`
	System     NodeSystem    `json:"system"`
}

Node represents a node in the cluster

type NodeList

type NodeList map[string]Node

NodeList contains nodes, where each node can be indexed by its name

func (NodeList) All

func (nl NodeList) All() []Node

All returns all nodes in the NodeList

type NodeResources

type NodeResources struct {
	// CPU is measured in cores
	CPU Resource `json:"cpu"`
	// Memory is measured in bytes
	Memory Resource `json:"memory"`
}

NodeResources is a collection of hardware resources

type NodeSystem

type NodeSystem struct {
	Arch          string `json:"arch"`
	OS            string `json:"os"`
	KernelVersion string `json:"kernel_version"`
	OSImage       string `json:"os_image"`
}

NodeSystem describes system information for a node

type NodesClient

type NodesClient interface {
	List() (NodeList, error)
	Get(name string) (Node, error)
}

NodesClient exposes access to cluster nodes

type Resource

type Resource struct {
	Capacity int64   `json:"capacity"`
	Usage    float64 `json:"usage"`
}

Resource represents an allocatable hardware resource

Jump to

Keyboard shortcuts

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