Documentation
¶
Index ¶
- Constants
- func ContainerIDKey(contID string) (string, error)
- func ContainerIndexFunc(obj interface{}) ([]string, error)
- func FindContainer(containerID string, podInformer cache.SharedIndexInformer, ...) (*corev1.Pod, *corev1.ContainerStatus, bool)
- func FindMirrorPod(hash string, podInformer cache.SharedIndexInformer) (*corev1.Pod, error)
- func FindPod(podID string, podInformer cache.SharedIndexInformer) (*corev1.Pod, error)
- func PodIndexFunc(obj interface{}) ([]string, error)
- type DeletedPodCache
- type FakeK8sWatcher
- func (watcher *FakeK8sWatcher) AddPod(pod *corev1.Pod)
- func (watcher *FakeK8sWatcher) AddService(service *corev1.Service)
- func (watcher *FakeK8sWatcher) ClearAllPods()
- func (watcher *FakeK8sWatcher) ClearAllServices()
- func (watcher *FakeK8sWatcher) FindContainer(containerID string) (*corev1.Pod, *corev1.ContainerStatus, bool)
- func (watcher *FakeK8sWatcher) FindMirrorPod(_ string) (*corev1.Pod, error)
- func (watcher *FakeK8sWatcher) FindPod(podID string) (*corev1.Pod, error)
- type PodAccessor
Constants ¶
const ( ContainerIdx = "containers-ids" PodIdx = "pod-ids" )
Variables ¶
This section is empty.
Functions ¶
func ContainerIDKey ¶ added in v1.5.0
func ContainerIndexFunc ¶ added in v1.5.0
ContainerIndexFunc index pod by container IDs.
func FindContainer ¶ added in v1.5.0
func FindContainer(containerID string, podInformer cache.SharedIndexInformer, deletedPodCache *DeletedPodCache) (*corev1.Pod, *corev1.ContainerStatus, bool)
func FindMirrorPod ¶ added in v1.5.0
func PodIndexFunc ¶ added in v1.5.0
Types ¶
type DeletedPodCache ¶ added in v1.5.0
func NewDeletedPodCache ¶ added in v1.5.0
func NewDeletedPodCache() (*DeletedPodCache, error)
func (*DeletedPodCache) EventHandler ¶ added in v1.5.0
func (c *DeletedPodCache) EventHandler() cache.ResourceEventHandler
func (*DeletedPodCache) FindContainer ¶ added in v1.5.0
func (c *DeletedPodCache) FindContainer(containerID string) (*corev1.Pod, *corev1.ContainerStatus, bool)
type FakeK8sWatcher ¶
type FakeK8sWatcher struct {
// contains filtered or unexported fields
}
FakeK8sWatcher is used as an "empty" PodAccessor when --enable-k8s-api flag is not set. It is also used for testing, allowing users to specify a static list of pods.
func NewFakeK8sWatcher ¶
func NewFakeK8sWatcher(pods []interface{}) *FakeK8sWatcher
NewFakeK8sWatcher returns a pointer to an initialized FakeK8sWatcher struct.
func NewFakeK8sWatcherWithPodsAndServices ¶ added in v0.11.0
func NewFakeK8sWatcherWithPodsAndServices(pods []interface{}, services []interface{}) *FakeK8sWatcher
NewFakeK8sWatcherWithPodsAndServices returns a pointer to an initialized FakeK8sWatcher struct
func (*FakeK8sWatcher) AddPod ¶ added in v0.9.0
func (watcher *FakeK8sWatcher) AddPod(pod *corev1.Pod)
AddPod adds a pod to the fake k8s watcher. This is intended for testing.
func (*FakeK8sWatcher) AddService ¶ added in v0.11.0
func (watcher *FakeK8sWatcher) AddService(service *corev1.Service)
AddService adds a service to the fake k8s watcher.
func (*FakeK8sWatcher) ClearAllPods ¶ added in v0.9.0
func (watcher *FakeK8sWatcher) ClearAllPods()
ClearPods() removes all pods from the fake watcher. This is intended for testing.
func (*FakeK8sWatcher) ClearAllServices ¶ added in v0.11.0
func (watcher *FakeK8sWatcher) ClearAllServices()
ClearAllServices removes all services from the fake watcher.
func (*FakeK8sWatcher) FindContainer ¶ added in v0.9.0
func (watcher *FakeK8sWatcher) FindContainer(containerID string) (*corev1.Pod, *corev1.ContainerStatus, bool)
FindContainer implements PodAccessor.FindContainer
func (*FakeK8sWatcher) FindMirrorPod ¶ added in v1.2.0
func (watcher *FakeK8sWatcher) FindMirrorPod(_ string) (*corev1.Pod, error)
type PodAccessor ¶ added in v1.4.0
type PodAccessor interface {
// Find a pod/container pair for the given container ID.
FindContainer(containerID string) (*corev1.Pod, *corev1.ContainerStatus, bool)
// Find a pod given the podID
FindPod(podID string) (*corev1.Pod, error)
// Find a mirror pod for a static pod
FindMirrorPod(hash string) (*corev1.Pod, error)
}
PodAccessor defines an interface for accessing pods from Kubernetes API.