state

package
v0.0.0-...-b80f625 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

package state implements the state agent service which reports details about the node and containers being protected by KubeArmor

Index

Constants

View Source
const (

	// EventAdded denotes an add event
	EventAdded = "added"
	// EventUpdated denotes an update event
	EventUpdated = "updated"
	// EventDeleted denotes an delete event
	EventDeleted = "deleted"

	// KindContainer denotes a container kind
	KindContainer = "container"
	// KindPod denotes a pod kind
	KindPod = "pod"
	// KindNode denotes a node kind
	KindNode = "node"
	// KindNamespace denotes a namespace kind
	KindNamespace = "namespace"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type StateAgent

type StateAgent struct {
	Running bool

	StateEventChans     map[string]chan *pb.StateEvent
	StateEventChansLock *sync.RWMutex

	Node     *tp.Node
	NodeLock *sync.RWMutex

	Containers     map[string]tp.Container
	ContainersLock *sync.RWMutex

	KubeArmorNamespaces     map[string]types.Namespace
	KubeArmorNamespacesLock *sync.RWMutex
}

StateAgent reports the state of containers/nodes protected by KubeArmor

func NewStateAgent

func NewStateAgent(node *tp.Node, nodeLock *sync.RWMutex, containers map[string]tp.Container, containersLock *sync.RWMutex) *StateAgent

NewStateAgent returns a new initialized state agent

func (*StateAgent) DestroyStateAgent

func (sa *StateAgent) DestroyStateAgent() error

DestroyStateAgent destroys the referenced state agent

func (*StateAgent) GetState

func (sa *StateAgent) GetState(msg *emptypb.Empty, srv pb.StateAgent_GetStateServer) error

GetState sends current state upon request

func (*StateAgent) PushContainerEvent

func (sa *StateAgent) PushContainerEvent(container tp.Container, event string)

PushContainerEvent function pushes (container + pod) event

func (*StateAgent) PushNamespaceEvent

func (sa *StateAgent) PushNamespaceEvent(namespace tp.Namespace, event string)

PushNamespaceEvent function pushes namespace event

func (*StateAgent) PushNodeEvent

func (sa *StateAgent) PushNodeEvent(node tp.Node, event string)

PushNodeEvent function pushes node event

func (*StateAgent) WatchState

func (sa *StateAgent) WatchState(msg *emptypb.Empty, srv pb.StateAgent_WatchStateServer) error

WatchState sends state events in a continuous stream

Jump to

Keyboard shortcuts

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