k8s

package
v3.6.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Force               = true
	IgnoreDaemonsets    = true
	DeleteLocalData     = true
	EvictionKind        = "Eviction"
	EvictionSubresource = "pods/eviction"
)

Variables

This section is empty.

Functions

func AddSource

func AddSource(key string, object interface{}) error

AddSource 添加资源

func CordonOrUnCordon

func CordonOrUnCordon(nodeName string, drain bool) (*v1.Node, error)

CordonOrUnCordon 节点是否调度属性处理 drain:true 不可调度

func CreatK8sNodeFromRainbonNode

func CreatK8sNodeFromRainbonNode(rainbondNode *model.HostNode) (*v1.Node, error)

CreatK8sNodeFromRainbonNode 创建k8s node

func CreateK8sNode

func CreateK8sNode(node *model.HostNode) (*v1.Node, error)

func DeleteNode

func DeleteNode(nodename string) error

DeleteNode k8s节点下线

func DeleteOrEvictPodsSimple

func DeleteOrEvictPodsSimple(nodeName string) error

DeleteOrEvictPodsSimple 驱逐Pod

func DeleteSource

func DeleteSource(key string) error

func GetAllPods

func GetAllPods() (pods []v1.Pod, err error)

GetAllPods get all pods

func GetNodeByName

func GetNodeByName(nodename string) (*v1.Node, error)

GetNodeByName get node

func GetPodsByNodeName

func GetPodsByNodeName(nodeName string) (pods []v1.Pod, err error)

GetPodsByNodeName get pods by nodename

func GetSource

func GetSource(key string) (node *model.HostNode, err error)

func GetSourceList

func GetSourceList() ([]*model.HostNode, error)

func LabelMulti

func LabelMulti(k8sNodeName string, keys []string) error

func MarkLabel

func MarkLabel(k8sNodeName, key, value string) error

func NewK8sClient

func NewK8sClient(cfg *option.Conf) error

NewK8sClient new k8s client

func SupportEviction

func SupportEviction(clientset *kubernetes.Clientset) (string, error)

SupportEviction uses Discovery API to find out if the server support eviction subresource If support, it will return its groupVersion; Otherwise, it will return ""

func UpdateLabels

func UpdateLabels(nodeName string, labels map[string]string) (*v1.Node, error)

UpdateLabels update lables

Types

type Client

type Client struct {
	*kubernetes.Clientset
}

Client k8sclient

var (
	K8S *Client
)

Jump to

Keyboard shortcuts

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