Documentation ¶
Index ¶
- 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) FindPod(podID string) (*corev1.Pod, error)
- func (watcher *FakeK8sWatcher) FindPodInfoByIP(ip string) ([]*v1alpha1.PodInfo, error)
- func (watcher *FakeK8sWatcher) FindServiceByIP(ip string) ([]*corev1.Service, error)
- type K8sResourceWatcher
- type K8sWatcher
- func (watcher *K8sWatcher) FindContainer(containerID string) (*corev1.Pod, *corev1.ContainerStatus, bool)
- func (watcher *K8sWatcher) FindPod(podID string) (*corev1.Pod, error)
- func (watcher *K8sWatcher) FindPodInfoByIP(ip string) ([]*v1alpha1.PodInfo, error)
- func (watcher *K8sWatcher) FindServiceByIP(ip string) ([]*corev1.Service, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeK8sWatcher ¶
type FakeK8sWatcher struct {
// contains filtered or unexported fields
}
FakeK8sWatcher is used as an "empty" K8sResourceWatcher 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
NewK8sWatcher 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 K8sResourceWatcher.FindContainer
func (*FakeK8sWatcher) FindPod ¶
func (watcher *FakeK8sWatcher) FindPod(podID string) (*corev1.Pod, error)
func (*FakeK8sWatcher) FindPodInfoByIP ¶ added in v1.0.0
func (watcher *FakeK8sWatcher) FindPodInfoByIP(ip string) ([]*v1alpha1.PodInfo, error)
func (*FakeK8sWatcher) FindServiceByIP ¶ added in v0.11.0
func (watcher *FakeK8sWatcher) FindServiceByIP(ip string) ([]*corev1.Service, error)
type K8sResourceWatcher ¶
type K8sResourceWatcher 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) // FindServiceByIP finds a service given the IP address. FindServiceByIP(ip string) ([]*corev1.Service, error) // FindPodInfoByIP finds a service given the IP address. FindPodInfoByIP(ip string) ([]*v1alpha1.PodInfo, error) }
K8sResourceWatcher defines an interface for accessing various resources from Kubernetes API.
type K8sWatcher ¶
type K8sWatcher struct {
// contains filtered or unexported fields
}
K8sWatcher maintains a local cache of k8s resources.
func NewK8sWatcher ¶
func NewK8sWatcher(k8sClient kubernetes.Interface, stateSyncIntervalSec time.Duration) *K8sWatcher
NewK8sWatcher returns a pointer to an initialized K8sWatcher struct.
func NewK8sWatcherWithTetragonClient ¶ added in v1.0.0
func NewK8sWatcherWithTetragonClient(k8sClient kubernetes.Interface, tetragonClient versioned.Interface, stateSyncIntervalSec time.Duration) *K8sWatcher
NewK8sWatcherWithTetragonClient returns a pointer to an initialized K8sWatcher struct.
func (*K8sWatcher) FindContainer ¶ added in v0.9.0
func (watcher *K8sWatcher) FindContainer(containerID string) (*corev1.Pod, *corev1.ContainerStatus, bool)
FindContainer implements K8sResourceWatcher.FindContainer.
func (*K8sWatcher) FindPodInfoByIP ¶ added in v1.0.0
func (watcher *K8sWatcher) FindPodInfoByIP(ip string) ([]*v1alpha1.PodInfo, error)
func (*K8sWatcher) FindServiceByIP ¶ added in v0.11.0
func (watcher *K8sWatcher) FindServiceByIP(ip string) ([]*corev1.Service, error)