reconciler

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AzureChannelReadyCountN is the number of azure channels that have become ready.
	AzureChannelReadyCountN = "azurechannel_ready_count"
	// AzureChannelReadyLatencyN is the time it takes for a azure channel to become ready since the resource is created.
	AzureChannelReadyLatencyN = "azurechannel_ready_latency"
)

Variables

View Source
var (
	KindToStatKeys = map[string]StatKey{
		"AzureChannel": {
			ReadyCountKey:   AzureChannelReadyCountN,
			ReadyLatencyKey: AzureChannelReadyLatencyN,
		},
	}

	KindToMeasurements map[string]Measurements
)

Functions

This section is empty.

Types

type Base

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

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

	AzureClientSet clientset.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

	AzureClientSet clientset.Interface

	Recorder      record.EventRecorder
	StatsReporter StatsReporter

	ConfigMapWatcher *configmap.InformedWatcher
	Logger           *zap.SugaredLogger

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

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

Jump to

Keyboard shortcuts

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