podwatch

package
v1.1.31 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLabel

func AddLabel(pod *v1.Pod, key, value string) error

AddLabel adds the given label to the given pod.

func AddPodLabel

func AddPodLabel(name, project, namespace, key, value string) error

AddPodLabel adds a label to the XDC pod with the given name.

func GetPod added in v1.1.25

func GetPod(namespace, name, project string) (*v1.Pod, error)

GetPod returns the k8s Pod data gtiven a name and project.

func InitPodWatch

func InitPodWatch()

InitPodwatch is required to be called befora any podatch methods. Call in your client init().

func K8SClient

func K8SClient() *kubernetes.Clientset

func PodName

func PodName(pod *v1.Pod) (string, string, error)

PodName returns the Merge pod name,project for the pod is it is an XDC.

func RemoveLabel

func RemoveLabel(pod *v1.Pod, key string) error

RemoveLabel removes the given label from the given pod.

func RemovePodLabel

func RemovePodLabel(name, project, namespace, key string) error

RemovePodLabel - removes the label

Types

type MergePodState added in v1.1.25

type MergePodState int32

Subscribe to the states you want to get events for.

type MergePodType

type MergePodType int32

MergePodType describes all possible pod types that Merge will spawn.

const (
	// NOTMERGE is not a merge pod.
	NOTMERGE MergePodType = 0

	// XDC is an XDC
	XDC MergePodType = 1

	// JUMP is an ssh jump host
	JUMP MergePodType = 2
)

func PodType

func PodType(pod *v1.Pod) (MergePodType, error)

PodType is a utility function that takes a pod and returns its type.

type PodWatcher

type PodWatcher struct {
	// On* functcions get called when that event happens. The interface is a k8s core API *v1.Pod.
	OnPodAdd    func(pod *v1.Pod)
	OnPodDelete func(obj *v1.Pod)
	OnPodUpdate func(prevObj, newObj *v1.Pod)

	// The namespace in which to watch for events. (The XDC namespace.)
	Namespace string

	// Control callback events.
	Unfiltered bool // if true get all evernts.
}

PodWatcher encapsulates a client that gets pod events.

func (*PodWatcher) Watch

func (pw *PodWatcher) Watch()

Watch keeps track of pod events and sets up the configured callbacks. This method does not return.

Jump to

Keyboard shortcuts

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