controller

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewConversionBindingsController = func() *conversionBindingsController {
	return &conversionBindingsController{
		Links: make(map[string]map[conversion.Rule]*ConversionBindingToWebhookLink),
	}
}

NewConversionBindingsController returns an implementation of ConversionBindingsController

View Source
var NewKubernetesBindingsController = func() *kubernetesBindingsController {
	return &kubernetesBindingsController{
		BindingMonitorLinks: make(map[string]*KubernetesBindingToMonitorLink),
	}
}

NewKubernetesBindingsController returns an implementation of KubernetesBindingsController

View Source
var NewScheduleBindingsController = func() *scheduleBindingsController {
	return &scheduleBindingsController{
		ScheduleLinks: make(map[string]*ScheduleBindingToCrontabLink),
	}
}

NewScheduleBindingsController returns an implementation of ScheduleBindingsController

View Source
var NewValidatingBindingsController = func() *admissionBindingsController {
	return &admissionBindingsController{
		AdmissionLinks: make(map[string]*AdmissionBindingToWebhookLink),
	}
}

NewValidatingBindingsController returns an implementation of AdmissionBindingsController

Functions

func ConvertKubeEventToBindingContext

func ConvertKubeEventToBindingContext(kubeEvent KubeEvent, link *KubernetesBindingToMonitorLink) []BindingContext

Types

type AdmissionBindingToWebhookLink struct {
	BindingType     BindingType
	BindingName     string
	ConfigurationId string
	WebhookId       string
	// Useful fields to create a BindingContext
	IncludeSnapshots []string
	Group            string
}

AdmissionBindingToWebhookLink is a link between a hook and a webhook configuration.

type AdmissionBindingsController added in v1.2.0

type AdmissionBindingsController interface {
	WithValidatingBindings([]ValidatingConfig)
	WithMutatingBindings([]MutatingConfig)
	WithWebhookManager(*admission.WebhookManager)
	EnableValidatingBindings()
	EnableMutatingBindings()
	DisableValidatingBindings()
	DisableMutatingBindings()
	CanHandleEvent(event AdmissionEvent) bool
	HandleEvent(event AdmissionEvent) BindingExecutionInfo
}

AdmissionBindingsController handles admission bindings for one hook.

type BindingExecutionInfo

type BindingExecutionInfo struct {
	BindingContext      []BindingContext
	IncludeSnapshots    []string
	IncludeAllSnapshots bool
	AllowFailure        bool
	QueueName           string
	Binding             string
	Group               string
	KubernetesBinding   OnKubernetesEventConfig
}
type ConversionBindingToWebhookLink struct {
	BindingName string
	// Useful fields to create a BindingContext
	CrdName          string
	FromVersion      string
	ToVersion        string
	IncludeSnapshots []string
	Group            string
}

A link between a hook and a kube monitor

type ConversionBindingsController

type ConversionBindingsController interface {
	WithBindings([]ConversionConfig)
	WithWebhookManager(manager *conversion.WebhookManager)
	EnableConversionBindings()
	DisableConversionBindings()
	CanHandleEvent(event conversion.Event, rule conversion.Rule) bool
	HandleEvent(event conversion.Event, rule conversion.Rule) BindingExecutionInfo
}

ScheduleBindingsController handles schedule bindings for one hook.

type HookController

type HookController interface {
	InitKubernetesBindings([]OnKubernetesEventConfig, kube_events_manager.KubeEventsManager)
	InitScheduleBindings([]ScheduleConfig, schedule_manager.ScheduleManager)
	InitAdmissionBindings([]ValidatingConfig, []MutatingConfig, *admission.WebhookManager)
	InitConversionBindings([]ConversionConfig, *conversion.WebhookManager)

	CanHandleKubeEvent(kubeEvent KubeEvent) bool
	CanHandleScheduleEvent(crontab string) bool
	CanHandleAdmissionEvent(event AdmissionEvent) bool
	CanHandleConversionEvent(event conversion.Event, rule conversion.Rule) bool

	// These method should call an underlying *Binding*Controller to get binding context
	// and then add Snapshots to binding context
	HandleEnableKubernetesBindings(createTasksFn func(BindingExecutionInfo)) error
	HandleKubeEvent(event KubeEvent, createTasksFn func(BindingExecutionInfo))
	HandleScheduleEvent(crontab string, createTasksFn func(BindingExecutionInfo))
	HandleAdmissionEvent(event AdmissionEvent, createTasksFn func(BindingExecutionInfo))
	HandleConversionEvent(event conversion.Event, rule conversion.Rule, createTasksFn func(BindingExecutionInfo))

	UnlockKubernetesEvents()
	UnlockKubernetesEventsFor(monitorID string)
	StopMonitors()
	UpdateMonitor(monitorId string, kind, apiVersion string) error

	EnableScheduleBindings()
	DisableScheduleBindings()

	EnableAdmissionBindings()

	EnableConversionBindings()

	KubernetesSnapshots() map[string][]ObjectAndFilterResult
	UpdateSnapshots([]BindingContext) []BindingContext
	SnapshotsInfo() []string
	SnapshotsDump() map[string]interface{}
}

func NewHookController

func NewHookController() HookController
type KubernetesBindingToMonitorLink struct {
	MonitorId     string
	BindingConfig OnKubernetesEventConfig
}

KubernetesBindingToMonitorLink is a link between a binding config and a Monitor.

type KubernetesBindingsController

type KubernetesBindingsController interface {
	WithKubernetesBindings([]OnKubernetesEventConfig)
	WithKubeEventsManager(kube_events_manager.KubeEventsManager)
	EnableKubernetesBindings() ([]BindingExecutionInfo, error)
	UpdateMonitor(monitorId string, kind, apiVersion string) error
	UnlockEvents()
	UnlockEventsFor(monitorID string)
	StopMonitors()
	CanHandleEvent(kubeEvent KubeEvent) bool
	HandleEvent(kubeEvent KubeEvent) BindingExecutionInfo
	BindingNames() []string

	SnapshotsFrom(bindingNames ...string) map[string][]ObjectAndFilterResult
	SnapshotsFor(bindingName string) []ObjectAndFilterResult
	Snapshots() map[string][]ObjectAndFilterResult
	SnapshotsInfo() []string
	SnapshotsDump() map[string]interface{}
}

KubernetesBindingsController handles kubernetes bindings for one hook.

type ScheduleBindingToCrontabLink struct {
	BindingName string
	Crontab     string
	// Useful fields to create a BindingContext
	IncludeSnapshots []string
	AllowFailure     bool
	QueueName        string
	Group            string
}

A link between a hook and a kube monitor

type ScheduleBindingsController

type ScheduleBindingsController interface {
	WithScheduleBindings([]ScheduleConfig)
	WithScheduleManager(schedule_manager.ScheduleManager)
	EnableScheduleBindings()
	DisableScheduleBindings()
	CanHandleEvent(crontab string) bool
	HandleEvent(crontab string) []BindingExecutionInfo
}

ScheduleBindingsController handles schedule bindings for one hook.

Jump to

Keyboard shortcuts

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