k8s

package
v0.0.0-...-8e6f2e6 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 17 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"
	WrapTransportTimeout = 30
)

Variables

This section is empty.

Functions

func CordonUnCordon

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

func DeleteNamespace

func DeleteNamespace(ctx context.Context, client *kubernetes.Clientset, namespace string, ns *v1.Namespace) 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 GetDpByName

func GetDpByName(k8sClient *kubernetes.Clientset, name string, namespace string) (*v1.Deployment, error)

func GetDps

func GetDps(k8sClient *kubernetes.Clientset, namespace string) (*v1.DeploymentList, error)

func GetImageByDpName

func GetImageByDpName(k8sClient *kubernetes.Clientset, name, namespace string) (imageName, version string, err 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 GetNodeNameByIp

func GetNodeNameByIp(k8sClient *kubernetes.Clientset, ip string) (name string, err error)

GetNodeNameByIp is get node name by node ip

func GetNodeNameByLabel

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

GetNodeNameByLabel is get node name by label

func GetPodsByLabel

func GetPodsByLabel(k8sClient *kubernetes.Clientset, namespace, label string) (*v1.PodList, error)

func GetPodsByName

func GetPodsByName(k8sClient *kubernetes.Clientset, namespace, name string) (*v1.PodList, error)

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(k8sWrapTransport transport.WrapperFunc) (*kubernetes.Clientset, error)

NewClient is get clientSet by kubeConfig

func SetDpImage

func SetDpImage(k8sClient *kubernetes.Clientset, name, namespace, image string) (err error)

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