db

package
v0.0.0-...-1d96728 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchComponentStatuses

func FetchComponentStatuses(clientset *kubernetes.Clientset) ([]v1.ComponentStatus, error)

func FetchEndpoints

func FetchEndpoints(clientset *kubernetes.Clientset, names []NamespaceName) (map[NamespaceName]v1.Endpoints, error)

FetchEndpoints requests the given endpoints.

func FetchImages

func FetchImages(ec2client *ec2.EC2, instances []ec2.Instance) ([]*ec2.Image, error)

FetchImages fetches ec2 images used by the given instances.

func FetchInstances

func FetchInstances(ec2client *ec2.EC2, nodes []v1.Node) ([]ec2.Instance, error)

FetchInstances gets the AWS instances references by the given nodes. It also extracts the tag KubernetesCluster from the resulting instances, and fetches all instances with the same KubernetesCluster tag, returning a merged list (without duplicates).

func FetchNodes

func FetchNodes(clientset *kubernetes.Clientset) ([]v1.Node, error)

FetchNodes requests all nodes and returns the items without list metadata.

func FetchPods

func FetchPods(clientset *kubernetes.Clientset) ([]v1.Pod, error)

FetchPods requests pods from all namespaces and returns a merged list.

func LeaderHolderIdentity

func LeaderHolderIdentity(ep v1.Endpoints) (string, error)

Types

type AwsData

type AwsData struct {
	Instances []ec2.Instance
	Images    []*ec2.Image
}

func FetchAws

func FetchAws(ec2client *ec2.EC2, nodes []v1.Node) (AwsData, error)

type ComponentStatus

type ComponentStatus struct {
	Name   string
	Status string
}

type ComponentStatusSortByName

type ComponentStatusSortByName []ComponentStatus

func (ComponentStatusSortByName) Len

Len implements sort.Interface

func (ComponentStatusSortByName) Less

func (a ComponentStatusSortByName) Less(i, j int) bool

Less implements sort.Interface, sorting by role, aws state, name

func (ComponentStatusSortByName) Swap

func (a ComponentStatusSortByName) Swap(i, j int)

Swap implements sort.Interface

type DB

type DB struct {
	Snapshots <-chan Snapshot
	// contains filtered or unexported fields
}

func NewDB

func NewDB(logger *logger.Logger, clientset *kubernetes.Clientset, ec2client *ec2.EC2) *DB

func (*DB) Aws

func (db *DB) Aws() chan<- AwsData

func (*DB) Kubernetes

func (db *DB) Kubernetes() chan<- KubernetesData

func (*DB) Nodes

func (db *DB) Nodes() ([]v1.Node, bool)

type DefaultSort

type DefaultSort []*NodeTableRow

func (DefaultSort) Len

func (rows DefaultSort) Len() int

Len implements sort.Interface

func (DefaultSort) Less

func (rows DefaultSort) Less(i, j int) bool

Less implements sort.Interface, sorting by role, aws state, name

func (DefaultSort) Swap

func (rows DefaultSort) Swap(i, j int)

Swap implements sort.Interface

type KubernetesData

type KubernetesData struct {
	ComponentStatuses []v1.ComponentStatus
	Nodes             []v1.Node
	Pods              []v1.Pod
	Endpoints         map[NamespaceName]v1.Endpoints
}

func FetchKubernetes

func FetchKubernetes(clientset *kubernetes.Clientset) (KubernetesData, error)

type NamespaceName

type NamespaceName struct {
	Namespace string
	Name      string
}

type NodeTable

type NodeTable struct {
	Rows []*NodeTableRow
	// contains filtered or unexported fields
}

func NewNodeTable

func NewNodeTable() *NodeTable

func (*NodeTable) ByAwsID

func (nt *NodeTable) ByAwsID(id string) (*NodeTableRow, int, bool)

func (*NodeTable) ByName

func (nt *NodeTable) ByName(name string) (*NodeTableRow, int, bool)

func (*NodeTable) Insert

func (nt *NodeTable) Insert(row *NodeTableRow) int

Insert appends a row to the table and returns the index of the newly inserted node.

func (*NodeTable) Sort

func (nt *NodeTable) Sort()

func (*NodeTable) WithRowAtAwsID

func (nt *NodeTable) WithRowAtAwsID(id string, f func(*NodeTableRow))

func (*NodeTable) WithRowAtName

func (nt *NodeTable) WithRowAtName(name string, f func(*NodeTableRow))

type NodeTableRow

type NodeTableRow struct {
	IsMaster                  bool
	IsControllerManagerLeader bool
	IsSchedulerLeader         bool
	IsCordoned                bool
	Name                      string
	CreatedAt                 time.Time
	PodCounts                 PodCounts
	PodsPendingCount          int
	PodsRunningCount          int
	PodsSucceededCount        int
	PodsFailedCount           int
	PodsUnknownCount          int
	KubeletVersion            string
	AwsID                     string // k8s external id, also in aws
	ImageID                   string
	ImageVersion              string
	AwsState                  string
	KubernetesCluster         string // aws tag
}

type PodCounts

type PodCounts struct {
	Total     int
	Pending   int
	Running   int
	Succeeded int
	Failed    int
	Unknown   int
}

type Snapshot

type Snapshot struct {
	ComponentStatuses []ComponentStatus
	ClusterName       string
	ClusterPodCounts  PodCounts
	NodeCount         int
	NodeTable         *NodeTable
}

func Join

func Join(kubernetesData KubernetesData, awsData AwsData) Snapshot

Jump to

Keyboard shortcuts

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