reconciler

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 23 Imported by: 133

Documentation

Index

Constants

View Source
const (
	// BrokerReadyCountN is the number of brokers that have become ready.
	BrokerReadyCountN = "broker_ready_count"
	// BrokerReadyLatencyN is the time it takes for a broker to become ready since the resource is created.
	BrokerReadyLatencyN = "broker_ready_latency"

	// TriggerReadyCountN is the number of triggers that have become ready.
	TriggerReadyCountN = "trigger_ready_count"
	// TriggerReadyLatencyN is the time it takes for a trigger to become ready since the resource is created.
	TriggerReadyLatencyN = "trigger_ready_latency"

	// ChannelReadyCountN is the number of channels that have become ready.
	ChannelReadyCountN = "channel_ready_count"
	// ChannelReadyLatencyN is the time it takes for a trigger to become ready since the resource is created.
	ChannelReadyLatencyN = "channel_ready_latency"

	// SubscriptionReadyCountN is the number of subscriptions that have become ready.
	SubscriptionReadyCountN = "subscription_ready_count"
	// SubscriptionReadyLatencyN is the time it takes for a subscription to become ready since the resource is created.
	SubscriptionReadyLatencyN = "subscription_ready_latency"

	// ContainerSourceReadyCountN is the number of container sources that have become ready.
	ContainerSourceReadyCountN = "container_source_ready_count"
	// ContainerSourceReadyLatencyN is the time it takes for a container source to become ready since the resource is created.
	ContainerSourceReadyLatencyN = "container_source_ready_latency"

	// CronJobSourceReadyCountN is the number of cron job sources that have become ready.
	CronJobSourceReadyCountN = "cron_job_source_ready_count"
	// CronJobSourceReadyLatencyN is the time it takes for a cron job source to become ready since the resource is created.
	CronJobSourceReadyLatencyN = "cron_job_source_ready_latency"

	// ApiServerSourceReadyCountN is the number of api server sources that have become ready.
	ApiServerSourceReadyCountN = "api_server_source_ready_count"
	// ApiServerSourceReadyLatencyN is the time it takes for an api server source to become ready since the resource is created.
	ApiServerSourceReadyLatencyN = "api_server_source_ready_latency"
)

Variables

View Source
var (
	KindToStatKeys = map[string]StatKey{

		"Broker": {
			ReadyLatencyKey: BrokerReadyLatencyN,
			ReadyCountKey:   BrokerReadyCountN,
		},
		"Trigger": {
			ReadyLatencyKey: TriggerReadyLatencyN,
			ReadyCountKey:   TriggerReadyCountN,
		},

		"Channel": {
			ReadyLatencyKey: ChannelReadyLatencyN,
			ReadyCountKey:   ChannelReadyCountN,
		},
		"Subscription": {
			ReadyLatencyKey: SubscriptionReadyLatencyN,
			ReadyCountKey:   SubscriptionReadyCountN,
		},

		"ContainerSource": {
			ReadyLatencyKey: ContainerSourceReadyLatencyN,
			ReadyCountKey:   ContainerSourceReadyCountN,
		},
		"CronJobSource": {
			ReadyLatencyKey: CronJobSourceReadyLatencyN,
			ReadyCountKey:   CronJobSourceReadyCountN,
		},
		"ApiServerSource": {
			ReadyLatencyKey: ApiServerSourceReadyLatencyN,
			ReadyCountKey:   ApiServerSourceReadyCountN,
		},
	}

	KindToMeasurements map[string]Measurements
)

Functions

func Handler

func Handler(h func(interface{})) cache.ResourceEventHandler

Handler wraps the provided handler function into a cache.ResourceEventHandler that sends all events to the given handler. For Updates, only the new object is forwarded.

func MustNewStatsReporter

func MustNewStatsReporter(reconciler string, logger *zap.SugaredLogger) controller.StatsReporter

MustNewStatsReporter creates a new instance of StatsReporter. Panics if creation fails.

Types

type Base

type Base struct {
	// KubeClientSet allows us to talk to the k8s for core APIs
	KubeClientSet kubernetes.Interface

	// EventingClientSet allows us to configure Eventing objects
	EventingClientSet clientset.Interface

	// DynamicClientSet allows us to configure pluggable Build objects
	DynamicClientSet dynamic.Interface

	// ConfigMapWatcher allows us to watch for ConfigMap changes.
	ConfigMapWatcher configmap.Watcher

	// Recorder is an event recorder for recording Event resources to the
	// Kubernetes API.
	Recorder record.EventRecorder

	// StatsReporter reports reconciler's metrics.
	StatsReporter StatsReporter

	// Sugared logger is easier to use but is not as performant as the
	// raw logger. In performance critical paths, call logger.Desugar()
	// and use the returned raw logger instead. In addition to the
	// performance benefits, raw logger also preserves type-safety at
	// the expense of slightly greater verbosity.
	Logger *zap.SugaredLogger
}

Base implements the core controller logic, given a Reconciler.

func NewBase

func NewBase(opt Options, controllerAgentName string) *Base

NewBase instantiates a new instance of Base implementing the common & boilerplate code between our reconcilers.

type Measurement

type Measurement int

type Measurements

type Measurements struct {
	ReadyLatencyStat *stats.Int64Measure
	ReadyCountStat   *stats.Int64Measure
}

type Options

type Options struct {
	KubeClientSet    kubernetes.Interface
	DynamicClientSet dynamic.Interface

	EventingClientSet clientset.Interface

	Recorder      record.EventRecorder
	StatsReporter StatsReporter

	ConfigMapWatcher configmap.Watcher
	Logger           *zap.SugaredLogger

	ResyncPeriod time.Duration
	StopChannel  <-chan struct{}
}

Options defines the common reconciler options. We define this to reduce the boilerplate argument list when creating our controllers.

func NewOptionsOrDie

func NewOptionsOrDie(cfg *rest.Config, logger *zap.SugaredLogger, stopCh <-chan struct{}) Options

func (Options) GetTrackerLease

func (o Options) GetTrackerLease() time.Duration

GetTrackerLease returns a multiple of the resync period to use as the duration for tracker leases. This attempts to ensure that resyncs happen to refresh leases frequently enough that we don't miss updates to tracked objects.

type StatKey

type StatKey struct {
	ReadyLatencyKey string
	ReadyCountKey   string
}

type StatsReporter

type StatsReporter interface {
	// ReportReady reports the time it took a resource to become Ready.
	ReportReady(kind, namespace, service string, d time.Duration) error
}

StatsReporter reports reconcilers' metrics.

func NewStatsReporter

func NewStatsReporter(reconciler string) (StatsReporter, error)

NewStatsReporter creates a reporter for reconcilers' metrics

Directories

Path Synopsis
Package apiserversource implements the ApiSource controller.
Package apiserversource implements the ApiSource controller.
Package containersource implements the ContainerSource controller.
Package containersource implements the ContainerSource controller.
Package cronjobsource implements the CronJobSource controller.
Package cronjobsource implements the CronJobSource controller.

Jump to

Keyboard shortcuts

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