gke

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodePoolLabel        = "cloud.google.com/gke-nodepool"
	PreemptibleLabel     = "cloud.google.com/gke-preemptible"
	NodeRegionLabel      = "failure-domain.beta.kubernetes.io/region"
	NodeZoneLabel        = "failure-domain.beta.kubernetes.io/zone"
	ResourceEvictionKind = "Eviction"
	ResourceEvictionName = "pods/eviction"
	NodeNameMaxLength    = 37
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetCluster returns the owned cluster.
	GetCluster(ctx context.Context) (*Cluster, error)
	// GetNodePool returns the node pool by the node pool name.
	GetNodePool(ctx context.Context, nodePoolName string) (*NodePool, error)
	// GetNodePoolList returns the node pool list by the owned cluster.
	GetNodePoolList(ctx context.Context) ([]*NodePool, error)
	// GetNode returns the node by the node name.
	GetNode(ctx context.Context, nodeName string) (*Node, error)
	// GetNodeList returns the nodes into the owned cluster.
	GetNodeList(ctx context.Context) ([]*Node, error)
	// GetPod returns the pod by the pod name.
	GetPod(ctx context.Context, podName string) (*Pod, error)
	// GetPodListByNodeName returns the pod list by the node name.
	GetPodListByNodeName(ctx context.Context, nodeName string) ([]*Pod, error)
	// RefreshNode drains node and deletes node if preemptible.
	RefreshNode(ctx context.Context, nodeName string) (evictedPods []*Pod, err error)
	// RefreshNodes drains nodes and deletes nodes if preemptible.
	RefreshNodes(ctx context.Context, nodeNames []string) (evictedPods []*Pod, err error)
}

func New

func New(ctx context.Context, project, clusterName, clusterLocation string, useLocalConfig bool) (Client, error)

type Cluster

type Cluster struct {
	Name        string
	ResourceURL string
	Region      string
	Status      containerProtoV1.Cluster_Status
	NodePool    []*NodePool
}

type Node

type Node struct {
	Name        string
	ResourceURL string
	ClusterName string
	NodePool    string
	Region      string
	Zone        string
	Ready       bool
	Preemptible bool
	Age         time.Duration
	Pods        []*Pod
}

type NodePool

type NodePool struct {
	Name              string
	ResourceURL       string
	Preemptible       bool
	Autoscale         bool
	MinNodeCount      int
	MaxNodeCount      int
	Status            containerProtoV1.NodePool_Status
	InstanceGroupURLs []string
}

type Pod

type Pod struct {
	Name      string
	Namespace string
	NodeName  string
	Hostname  string
	Status    coreV1.PodStatus
}

Jump to

Keyboard shortcuts

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