kubernetes

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessBuildersInit

func ProcessBuildersInit(builders []*ProcessBuilder) error

ProcessBuildersInit used to init process builders

Types

type Config

type Config struct {
	base.FinderBaseConfig

	Active bool `mapstrcture:"active"`

	NodeName   string            `mapstructure:"node_name"`
	Namespaces string            `mapstructure:"namespaces"`
	Analyzers  []*ProcessBuilder `mapstructure:"analyzers"`
}

func (*Config) ActiveFinder

func (c *Config) ActiveFinder() bool

type EntityRenderContext

type EntityRenderContext struct {
	Rover     *base.TemplateRover
	Process   *base.TemplateProcess
	Pod       *TemplatePod
	Container *TemplateContainer
}

type FilterContext

type FilterContext struct {
	Process   *base.TemplateProcess
	Pod       *TemplatePodJudgment
	Container *TemplateContainer
}

type MeshConfig

type MeshConfig struct {
	ServiceName string `mapstructure:"service_name"`
}

type PodContainer

type PodContainer struct {
	// pod references
	Pod             *v1.Pod
	ContainerSpec   v1.Container
	ContainerStatus v1.ContainerStatus
	// contains filtered or unexported fields
}

func AnalyzeContainers

func AnalyzeContainers(pod *v1.Pod, registry *Registry) []*PodContainer

AnalyzeContainers means query the containers by pod

func (*PodContainer) CGroupID

func (c *PodContainer) CGroupID() string

func (*PodContainer) FindContainerFromSamePod added in v0.4.0

func (c *PodContainer) FindContainerFromSamePod(name string) *PodContainer

func (*PodContainer) FindOwner

func (c *PodContainer) FindOwner(ctx context.Context, kindName string, k8sConfig *rest.Config) (*metav1.OwnerReference, error)

FindOwner means query the owner in the container, it would loop up with parent owner until empty

func (*PodContainer) ServiceName

func (c *PodContainer) ServiceName() string

type Process

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

func NewProcess

func NewProcess(p *process.Process, cmdline string, pc *PodContainer, entity *api.ProcessEntity) *Process

func (*Process) DetectType

func (p *Process) DetectType() api.ProcessDetectType

func (*Process) Entity

func (p *Process) Entity() *api.ProcessEntity

func (*Process) ExposeHosts added in v0.6.0

func (p *Process) ExposeHosts() []string

func (*Process) ExposePorts added in v0.3.0

func (p *Process) ExposePorts() []int

func (*Process) OriginalProcess

func (p *Process) OriginalProcess() *process.Process

func (*Process) Pid

func (p *Process) Pid() int32

func (*Process) PodContainer added in v0.6.0

func (p *Process) PodContainer() *PodContainer

func (*Process) ProfilingStat

func (p *Process) ProfilingStat() *profiling.Info

type ProcessBuilder

type ProcessBuilder struct {
	Active       bool     `mapstructure:"active"`
	Filters      []string `mapstructure:"filters"`
	Layer        string   `mapstructure:"layer"`
	ServiceName  string   `mapstructure:"service_name"`
	InstanceName string   `mapstructure:"instance_name"`
	ProcessName  string   `mapstructure:"process_name"`
	LabelsStr    string   `mapstructure:"labels"`

	// runtime
	FiltersBuilder      []*base.TemplateBuilder
	ServiceNameBuilder  *base.TemplateBuilder
	InstanceNameBuilder *base.TemplateBuilder
	ProcessNameBuilder  *base.TemplateBuilder
	Labels              []string
}

type ProcessFinder

type ProcessFinder struct {
	CLI *kubernetes.Clientset
	// contains filtered or unexported fields
}

func (*ProcessFinder) BuildEBPFProcess

func (*ProcessFinder) BuildNecessaryProperties

func (f *ProcessFinder) BuildNecessaryProperties(ps api.DetectedProcess) []*commonv3.KeyStringValuePair

func (*ProcessFinder) DetectType

func (f *ProcessFinder) DetectType() api.ProcessDetectType

func (*ProcessFinder) Init

func (*ProcessFinder) ParseProcessID

func (f *ProcessFinder) ParseProcessID(ps api.DetectedProcess, downstream *v3.EBPFProcessDownstream) string

func (*ProcessFinder) ShouldMonitor added in v0.6.0

func (f *ProcessFinder) ShouldMonitor(pid int32) bool

func (*ProcessFinder) Start

func (f *ProcessFinder) Start()

func (*ProcessFinder) Stop

func (f *ProcessFinder) Stop() error

func (*ProcessFinder) ValidateProcessIsSame

func (f *ProcessFinder) ValidateProcessIsSame(p1, p2 api.DetectedProcess) bool

type Registry

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

func NewRegistry

func NewRegistry(cli *kubernetes.Clientset, namespaces []string, nodeName string) *Registry

func (*Registry) BuildPodContainers

func (r *Registry) BuildPodContainers() map[string]*PodContainer

func (*Registry) FindServiceName

func (r *Registry) FindServiceName(namespace, podName string) string

func (*Registry) OnAdd

func (r *Registry) OnAdd(_ interface{})

func (*Registry) OnDelete

func (r *Registry) OnDelete(_ interface{})

func (*Registry) OnUpdate

func (r *Registry) OnUpdate(_, _ interface{})

func (*Registry) Start

func (r *Registry) Start(stopChan chan struct{})

type TemplateContainer

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

func (*TemplateContainer) EnvValue added in v0.4.0

func (c *TemplateContainer) EnvValue(names string) (string, error)

func (*TemplateContainer) ID

func (c *TemplateContainer) ID() string

func (*TemplateContainer) Name

func (c *TemplateContainer) Name() string

type TemplatePod

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

func (*TemplatePod) FindContainer added in v0.4.0

func (p *TemplatePod) FindContainer(name string) (*TemplateContainer, error)

func (*TemplatePod) LabelValue

func (p *TemplatePod) LabelValue(names, def string) (string, error)

func (*TemplatePod) Name

func (p *TemplatePod) Name() string

func (*TemplatePod) Namespace

func (p *TemplatePod) Namespace() string

func (*TemplatePod) Node

func (p *TemplatePod) Node() string

func (*TemplatePod) OwnerName

func (p *TemplatePod) OwnerName(kindNames string) (string, error)

func (*TemplatePod) ServiceName

func (p *TemplatePod) ServiceName() string

type TemplatePodJudgment

type TemplatePodJudgment struct {
	*TemplatePod
}

func (*TemplatePodJudgment) HasContainer

func (t *TemplatePodJudgment) HasContainer(name string) bool

func (*TemplatePodJudgment) HasOwnerName added in v0.6.0

func (t *TemplatePodJudgment) HasOwnerName(names string) bool

func (*TemplatePodJudgment) HasServiceName

func (t *TemplatePodJudgment) HasServiceName() bool

func (*TemplatePodJudgment) LabelSelector

func (t *TemplatePodJudgment) LabelSelector(selector string) (bool, error)

Jump to

Keyboard shortcuts

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