popeye: github.com/derailed/popeye/internal/k8s Index | Files

package k8s

import "github.com/derailed/popeye/internal/k8s"


Package Files

client.go metrics.go

type Client Uses

type Client struct {
    // contains filtered or unexported fields

Client represents an api server client.

func NewClient Uses

func NewClient(flags *config.Flags) *Client

NewClient create Kubernetes apiservice client.

func (*Client) ActiveCluster Uses

func (c *Client) ActiveCluster() string

ActiveCluster get the current cluster name.

func (*Client) ActiveNamespace Uses

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 Uses

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

ClusterHasMetrics checks if metrics server is available on the cluster.

func (*Client) Dial Uses

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

Dial returns a handle to api server.

func (*Client) DialOrDie Uses

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

DialOrDie returns an api server client connection or dies.

func (*Client) DialVersioned Uses

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

DialVersioned connects to the versioned client to pull cluster metrics.

func (*Client) IsActiveNamespace Uses

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 Uses

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

RESTConfig fetch the current REST api-server connection.

func (*Client) RawConfig Uses

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

RawConfig fetch the current kubeconfig with no overrides.

type ContainerMetrics Uses

type ContainerMetrics map[string]Metrics

ContainerMetrics tracks container metrics

type Metrics Uses

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

Metrics represent an aggregation of all pod containers metrics.

func (Metrics) Empty Uses

func (m Metrics) Empty() bool

Empty checks if we have any metrics.

type NodeMetrics Uses

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 Uses

func (n NodeMetrics) Empty() bool

Empty checks if we have any metrics.

type NodesMetrics Uses

type NodesMetrics map[string]NodeMetrics

NodesMetrics tracks usage metrics per nodes.

type PodsMetrics Uses

type PodsMetrics map[string]ContainerMetrics

PodsMetrics tracks usage metrics per pods.

Package k8s imports 8 packages (graph) and is imported by 4 packages. Updated 2019-12-09. Refresh now. Tools for package owners.