internal

package
v0.0.0-...-d28b36b Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FKClusterFlow FlowKind = "clusterflow"
	FKFlow        FlowKind = "flow"

	RegisterListener listenerEventType = iota
	UnregisterListener

	AuthHeaderKey = "X-Authorization"
	AuthQueryKey  = "token"
)
View Source
const HealthCheckEndpoint = "/healthz"
View Source
const MetricsEndpoint = "/metrics"

Variables

View Source
var (
	DefLabel          = map[string]string{"app.kubernetes.io/created-by": "log-socket"}
	FlowAnnotationKey = "flowRef"
)

Functions

func Ingest

func Ingest(addr string, records RecordSink, logs log.Sink, metrics IngestMetrics, stopSignal Handleable, terminateSignal Handleable)

func IsUnauthenticatedError

func IsUnauthenticatedError(err error) bool

func Listen

func Listen(addr string, tlsConfig *tls.Config, reg ListenerRegistry, logs log.Sink, metrics ListenMetrics,
	stopSignal Handleable, terminationSignal Handleable, authenticator Authenticator)

Types

type Authenticator

type Authenticator interface {
	Authenticate(token string) (authv1.UserInfo, error)
}

type FlowKind

type FlowKind string

type FlowReference

type FlowReference struct {
	types.NamespacedName
	Kind FlowKind
}

func ExtractFlow

func ExtractFlow(req *http.Request) (res FlowReference, err error)

func (FlowReference) URL

func (f FlowReference) URL() string

type Handleable

type Handleable interface {
	HandleWith(func())
}

type HandleableLatch

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

func NewHandleableLatch

func NewHandleableLatch(ch <-chan struct{}) *HandleableLatch

func (*HandleableLatch) HandleWith

func (l *HandleableLatch) HandleWith(handler func())

type IngestMetrics

type IngestMetrics interface {
	HealthCheck()
	LogRecordReceived(r Record)
}

type ListenMetrics

type ListenMetrics interface {
	ListenerAccepted(flow FlowReference, user authv1.UserInfo)
	ListenerRejected(flow FlowReference, user authv1.UserInfo)
	// contains filtered or unexported methods
}

type Listener

type Listener interface {
	Send(Record)
	Flow() FlowReference
	User() authv1.UserInfo
}

type ListenerEvent

type ListenerEvent struct {
	Listener  Listener
	EventType listenerEventType
}

type ListenerEventChannel

type ListenerEventChannel chan ListenerEvent

func (ListenerEventChannel) Register

func (r ListenerEventChannel) Register(l Listener)

func (ListenerEventChannel) Unregister

func (r ListenerEventChannel) Unregister(l Listener)

type ListenerRegistry

type ListenerRegistry interface {
	Register(Listener)
	Unregister(Listener)
}

type Metrics

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

func NewMetrics

func NewMetrics(logs log.Sink) *Metrics

func (*Metrics) CurrentListeners

func (ms *Metrics) CurrentListeners(cnt int)

func (*Metrics) Error

func (ms *Metrics) Error()

func (*Metrics) HealthCheck

func (ms *Metrics) HealthCheck()

func (*Metrics) ListenerAccepted

func (ms *Metrics) ListenerAccepted(flow FlowReference, user authv1.UserInfo)

func (*Metrics) ListenerRejected

func (ms *Metrics) ListenerRejected(flow FlowReference, user authv1.UserInfo)

func (*Metrics) ListenerRemoved

func (ms *Metrics) ListenerRemoved(l Listener)

func (*Metrics) LogRecordReceived

func (ms *Metrics) LogRecordReceived(r Record)

func (*Metrics) LogRecordRedacted

func (ms *Metrics) LogRecordRedacted(l Listener, r Record)

func (*Metrics) LogRecordTransmitted

func (ms *Metrics) LogRecordTransmitted(l Listener, r Record)

type Pipeline

type Pipeline []*Stage

func (Pipeline) ProcessRecord

func (p Pipeline) ProcessRecord(record []byte) (res [][]byte, err error)

func (Pipeline) String

func (p Pipeline) String() string

type ReconcileEvent

type ReconcileEvent struct {
	Requests []FlowReference
}

type ReconcileEventChannel

type ReconcileEventChannel chan ReconcileEvent

type Record

type Record struct {
	RawData []byte
	Data    struct {
		Kubernetes struct {
			Labels  map[string]string `json:"labels"`
			PodName string            `json:"pod_name"`
		} `json:"kubernetes"`
	}
	Flow FlowReference
}

type RecordSink

type RecordSink interface {
	Push(Record)
}

type RecordsChannel

type RecordsChannel chan Record

func (RecordsChannel) Push

func (rs RecordsChannel) Push(r Record)

type Stage

type Stage struct {
	Instance *wasmer.Instance
	Memory   *wasmer.Memory
	Module   *wasmer.Module
	Origin   string
	// contains filtered or unexported fields
}

func LoadStageFromFile

func LoadStageFromFile(store *wasmer.Store, logs log.Sink, path string) (stage *Stage, err error)

func (*Stage) Receive

func (s *Stage) Receive() error

type TokenReviewAuthenticator

type TokenReviewAuthenticator struct {
	Client client.Client `json:"client" yaml:"client"` //this is a client
}

func (TokenReviewAuthenticator) Authenticate

func (t TokenReviewAuthenticator) Authenticate(token string) (res authv1.UserInfo, err error)

type UnauthenticatedError

type UnauthenticatedError interface {
	IsUnauthenticatedError() bool
}

type WaitableLatch

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

func NewWaitableLatch

func NewWaitableLatch() *WaitableLatch

func (*WaitableLatch) Chan

func (l *WaitableLatch) Chan() <-chan struct{}

func (*WaitableLatch) Close

func (l *WaitableLatch) Close()

func (*WaitableLatch) Wait

func (l *WaitableLatch) Wait()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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