pods

package
v0.0.0-...-a3c466b Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: GPL-2.0, GPL-2.0-or-later Imports: 16 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: GPL-2.0-or-later

  • Copyright (C) 2022 VMware, Inc. Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> *
  • Internal in-memory database with all pods and containers running on the local node.

SPDX-License-Identifier: GPL-2.0-or-later

  • Copyright (C) 2022 VMware, Inc. Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> *
  • Discover containers running on the local node, using CRI interface.

SPDX-License-Identifier: GPL-2.0-or-later

  • Copyright (C) 2022 VMware, Inc. Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> *
  • Discover containers running on the local node, using information from the /proc file system.
  • This logic was originally implemented in python by Yordan Karadzhov <y.karadz@gmail.com> *
  • Using /proc file system has limitations in Kubernetes context. I couldn't find reliable way to get
  • Pod -> Containers relation, so the logic considers that all tasks inside a Pod are part of a single
  • container with name "unknown".

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvCri      = "TRACER_CRI_ENDPOINT"
	EnvRunPaths = "TRACER_RUN_PATHS"
	EnvPodName  = "TRACER_POD_NAME"
)
View Source
var (
	EnvForceProcfs = "TRACER_FORCE_PROCFS"
)

Functions

This section is empty.

Types

type Container

type Container struct {
	Id, Pod *string
	Parent  []int
	Tasks   []int `json:"Tasks"`
}

type CriConfig

type CriConfig struct {
	Endpoint *string  /* CRI endpoint. */
	RunPaths []string /* Paths to run directories. */
	PodName  *string  /* Name of the tracer pod */
}

type PodConfig

type PodConfig struct {
	Cri       CriConfig
	ForceProc *bool /* Force using procfs for containers discovery, even if CRI is available. */
}

type PodDb

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

func NewPodDb

func NewPodDb(ctx context.Context, cfg *PodConfig, procfsPath *string) (*PodDb, error)

func (*PodDb) Count

func (p *PodDb) Count() int

func (*PodDb) Get

func (p *PodDb) Get() *map[string]*pod

func (*PodDb) GetContainers

func (p *PodDb) GetContainers(podName, containerName *string) []*Container

func (*PodDb) Print

func (p *PodDb) Print()

func (*PodDb) Scan

func (p *PodDb) Scan() error

Jump to

Keyboard shortcuts

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