kube

package
v0.0.0-...-420457a Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvictionKind       = "Eviction"
	PolicyGroupVersion = "policy/v1beta1"
)
View Source
const (
	HostnameLabel        = "kubernetes.io/hostname"
	NodeRoleLabel        = "node-role.kubernetes.io/master"
	MaxRetries           = 5
	RetryInterval        = 5
	WrapTransportTimeout = 30
)

Variables

View Source
var (
	KubeDefaultConfigPath = getUserHome() + "/.supkube/admin.conf"
)

Functions

func CordonUnCordon

func CordonUnCordon(k8sClient *kubernetes.Clientset, nodeName string, cordoned bool) error

func EvictNodePods

func EvictNodePods(nodeName string, k8sClient *kubernetes.Clientset) error

func EvictPod

func EvictPod(k8sClient *kubernetes.Clientset, pod v1.Pod, policyGroupVersion string) error

func GetNodeByName

func GetNodeByName(k8sClient *kubernetes.Clientset, nodeName string) (node *v1.Node, err error)

GetNodeByName is get node internalIp by nodeName

func GetNodeIPByLabel

func GetNodeIPByLabel(k8sClient *kubernetes.Clientset, label string) ([]string, error)

GetNodeIPByLabel is is get node ip by label

func GetNodeIPByName

func GetNodeIPByName(k8sClient *kubernetes.Clientset, nodeName string) (ip string, err error)

GetNodeIPByName is get node internalIp by nodeName

func GetNodeList

func GetNodeList(k8sClient *kubernetes.Clientset) (*v1.NodeList, error)

GetNodeList is get all nodes

func GetNodeListByLabel

func GetNodeListByLabel(k8sClient *kubernetes.Clientset, label string) (*v1.NodeList, error)

GetNodeListByLabel is get node list by label

func IsIpv4

func IsIpv4(ip string) bool

func IsNodeReady

func IsNodeReady(node v1.Node) bool

IsNodeReady return true when node is ready

func NewClient

func NewClient(kubeConfigPath string, k8sWrapTransport transport.WrapperFunc) (*kubernetes.Clientset, error)

NewClient is get clientSet by kubeConfig

func TransToIP

func TransToIP(k8sClient *kubernetes.Clientset, label string, hostname []string) ([]string, error)

TransToIP is use kubernetes label or hostname/ip to get ip

Types

This section is empty.

Jump to

Keyboard shortcuts

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