metas

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodCreateSLO = "pod_create_slo"
	PodDeleteSLO = "pod_delete_slo"
)

Variables

View Source
var DeliveryWatchers *utils.SafeMap = utils.NewSafeMap()
View Source
var NoPriority string = ""

Functions

func GeneratePodFromEvent

func GeneratePodFromEvent(event *audit.Event) (*corev1.Pod, error)

GeneratePodFromEvent generate pod info from event. first pars from responseObject and then requestObject and last from event.objectRef

func GetJobPodFinishedTime

func GetJobPodFinishedTime(pod *corev1.Pod) time.Time

GetJobPodFinishedTime use the max container terminated time as job finish time

func GetJsonFromRuntimeUnknown

func GetJsonFromRuntimeUnknown(un *runtime.Unknown) map[string]interface{}

func GetObjectFromRuntimeUnknown

func GetObjectFromRuntimeUnknown(un *runtime.Unknown, gvk *schema.GroupVersionKind) runtime.Object

func GetOwnerType

func GetOwnerType(pod *corev1.Pod) string

func GetPodReadyTime

func GetPodReadyTime(pod *corev1.Pod) time.Time

func GetPodSLOByDeliveryPath

func GetPodSLOByDeliveryPath(pod *v1.Pod) (time.Duration, bool)

func GetPriority

func GetPriority(pod *v1.Pod) string

func GetPubLister

func GetPubLister(name string) *pubsub.PubSub

func IsDeleteImmediately

func IsDeleteImmediately(pod *corev1.Pod) bool

func IsImageChanged

func IsImageChanged(oldPod, newPod *corev1.Pod) bool

IsImageChanged identify an upgrade event

func IsJobPod

func IsJobPod(pod *corev1.Pod) bool

func IsJobPodFailed

func IsJobPodFailed(pod *corev1.Pod) bool

func IsJobPodFinished

func IsJobPodFinished(pod *corev1.Pod) bool

func IsJobPodRunning

func IsJobPodRunning(pod *corev1.Pod) bool

func IsJobPodSucceeded

func IsJobPodSucceeded(pod *corev1.Pod) bool

func IsPodFinishedNormally

func IsPodFinishedNormally(pod *corev1.Pod) bool

IsPodFinishedNormally judge if a pod is in a `finished` state. For a job pod, the pod should be Failed/Succeed/Running For a non-job pod, the pod should be Ready

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

func IsPodScheduled

func IsPodScheduled(pod *corev1.Pod) bool

func IsPodSchedulingFailed

func IsPodSchedulingFailed(pod *corev1.Pod) bool

func IsSidecarContainer

func IsSidecarContainer(container *corev1.Container) bool

func IsSpecChanged

func IsSpecChanged(oldPod, newPod *corev1.Pod) bool

IsSpecChanged identify an update event

func IsTypicalPodNew

func IsTypicalPodNew(pod *v1.Pod) string

< 3 container, <= 8C16G, no user readiness-gate, no FlexVolume

func MicroTime2Time

func MicroTime2Time(t metav1.MicroTime) time.Time

func PodDiff

func PodDiff(oldPod, newPod *corev1.Pod, diffFunc func(oldContainer, newContainer corev1.Container) bool) bool

func PodKey

func PodKey(pod *corev1.Pod) string

PodKey return a pod name with namespace

func PodKeyForEvent

func PodKeyForEvent(event *k8s_audit.Event) string

PodKeyForEvent return a pod name with namespace

func RegisterPublisher

func RegisterPublisher(name string)

func UnsafeGuessResourceToKind

func UnsafeGuessResourceToKind(resource string) []string

func WaitForAPIServer

func WaitForAPIServer(client clientset.Interface, timeout time.Duration) error

WaitForAPIServer waits for the API Server's /healthz endpoint to report "ok" with timeout.

Types

type PodPatch

type PodPatch struct {
	Status corev1.PodStatus `json:"status,omitempty"`
}

func GetPodPatch

func GetPodPatch(oldPod, newPod *corev1.Pod) ([]byte, *PodPatch, error)

type SloSpec

type SloSpec map[string]*SloSpecItem

func FetchSloSpec

func FetchSloSpec(obj runtime.Object) SloSpec

type SloSpecItem

type SloSpecItem struct {
	SloTime string
}

type Unknown

type Unknown struct {
	runtime.TypeMeta `json:",inline" protobuf:"bytes,1,opt,name=typeMeta"`
}

type WatchSubscriber

type WatchSubscriber struct {
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(name string, w http.ResponseWriter, r *http.Request) *WatchSubscriber

func (*WatchSubscriber) ErrorChan

func (c *WatchSubscriber) ErrorChan() chan error

func (*WatchSubscriber) OnMessage

func (c *WatchSubscriber) OnMessage(v interface{})

func (*WatchSubscriber) Stop

func (c *WatchSubscriber) Stop()

func (*WatchSubscriber) SubscriberName

func (c *WatchSubscriber) SubscriberName() string

Jump to

Keyboard shortcuts

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