types

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 4 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventString

func EventString(i interface{}) string

func Init

func Init(nodeName string)

func MustAddVirtualL3EndpointColumn added in v0.18.0

func MustAddVirtualL3EndpointColumn[Event any](
	cols *columns.Columns[Event],
	attr columns.Attributes,
	getEndpoint func(*Event) L3Endpoint,
)

func MustAddVirtualL4EndpointColumn added in v0.18.0

func MustAddVirtualL4EndpointColumn[Event any](
	cols *columns.Columns[Event],
	attr columns.Attributes,
	getEndpoint func(*Event) L4Endpoint,
)

Types

type CommonData

type CommonData struct {
	// Node where the event comes from
	Node string `json:"node,omitempty" column:"node,template:node" columnTags:"kubernetes"`

	// Pod namespace where the event comes from, or empty for host-level
	// event
	Namespace string `json:"namespace,omitempty" column:"namespace,template:namespace" columnTags:"kubernetes"`

	// Pod where the event comes from, or empty for host-level event
	Pod string `json:"pod,omitempty" column:"pod,template:pod" columnTags:"kubernetes"`

	// Container where the event comes from, or empty for host-level or
	// pod-level event
	Container string `json:"container,omitempty" column:"container,template:container" columnTags:"kubernetes,runtime"`

	// HostNetwork is true if the container uses the host network namespace
	HostNetwork bool `json:"hostNetwork,omitempty" column:"hostnetwork,hide"`
}

func (*CommonData) GetContainer added in v0.15.0

func (c *CommonData) GetContainer() string

func (*CommonData) GetNamespace added in v0.15.0

func (c *CommonData) GetNamespace() string

func (*CommonData) GetNode added in v0.15.0

func (c *CommonData) GetNode() string

func (*CommonData) GetPod added in v0.15.0

func (c *CommonData) GetPod() string

func (*CommonData) SetContainerInfo added in v0.14.0

func (c *CommonData) SetContainerInfo(pod, namespace, container string)

func (*CommonData) SetNode added in v0.14.0

func (c *CommonData) SetNode(node string)

type EndpointKind added in v0.18.0

type EndpointKind string
const (
	EndpointKindPod     EndpointKind = "pod"
	EndpointKindService EndpointKind = "svc"
	EndpointKindRaw     EndpointKind = "raw"
)

type Event

type Event struct {
	CommonData

	// Timestamp in nanoseconds since January 1, 1970 UTC. An int64 is big
	// enough to represent time between the year 1678 and 2262.
	Timestamp Time `json:"timestamp,omitempty" column:"timestamp,template:timestamp,stringer"`

	// Type indicates the kind of this event
	Type EventType `json:"type"`

	// Message when Type is ERR, WARN, DEBUG or INFO
	Message string `json:"message,omitempty"`
}

func Debug

func Debug(msg string) Event

func Err

func Err(msg string) Event

func Info

func Info(msg string) Event

func Warn

func Warn(msg string) Event

func (Event) GetBaseEvent added in v0.11.0

func (e Event) GetBaseEvent() *Event

GetBaseEvent is needed to implement commonutils.BaseElement and snapshot.SnapshotEvent interfaces.

func (*Event) GetMessage added in v0.15.0

func (e *Event) GetMessage() string

func (*Event) GetType added in v0.15.0

func (e *Event) GetType() EventType

type EventType

type EventType string
const (
	// Indicates a generic event produced by a gadget. Gadgets extend
	// the base event to contain the specific data the gadget provides
	NORMAL EventType = "normal"

	// Event is an error message
	ERR EventType = "err"

	// Event is a warning message
	WARN EventType = "warn"

	// Event is a debug message
	DEBUG EventType = "debug"

	// Event is a info message
	INFO EventType = "info"

	// Indicates the tracer in the node is now is able to produce events
	READY EventType = "ready"
)

type L3Endpoint added in v0.18.0

type L3Endpoint struct {
	// Addr is filled by the gadget
	Addr string `json:"addr,omitempty" column:"addr,hide,template:ipaddr"`

	// Namespace, Name, Kind and PodLabels get populated by the KubeIPResolver operator
	Namespace string            `json:"namespace,omitempty" column:"ns,template:namespace,hide"`
	Name      string            `json:"podname,omitempty" column:"name,hide"`
	Kind      EndpointKind      `json:"kind,omitempty" column:"kind,hide"`
	PodLabels map[string]string `json:"podlabels,omitempty" column:"podLabels,hide"`
}

func (*L3Endpoint) String added in v0.18.0

func (e *L3Endpoint) String() string

type L4Endpoint added in v0.18.0

type L4Endpoint struct {
	L3Endpoint
	// Port is filled by the gadget
	Port uint16 `json:"port" column:"port,hide,template:ipport"`
}

func (*L4Endpoint) String added in v0.18.0

func (e *L4Endpoint) String() string

type Time added in v0.13.0

type Time int64

func (Time) String added in v0.13.0

func (t Time) String() string

type WithMountNsID added in v0.14.0

type WithMountNsID struct {
	MountNsID uint64 `json:"mountnsid,omitempty" column:"mntns,template:ns"`
}

func (*WithMountNsID) GetMountNSID added in v0.14.0

func (e *WithMountNsID) GetMountNSID() uint64

type WithNetNsID added in v0.14.0

type WithNetNsID struct {
	NetNsID uint64 `json:"netnsid,omitempty" column:"netns,template:ns"`
}

func (*WithNetNsID) GetNetNSID added in v0.14.0

func (e *WithNetNsID) GetNetNSID() uint64

Jump to

Keyboard shortcuts

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