kube

package
v0.0.0-...-6cdb919 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvK8sClientQPS   = "HORIZON_K8S_CLIENT_QPS"
	EnvK8sClientBurst = "HORIZON_K8S_CLIENT_BURST"
)
View Source
const DefaultEventsLimit = 100

Variables

View Source
var (
	K8sClientConfigQPS   float32 = 50
	K8sClientConfigBurst         = 100
)

Functions

func BuildClient

func BuildClient(kubeconfig string) (*rest.Config, kubernetes.Interface, error)

func DeletePods

func DeletePods(ctx context.Context, kubeClientset kubernetes.Interface, namespace string, pod string) (err error)

func Exec

func Exec(ctx context.Context, c ContainerRef,
	command []string, executor exec.RemoteExecutor) (stdout string, stderr string, err error)

func GetDeploymentList

func GetDeploymentList(ctx context.Context, kubeClientset kubernetes.Interface,
	namespace, labelSelector string) (_ []appsv1.Deployment, err error)

func GetEvents

func GetEvents(ctx context.Context, kubeClientset kubernetes.Interface,
	namespace string) (_ map[string][]*v1.Event, err error)

GetEvents Returns a map. key is the basic information of Pod, name-uid-namespace

func GetPod

func GetPod(ctx context.Context, kubeClientset kubernetes.Interface, namespace, podName string) (_ *v1.Pod, err error)

func GetPodEvents

func GetPodEvents(ctx context.Context, kubeClientset kubernetes.Interface, namespace, pod string) (_ []v1.Event,
	err error)

GetPodEvents returns event list of a pod, notice that it will return events from oldest to latest by DefaultEventsLimit

func GetPods

func GetPods(ctx context.Context, kubeClientset kubernetes.Interface,
	namespace, labelSelector string) (_ []v1.Pod, err error)

func GetReplicaSets

func GetReplicaSets(ctx context.Context, kubeClientset kubernetes.Interface,
	namespace, labelSelector string) (_ []appsv1.ReplicaSet, err error)

Types

type Client

type Client struct {
	Basic   kubernetes.Interface
	Dynamic dynamic.Interface
}

func BuildClientFromContent

func BuildClientFromContent(kubeconfigContent string) (*rest.Config, *Client, error)

BuildClientFromContent build client from k8s kubeconfig content, not file path

type ContainerRef

type ContainerRef struct {
	Config        *rest.Config
	KubeClientset kubernetes.Interface
	Namespace     string
	Pod           string
	Container     string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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