Documentation
¶
Overview ¶
In order to properly satisfy the topology interface, the kubernetes wrapper will monitor POD events (either starting, updating, or stopping) and match them with information from the underlying CRI (Container Runtime Interface) which is managed by the kubelet.
We utilize the CRI endpoints to fetch the current PID, and PID namespace associated with every container in a POD. When any POD event is seen, this code will automatically scan the CRI for containers that match these PODS.
Index ¶
- Variables
- type Docker
- type DockerOption
- type EventType
- type Kubernetes
- type KubernetesOption
- func WithKubernetesCRI(criSocket string) KubernetesOption
- func WithKubernetesConfig(kubeConfig string) KubernetesOption
- func WithKubernetesFieldSelector(f string) KubernetesOption
- func WithKubernetesLabelSelector(l string) KubernetesOption
- func WithKubernetesNamespace(namespace string) KubernetesOption
- func WithKubernetesProcRoot(path string) KubernetesOption
- type ObservationEvent
- type Observer
- type OnEventCallback
- type Topology
- func (t *Topology) Close() error
- func (t *Topology) Connect(ctx context.Context) error
- func (t *Topology) Containers(ctx context.Context) ([]*types.Container, error)
- func (t *Topology) LookupContainer(ctx context.Context, pidns int) (*types.Container, error)
- func (t *Topology) Run(ctx context.Context, cb OnEventCallback)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type DockerOption ¶
type Kubernetes ¶
type Kubernetes struct {
// contains filtered or unexported fields
}
Kubernetes contains all the working parts to facilitate a Observer for kubernetes operation.
func NewKubernetes ¶
func NewKubernetes(opts ...KubernetesOption) (*Kubernetes, error)
NewKubernetes creates a Observer object for watching kubernetes changes
func (*Kubernetes) Close ¶
func (k *Kubernetes) Close() error
Close frees up all the running resources of this Kubernetes observer
func (*Kubernetes) Connect ¶
func (k *Kubernetes) Connect(ctx context.Context) error
Connect will do all the things to create client connects to both the kubernetes api, and the CRI grpc endpoint.
func (*Kubernetes) Containers ¶
Containers returns an array of running containers inside kubernetes.
func (*Kubernetes) Run ¶
func (k *Kubernetes) Run(ctx context.Context, out chan<- *ObservationEvent)
Run connects to kube and watches for POD changes. When changes are seen, attempt to match the changes with the underlying CRI containers (to find the running PID of the container, and the underlying PID namespace).
type KubernetesOption ¶
type KubernetesOption func(*Kubernetes) error
func WithKubernetesCRI ¶
func WithKubernetesCRI(criSocket string) KubernetesOption
WithKubernetesCRI sets the cri file configuration option
func WithKubernetesConfig ¶
func WithKubernetesConfig(kubeConfig string) KubernetesOption
WithKubernetesConfig sets the path to the kube configuration file
func WithKubernetesFieldSelector ¶
func WithKubernetesFieldSelector(f string) KubernetesOption
WithKubernetesFieldSelector sets the fieldselector match configuration option
func WithKubernetesLabelSelector ¶
func WithKubernetesLabelSelector(l string) KubernetesOption
WithKubernetesLabelSelector sets the labelselector match configuration option
func WithKubernetesNamespace ¶
func WithKubernetesNamespace(namespace string) KubernetesOption
WithKubernetesNamespace sets the namespace configuration option
func WithKubernetesProcRoot ¶
func WithKubernetesProcRoot(path string) KubernetesOption
WithKubernetesProcRoot sets the root-directory to the "/proc" directory