reconciler

package
Version: v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 31 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

View Source
const (
	// ServiceReadyCountN is the number of services that have become ready.
	ServiceReadyCountN = "service_ready_count"
	// ServiceReadyLatencyN is the time it takes for a service to become ready since the resource is created.
	ServiceReadyLatencyN = "service_ready_latency"
)
View Source
const (
	ForceUpgradePatch = `[{
  "op":"add",
  "path":"/metadata/annotations/serving.knative.dev~1forceUpgrade",
  "value":"true"
}]`
)

Variables

This section is empty.

Functions

func AnnotationFilterFunc added in v0.3.0

func AnnotationFilterFunc(key string, value string, allowUnset bool) func(interface{}) bool

AnnotationFilterFunc creates a FilterFunc only accepting objects with given annotation key and value

func ChainFilterFuncs added in v0.6.0

func ChainFilterFuncs(funcs ...func(interface{}) bool) func(interface{}) bool

ChainFilterFuncs creates a FilterFunc which performs an AND of the passed FilterFuncs.

func LabelExistsFilterFunc added in v0.4.0

func LabelExistsFilterFunc(label string) func(obj interface{}) bool

LabelExistsFilterFunc creates a FilterFunc only accepting objects which have a given label.

func LabelFilterFunc added in v0.6.0

func LabelFilterFunc(label string, value string, allowUnset bool) func(interface{}) bool

LabelFilterFunc creates a FilterFunc only accepting objects where a label is set to a specific value.

func NameFilterFunc added in v0.6.0

func NameFilterFunc(name string) func(interface{}) bool

NameFilterFunc creates a FilterFunc only accepting objects with the given name.

func NamespaceFilterFunc added in v0.6.0

func NamespaceFilterFunc(namespace string) func(interface{}) bool

NamespaceFilterFunc creates a FilterFunc only accepting objects in the given namespace.

func Not added in v0.9.0

func Not(f func(interface{}) bool) func(interface{}) bool

Not inverts the result of the predicate.

func WithStatsReporter added in v0.7.0

func WithStatsReporter(ctx context.Context, sr StatsReporter) context.Context

WithStatsReporter attaches the given StatsReporter to the provided context in the returned context.

Types

type Base

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

	// SharedClientSet allows us to configure shared objects
	SharedClientSet sharedclientset.Interface

	// ServingClientSet allows us to configure Serving objects
	ServingClientSet clientset.Interface

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

	// CachingClientSet allows us to instantiate Image objects
	CachingClientSet cachingclientset.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(ctx context.Context, controllerAgentName string, cmw configmap.Watcher) *Base

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

func (*Base) MarkNeedsUpgrade added in v0.7.0

func (b *Base) MarkNeedsUpgrade(gvr schema.GroupVersionResource, namespace, name string) error

type ConfigStore added in v0.7.0

type ConfigStore interface {
	ToContext(ctx context.Context) context.Context
}

ConfigStore is a minimal interface to the config stores used by our controllers.

type StatsReporter added in v0.3.0

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

StatsReporter reports reconcilers' metrics.

func GetStatsReporter added in v0.7.0

func GetStatsReporter(ctx context.Context) StatsReporter

GetStatsReporter attempts to look up the StatsReporter on a given context. It may return null if none is found.

func NewStatsReporter added in v0.3.0

func NewStatsReporter(reconciler string) (StatsReporter, error)

NewStatsReporter creates a reporter for reconcilers' metrics

Directories

Path Synopsis
config
Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Autoscaling controller depends.
Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Autoscaling controller depends.
hpa
kpa
Package kpa implements a kubernetes controller which tracks revisions and notifies a callback interface.
Package kpa implements a kubernetes controller which tracks revisions and notifies a callback interface.
resources
Package resources contains methods for manipulating K8s resources shared between different PA implementations.
Package resources contains methods for manipulating K8s resources shared between different PA implementations.
resources/names
Package names contains methods for manipulating K8s resources' names shared between different PA implementations.
Package names contains methods for manipulating K8s resources' names shared between different PA implementations.
config
+k8s:deepcopy-gen=package Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Certificate controller depends.
+k8s:deepcopy-gen=package Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Certificate controller depends.
resources
Package resources holds simple functions for synthesizing child resources from a Configuration resource and any relevant Configuration controller configuration.
Package resources holds simple functions for synthesizing child resources from a Configuration resource and any relevant Configuration controller configuration.
gc
config
+k8s:deepcopy-gen=package Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Configuration controller depends.
+k8s:deepcopy-gen=package Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Configuration controller depends.
Package ingress implements a kubernetes controller which tracks Ingress resource and reconcile VirtualService as its child resource.
Package ingress implements a kubernetes controller which tracks Ingress resource and reconcile VirtualService as its child resource.
config
Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Ingress controller depends.
Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Ingress controller depends.
resources
Package resources holds simple functions for synthesizing child resources from an Ingress resource and any relevant Ingress controller configuration.
Package resources holds simple functions for synthesizing child resources from an Ingress resource and any relevant Ingress controller configuration.
resources/names
Package names holds simple functions for synthesizing resource names.
Package names holds simple functions for synthesizing resource names.
Package labeler holds the logic that applies Route labels to Configurations to implement knative/serving#226.
Package labeler holds the logic that applies Route labels to Configurations to implement knative/serving#226.
config
Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Revision controller depends.
Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Revision controller depends.
resources
Package resources holds simple functions for synthesizing child resources from a Revision resource and any relevant Revision controller configuration.
Package resources holds simple functions for synthesizing child resources from a Revision resource and any relevant Revision controller configuration.
resources/names
Package names holds simple functions for synthesizing resource names.
Package names holds simple functions for synthesizing resource names.
Package route implements a kubernetes controller which tracks Route resource and reconcile Ingress as its child resource.
Package route implements a kubernetes controller which tracks Route resource and reconcile Ingress as its child resource.
config
+k8s:deepcopy-gen=package Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Route controller depends.
+k8s:deepcopy-gen=package Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Route controller depends.
domains
Package domains holds simple functions for generating domains.
Package domains holds simple functions for generating domains.
resources
Package resources holds simple functions for synthesizing child resources from a Route resource and any relevant Route controller configuration.
Package resources holds simple functions for synthesizing child resources from a Route resource and any relevant Route controller configuration.
resources/labels
Package labels holds simple functions for working with ObjectMeta labels.
Package labels holds simple functions for working with ObjectMeta labels.
resources/names
Package names holds simple functions for synthesizing resource names.
Package names holds simple functions for synthesizing resource names.
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.
resources/names
Package names holds simple functions for synthesizing resource names.
Package names holds simple functions for synthesizing resource names.
testing

Jump to

Keyboard shortcuts

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