engine

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ANNOTATION_PREFIX = "com.uswitch.alert"

Variables

View Source
var (
	WantPods = Want{
		"pods", &v1.Pod{},
		func(cs *kubernetes.Clientset) rest.Interface {
			return cs.CoreV1().RESTClient()
		},
	}
	WantDeployments = Want{
		"deployments", &appsv1.Deployment{},
		func(cs *kubernetes.Clientset) rest.Interface {
			return cs.AppsV1().RESTClient()
		},
	}
	WantCronJobs = Want{
		"cronjobs", &batchv1.CronJob{},
		func(cs *kubernetes.Clientset) rest.Interface {
			return cs.BatchV1().RESTClient()
		},
	}
	WantIngress = Want{
		"ingresses", &networkingv1.Ingress{},
		func(cs *kubernetes.Clientset) rest.Interface {
			return cs.NetworkingV1().RESTClient()
		},
	}
)

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Rule     *Rule
	Resource runtime.Object
	Message  string
}

func NewAlert

func NewAlert(resource runtime.Object, message string) *Alert

type Engine

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

func NewEngine

func NewEngine(clientSet *kubernetes.Clientset) *Engine

func (*Engine) AddOutput

func (e *Engine) AddOutput(output Output)

func (*Engine) AddRule

func (e *Engine) AddRule(rule *Rule)

func (*Engine) Run

func (e *Engine) Run(context context.Context, namespace string, ageLimit int)

type Output

type Output interface {
	Key() string
	Send(string, string) error
}

type Rule

type Rule struct {
	Id      string
	Wants   []Want
	Handler RuleHandler
}

func NewRule

func NewRule(handler RuleHandler, wants ...Want) *Rule

type RuleHandler

type RuleHandler func(runtime.Object, runtime.Object, *RuleHandlerContext)

type RuleHandlerContext

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

func (*RuleHandlerContext) Alert

func (ctx *RuleHandlerContext) Alert(obj runtime.Object, message string)

func (*RuleHandlerContext) Alertf

func (ctx *RuleHandlerContext) Alertf(obj runtime.Object, format string, objs ...interface{})

func (*RuleHandlerContext) Client

func (ctx *RuleHandlerContext) Client() *kubernetes.Clientset

type Want

type Want struct {
	Name       string
	Object     runtime.Object
	RESTClient func(*kubernetes.Clientset) rest.Interface
}

func UniqueWants

func UniqueWants(rules []*Rule) []Want

Jump to

Keyboard shortcuts

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