scanner

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IdentifyEntity

func IdentifyEntity(target string, parent uuid.UUID) (uuid.UUID, error)

func PacketApplications

func PacketApplications(applications []*Application) proto.PacketApplicationsStoreRequest

func PacketNodes

func PacketNodes(nodes []kuber.Node) proto.PacketNodesStoreRequest

Types

type Application

type Application struct {
	Entity

	Services    []*Service
	LimitRanges []kv1.LimitRange
}

Application an abstraction layer representing a namespace

type Container

type Container struct {
	Entity

	Image     string
	Resources *proto.ContainerResourceRequirements `json:"resources"`

	LivenessProbe  *kv1.Probe
	ReadinessProbe *kv1.Probe
}

Container represents a single container controlled by a service if the container belongs to a pod with no controller, an orphand pod service automatically gets created as a parent

type Entity

type Entity struct {
	ID   uuid.UUID
	Name string
	Kind string

	Annotations map[string]string
}

Entity basic entity structure can be an application, a service or a container

func (*Entity) Identify

func (entity *Entity) Identify(parent uuid.UUID) error

IdentifyEntity sets the id of an entity

type History

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

History cluster history

func NewHistory

func NewHistory() History

NewHistory creates new cluster history

func (*History) FindContainer

func (history *History) FindContainer(
	namespace string,
	podName string,
	containerName string,
) (applicationID, serviceID uuid.UUID, container *Container, found bool)

FindContainer find container by names

func (*History) FindService

func (history *History) FindService(
	namespace string,
	podName string,
) (applicationID, serviceID uuid.UUID, found bool)

FindService find service by names

func (*History) PopulateContainer

func (history *History) PopulateContainer(
	namespace string,
	podName string,
	containerName string,
	applicationID uuid.UUID,
	serviceID uuid.UUID,
	container *Container,
)

PopulateContainer populate history by a container

func (*History) PopulateService

func (history *History) PopulateService(
	namespace string,
	podName string,
	applicationID uuid.UUID,
	serviceID uuid.UUID,
)

PopulateService populate history by a service

type HistoryNamespace

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

HistoryNamespace namespace history

type HistoryPod

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

HistoryPod pod history

type Scanner

type Scanner struct {
	*utils.Ticker
	// contains filtered or unexported fields
}

Scanner cluster scanner

func InitScanner

func InitScanner(
	client *client.Client,
	kube *kuber.Kube,
	skipNamespaces []string,
	accountID uuid.UUID,
	clusterID uuid.UUID,
	optInAnalysisData bool,
	analysisDataInterval time.Duration,
) *Scanner

InitScanner creates a new scanner then Start it

func (*Scanner) AppsLastScanTime

func (scanner *Scanner) AppsLastScanTime() time.Time

func (*Scanner) FindContainer

func (scanner *Scanner) FindContainer(
	namespace string,
	podName string,
	containerName string,
) (uuid.UUID, uuid.UUID, *Container, bool)

FindContainer returns app, service id and container from pod namespace, name and container name

func (*Scanner) FindContainerByID

func (scanner *Scanner) FindContainerByID(
	apps []*Application,
	containerID uuid.UUID,
) (c *Container, s *Service, a *Application, found bool)

FindContainerByID returns container, service and application from container id

func (*Scanner) FindContainerByPodUIDContainerName

func (scanner *Scanner) FindContainerByPodUIDContainerName(
	podUID string,
	containerName string,
) (
	applicationID uuid.UUID,
	serviceID uuid.UUID,
	containerID uuid.UUID,
	podName string,
	ok bool,
)

FindContainerByPodUIDContainerName find application, service, container id and pod name from kubernets pod id and container name

func (*Scanner) FindContainerNameByID

func (scanner *Scanner) FindContainerNameByID(
	apps []*Application,
	containerID uuid.UUID,
) (name string, found bool)

FindContainerNameByID returns container name from container id

func (*Scanner) FindContainerWithParents

func (scanner *Scanner) FindContainerWithParents(
	namespace string,
	podName string,
	containerName string,
) (c *Container, s *Service, a *Application, found bool)

FindContainerByID returns container, service and application from container name

func (*Scanner) FindService

func (scanner *Scanner) FindService(
	namespace string,
	podName string,
) (uuid.UUID, uuid.UUID, bool)

FindService find app and service id from pod name and namespace

func (*Scanner) FindServiceByID

func (scanner *Scanner) FindServiceByID(
	apps []*Application,
	serviceID uuid.UUID,
) (namespace, name, kind string, found bool)

FindServiceByID returns namespace, name and kind of a service by service id

func (*Scanner) GetApplications

func (scanner *Scanner) GetApplications() []*Application

GetApplications get scanned applications

func (*Scanner) GetNodes

func (scanner *Scanner) GetNodes() []kuber.Node

GetNodes get scanned nodes

func (*Scanner) GetPods

func (scanner *Scanner) GetPods() []kv1.Pod

GetPods get scanned pods

func (*Scanner) NodesLastScanTime

func (scanner *Scanner) NodesLastScanTime() time.Time

func (*Scanner) SendAnalysisData

func (scanner *Scanner) SendAnalysisData(data map[string]interface{})

SendAnalysisData sends analysis data if the user opts in

func (*Scanner) SendApplications

func (scanner *Scanner) SendApplications(applications []*Application)

SendApplications sends scanned applications

func (*Scanner) SendNodes

func (scanner *Scanner) SendNodes(nodes []kuber.Node)

SendNodes sends scanned nodes

type Service

type Service struct {
	Entity

	PodRegexp      *regexp.Regexp
	ReplicasStatus proto.ReplicasStatus

	Containers []*Container
}

Service an abstraction layer representing a service it can be a deployment, replicaset, statefulset, daemonset, job, cronjob or an orphan pod

Jump to

Keyboard shortcuts

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