k8s

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const NAValue = "n/a"

NAValue represents a missing value.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents an api server client.

func NewClient

func NewClient(flags *config.Flags) *Client

NewClient create Kubernetes apiservice client.

func (*Client) ActiveCluster added in v0.2.0

func (c *Client) ActiveCluster() (name string)

ActiveCluster get the current cluster name.

func (*Client) ActiveNamespace added in v0.2.0

func (c *Client) ActiveNamespace() string

ActiveNamespace returns the active namespace from the args or kubeconfig. It returns all namespace is none is found.

func (*Client) ClusterHasMetrics

func (c *Client) ClusterHasMetrics() (bool, error)

ClusterHasMetrics checks if metrics server is available on the cluster.

func (*Client) Dial

func (c *Client) Dial() (kubernetes.Interface, error)

Dial returns a handle to api server.

func (*Client) DialOrDie

func (c *Client) DialOrDie() kubernetes.Interface

DialOrDie returns an api server client connection or dies.

func (*Client) DialVersioned added in v0.3.4

func (c *Client) DialVersioned() (*versioned.Clientset, error)

DialVersioned connects to the versioned client to pull cluster metrics.

func (*Client) IsActiveNamespace added in v0.3.4

func (c *Client) IsActiveNamespace(ns string) bool

IsActiveNamespace check if current ns is equal to specified namespace if a namespace is set.

func (*Client) RESTConfig added in v0.2.0

func (c *Client) RESTConfig() (*rest.Config, error)

RESTConfig fetch the current REST api-server connection.

func (*Client) RawConfig added in v0.2.0

func (c *Client) RawConfig() (clientcmdapi.Config, error)

RawConfig fetch the current kubeconfig with no overrides.

type ContainerMetrics

type ContainerMetrics map[string]Metrics

ContainerMetrics tracks container metrics

type Metrics

type Metrics struct {
	CurrentCPU resource.Quantity
	CurrentMEM resource.Quantity
}

Metrics represent an aggregation of all pod containers metrics.

func (Metrics) Empty

func (m Metrics) Empty() bool

Empty checks if we have any metrics.

type NodeMetrics

type NodeMetrics struct {
	CurrentCPU   resource.Quantity
	CurrentMEM   resource.Quantity
	AvailableCPU resource.Quantity
	AvailableMEM resource.Quantity
	TotalCPU     resource.Quantity
	TotalMEM     resource.Quantity
}

NodeMetrics describes raw node metrics.

func (NodeMetrics) Empty

func (n NodeMetrics) Empty() bool

Empty checks if we have any metrics.

type NodesMetrics

type NodesMetrics map[string]NodeMetrics

NodesMetrics tracks usage metrics per nodes.

type PodsMetrics

type PodsMetrics map[string]ContainerMetrics

PodsMetrics tracks usage metrics per pods.

Jump to

Keyboard shortcuts

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