kubernetes

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 26 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) 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) OriginalProcess

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

func (*Process) Pid

func (p *Process) Pid() int32

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 {
	// contains filtered or unexported fields
}

func (*ProcessFinder) BuildEBPFProcess

func (*ProcessFinder) BuildNecessaryProperties

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

func (*ProcessFinder) DetectType

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

func (*ProcessFinder) Init

func (*ProcessFinder) ParseProcessID

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

func (*ProcessFinder) Start

func (f *ProcessFinder) Start()

func (*ProcessFinder) Stop

func (f *ProcessFinder) Stop() error

func (*ProcessFinder) ValidateProcessIsSame

func (f *ProcessFinder) ValidateProcessIsSame(p1, p2 base.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) 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) LabelValue

func (p *TemplatePod) LabelValue(names 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) 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