pod

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 20 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextKey added in v0.2.0

type ContextKey string
const (
	BypassCacheKey  ContextKey = "bypass_cache"
	BypassCacheTrue ContextKey = "true"
)

type KubeletPodFetcher

type KubeletPodFetcher interface {
	// GetPodList returns those latest pods, and podFilter is a function to filter a pod,
	// if pod passed return true else return false, if podFilter is nil return all pods
	GetPodList(ctx context.Context, podFilter func(*v1.Pod) bool) ([]*v1.Pod, error)
}

KubeletPodFetcher is used to get K8S kubelet pod information.

func NewKubeletPodFetcher

func NewKubeletPodFetcher() KubeletPodFetcher

type PodFetcher

type PodFetcher interface {
	KubeletPodFetcher

	// Run starts the preparing logic to collect pod metadata.
	Run(ctx context.Context)

	// GetContainerID & GetContainerSpec are used to parse running container info
	GetContainerID(podUID, containerName string) (string, error)
	GetContainerSpec(podUID, containerName string) (*v1.Container, error)
	// GetPod returns Pod by UID
	GetPod(ctx context.Context, podUID string) (*v1.Pod, error)
}

func NewPodFetcher

func NewPodFetcher(conf *config.Configuration, emitter metrics.MetricEmitter) (PodFetcher, error)

type PodFetcherStub

type PodFetcherStub struct {
	PodList []*v1.Pod
	// contains filtered or unexported fields
}

func (*PodFetcherStub) GetContainerID

func (p *PodFetcherStub) GetContainerID(podUID, containerName string) (string, error)

func (*PodFetcherStub) GetContainerSpec

func (p *PodFetcherStub) GetContainerSpec(podUID, containerName string) (*v1.Container, error)

func (*PodFetcherStub) GetPod added in v0.2.0

func (p *PodFetcherStub) GetPod(_ context.Context, podUID string) (*v1.Pod, error)

func (*PodFetcherStub) GetPodList

func (p *PodFetcherStub) GetPodList(_ context.Context, podFilter func(*v1.Pod) bool) ([]*v1.Pod, error)

func (*PodFetcherStub) Run

func (p *PodFetcherStub) Run(_ context.Context)

type RuntimePod

type RuntimePod struct {
	// The UID of the pod, which can be used to retrieve a particular pod
	// from the pod list returned by GetPods().
	UID kubetypes.UID
	// The name and namespace of the pod, which is readable by human.
	Name      string
	Namespace string
	// List of containers that belongs to this pod. It may contain only
	// running containers, or mixed with dead ones (when GetPods(true)).
	Containers []*runtimeapi.Container
	// List of sandboxes associated with this pod. This is only populated
	// by kuberuntime.
	Sandboxes []*runtimeapi.PodSandbox
}

RuntimePod is a group of containers.

type RuntimePodFetcher

type RuntimePodFetcher interface {
	GetPods(all bool) ([]*RuntimePod, error)
}

func NewRuntimePodFetcher

func NewRuntimePodFetcher(conf *config.Configuration) (RuntimePodFetcher, error)

Jump to

Keyboard shortcuts

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