kube

package
v1.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	IndexPodByContainerIDs = "idx_pod_by_container"
	IndexReplicaSetNames   = "idx_rs"
)
View Source
const (
	NamespaceName   = "k8s.namespace.name"
	PodName         = "k8s.pod.name"
	DeploymentName  = "k8s.deployment.name"
	ReplicaSetName  = "k8s.replicaset.name"
	DaemonSetName   = "k8s.daemonset.name"
	StatefulSetName = "k8s.statefulset.name"
	NodeName        = "k8s.node.name"
	PodUID          = "k8s.pod.uid"
	PodStartTime    = "k8s.pod.start_time"
)
View Source
const (
	OwnerUnknown = OwnerType(iota)
	OwnerReplicaSet
	OwnerDeployment
	OwnerStatefulSet
	OwnerDaemonSet
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(kubeConfigPath string) (*rest.Config, error)

Types

type ContainerEventHandler

type ContainerEventHandler interface {
	OnDeletion(containerID []string)
}

ContainerEventHandler listens for the deletion of containers, as triggered by a Pod deletion.

type Metadata

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

Metadata stores an in-memory copy of the different Kubernetes objects whose metadata is relevant to us.

func (*Metadata) AddContainerEventHandler

func (k *Metadata) AddContainerEventHandler(eh ContainerEventHandler)

func (*Metadata) AddPodEventHandler

func (k *Metadata) AddPodEventHandler(h cache.ResourceEventHandler) error

func (*Metadata) AddReplicaSetEventHandler

func (k *Metadata) AddReplicaSetEventHandler(h cache.ResourceEventHandler) error

func (*Metadata) FetchPodOwnerInfo

func (k *Metadata) FetchPodOwnerInfo(pod *PodInfo)

FetchPodOwnerInfo updates the pod owner with the Deployment information, if it exists. Pod Info might include a ReplicaSet as owner, and ReplicaSet info usually has a Deployment as owner reference, which is the one that we'd really like to report as owner.

func (*Metadata) GetContainerPod

func (k *Metadata) GetContainerPod(containerID string) (*PodInfo, bool)

GetContainerPod fetches metadata from a Pod given the name of one of its containers

func (*Metadata) GetReplicaSetInfo

func (k *Metadata) GetReplicaSetInfo(namespace, name string) (*ReplicaSetInfo, bool)

GetReplicaSetInfo fetches metadata from a ReplicaSet given its name

func (*Metadata) InitFromClient

func (k *Metadata) InitFromClient(ctx context.Context, client kubernetes.Interface, timeout time.Duration) error

type Owner added in v1.2.1

type Owner struct {
	Type OwnerType
	Name string
	// Owner of the owner. For example, a ReplicaSet might be owned by a Deployment
	Owner *Owner
}

func OwnerFromPodInfo added in v1.2.1

func OwnerFromPodInfo(pod *v1.Pod) *Owner

OwnerFromPodInfo returns the pod Owner reference. It might be null if the Pod does not have any owner

func (*Owner) String added in v1.2.1

func (o *Owner) String() string

type OwnerType added in v1.2.1

type OwnerType int

func (OwnerType) LabelName added in v1.2.1

func (o OwnerType) LabelName() string

type PodInfo

type PodInfo struct {
	// Informers need that internal object is an ObjectMeta instance
	metav1.ObjectMeta
	NodeName string

	Owner *Owner

	// StartTimeStr caches value of ObjectMeta.StartTimestamp.String()
	StartTimeStr string
	ContainerIDs []string
	IPs          []string
}

PodInfo contains precollected metadata for Pods, Nodes and Services. Not all the fields are populated for all the above types. To save memory, we just keep in memory the necessary data for each Type. For more information about which fields are set for each type, please refer to the instantiation function of the respective informers.

func (*PodInfo) ServiceName added in v1.5.0

func (i *PodInfo) ServiceName() string

type ReplicaSetInfo

type ReplicaSetInfo struct {
	metav1.ObjectMeta
	DeploymentName string
}

Jump to

Keyboard shortcuts

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