server

package
Version: v0.0.0-...-9cb8e21 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContainerEventsQuery is the query used to retrieve ContainerEvents from database
	ContainerEventsQuery = "SELECT * FROM ContainerEvents"
	// FlowEventsQuery is the query used to retrieve FlowEvents from database
	FlowEventsQuery = "SELECT * FROM FlowEvents"
)
View Source
const (
	// FlowReject indicates that a flow was rejected
	FlowReject = "reject"
	// FlowAccept logs that a flow is accepted
	FlowAccept = "accept"
	// FlowNowRejected logs that a flow is accepted and later rejected
	FlowNowRejected = "nowrejected"
	// ContainerStart indicates a container start event
	ContainerStart = "start"
	// ContainerStop indicates a container stop event
	ContainerStop = "stop"
	// ContainerCreate indicates a container create event
	ContainerCreate = "create"
	// ContainerDelete indicates a container delete event
	ContainerDelete = "delete"
	// ContainerUpdate indicates a container policy update event
	ContainerUpdate = "update"
	// ContainerFailed indicates an event that a container was stopped because of policy issues
	ContainerFailed = "forcestop"
	// ContainerIgnored indicates that the container will be ignored by Trireme
	ContainerIgnored = "ignore"
	// UnknownContainerDelete indicates that policy for an unknown  container was deleted
	UnknownContainerDelete = "unknowncontainer"
)
View Source
const (
	// ContainerEvent is the Container events measurement name
	ContainerEvent = "ContainerEvents"
	// FlowEvent is the Flow events measurement name
	FlowEvent = "FlowEvents"
)
View Source
const (
	// PODNameFromContainerTags is tha tag used to retrieve pod name from tags in ContainerEvents
	PODNameFromContainerTags = "@usr:io.kubernetes.pod.name"
	// PODNamespaceFromContainerTags is the tag used to retrieve pod namespace from tags in ContainerEvents
	PODNamespaceFromContainerTags = "@usr:io.kubernetes.pod.namespace"
	// PODNamespaceFromFlowTags is the tag used to retrieve flow associated to a particular pod namespace from tags in FlowEvents
	PODNamespaceFromFlowTags = "@namespace"
)
View Source
const (
	// ContainerContextIDIndex from influxdb response
	ContainerContextIDIndex = 1
	// ContainerIPAddressIndex from influxdb response
	ContainerIPAddressIndex = 5
	// ContainerTimestampIndex from influxdb response
	ContainerTimestampIndex = 0
	// ContainerTagsIndex from influxdb response
	ContainerTagsIndex = 6
	// ContainerEventIndex from influxdb response
	ContainerEventIndex = 2
)
View Source
const (
	// FlowTimestampIndex from influxdb response
	FlowTimestampIndex = 0
	// FlowSourceIDIndex from influxdb response
	FlowSourceIDIndex = 12
	// FlowSourceIPIndex from influxdb response
	FlowSourceIPIndex = 13
	// FlowDestinationIDIndex from influxdb response
	FlowDestinationIDIndex = 2
	// FlowDestinationIPIndex from influxdb response
	FlowDestinationIPIndex = 5
	// FlowActionIndex from influxdb response
	FlowActionIndex = 1
	// FlowTagsIndex from influxdb response
	FlowTagsIndex = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerEvents

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

ContainerEvents struct to hold container event attributes

type FlowEvents

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

FlowEvents struct to hold flow event attributes

type Graph

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

Graph which holds the fields for graph creation

func NewGraph

func NewGraph(httpClient influxdb.DataAdder, dbname string) *Graph

NewGraph is the handler for graph generators

func (*Graph) FindLinksBetweenGivenTimeAndOrNamespace

func (g *Graph) FindLinksBetweenGivenTimeAndOrNamespace(starttime time.Time, endtime time.Time, namespace string)

FindLinksBetweenGivenTimeAndOrNamespace will aggregate links within the specified time, namespaces or both

func (*Graph) FindNodesBetweenGivenTimeAndOrNamespace

func (g *Graph) FindNodesBetweenGivenTimeAndOrNamespace(starttime time.Time, endtime time.Time, namespace string)

FindNodesBetweenGivenTimeAndOrNamespace will aggregate nodes within the specified time, namespaces or both

func (*Graph) GetData

func (g *Graph) GetData(w http.ResponseWriter, r *http.Request)

GetData is called by the client which generates json with a logic that defines the nodes and links for graph

func (*Graph) GetGraph

func (g *Graph) GetGraph(w http.ResponseWriter, r *http.Request)

GetGraph is used to parse html with custom address to request for json

func (*Graph) Start

func (g *Graph) Start(interval int)

Start is used to start generating jsonData for every 15 seconds

type GraphData

type GraphData struct {
	Nodes []Node `json:"nodes"`
	Links []Link `json:"links"`
}

GraphData is the struct that holds the json format required for graph to generate nodes and link

type Link struct {
	Time      time.Time `json:"time"`
	Source    string    `json:"source"`
	Target    string    `json:"target"`
	Action    string    `json:"action"`
	Namespace string    `json:"namespace"`
}

Link which holds the links between pu's

func DefaultLink() Link

DefaultLink is the default links struct for graph

type Node

type Node struct {
	Time      time.Time `json:"time"`
	ContextID string    `json:"id"`
	PodName   string    `json:"name"`
	IPAddress string    `json:"ipaddress"`
	Namespace string    `json:"namespace"`
}

Node which holds pu information

func DefaultNode

func DefaultNode() Node

DefaultNode is the default nodes struct for graph

Jump to

Keyboard shortcuts

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