reconciler

package
v0.0.0-...-0178fde Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package reconciler defines implementations of the Reconciler interface defined at github.com/knative/pkg/controller.Reconciler. These implement the basic workhorse functionality of controllers, while leaving the shared controller implementation to manage things like the workqueue.

Despite defining a Reconciler, each of the packages here are expected to expose a controller constructor like:

func NewController(...) *controller.Impl { ... }

These constructors will:

  1. Construct the Reconciler,
  2. Construct a controller.Impl with that Reconciler,
  3. Wire the assorted informers this Reconciler watches to call appropriate enqueue methods on the controller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

	// ProjectriffClientSet allows us to configure projectriff objects
	ProjectriffClientSet projectriffclientset.Interface

	// ServingClientSet allows us to configure Serving objects
	ServingClientSet servingclientset.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

	// 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 Options

type Options struct {
	KubeClientSet        kubernetes.Interface
	ProjectriffClientSet projectriffclientset.Interface
	ServingClientSet     servingclientset.Interface
	Recorder             record.EventRecorder

	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 (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.

Directories

Path Synopsis
v1alpha1
application/resources
Package resources holds simple functions for synthesizing child resources from a Service resource and any relevant Service controller configuration.
Package resources holds simple functions for synthesizing child resources from a Service resource and any relevant Service controller configuration.
application/resources/names
Package names holds simple functions for synthesizing resource names.
Package names holds simple functions for synthesizing resource names.
function/resources
Package resources holds simple functions for synthesizing child resources from a Service resource and any relevant Service controller configuration.
Package resources holds simple functions for synthesizing child resources from a Service resource and any relevant Service controller configuration.
function/resources/names
Package names holds simple functions for synthesizing resource names.
Package names holds simple functions for synthesizing resource names.

Jump to

Keyboard shortcuts

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