Documentation
¶
Overview ¶
Package common contains reconciliation helpers shared between routing reconcilers.
Index ¶
- Constants
- func CommonObjectLabels(rtr kmeta.OwnerRefable) labels.Set
- func ComponentName(rtr kmeta.OwnerRefable) string
- func CreateCloudEventAttributes(source string, eventTypes []string) []duckv1.CloudEventAttributes
- func EnqueueObjectsInNamespaceOf(inf cache.SharedInformer, resyncFn filteredGlobalResyncFunc, ...) func(interface{})
- func MTAdapterObjectName(rtr kmeta.OwnerRefable) string
- func NewMTAdapterKnService(rtr v1alpha1.Router, opts ...resource.ObjectOption) *servingv1.Service
- func OwnByServiceAccount(obj metav1.Object, owner *corev1.ServiceAccount)
- func URLPath(src metav1.Object) string
- type AdapterServiceBuilder
- type GenericRBACReconciler
- type GenericServiceReconciler
- type RBACOwnersLister
Constants ¶
const ( EnvName = "NAME" EnvNamespace = "NAMESPACE" )
Common environment variables propagated to adapters.
const ( // ReasonRBACCreate indicates that an RBAC object was successfully created. ReasonRBACCreate = "CreateRBAC" // ReasonRBACUpdate indicates that an RBAC object was successfully updated. ReasonRBACUpdate = "UpdateRBAC" // ReasonFailedRBACCreate indicates that the creation of an RBAC object failed. ReasonFailedRBACCreate = "FailedRBACCreate" // ReasonFailedRBACUpdate indicates that the update of an RBAC object failed. ReasonFailedRBACUpdate = "FailedRBACUpdate" // ReasonAdapterCreate indicates that an adapter object was successfully created. ReasonAdapterCreate = "CreateAdapter" // ReasonAdapterUpdate indicates that an adapter object was successfully updated. ReasonAdapterUpdate = "UpdateAdapter" // ReasonFailedAdapterCreate indicates that the creation of an adapter object failed. ReasonFailedAdapterCreate = "FailedAdapterCreate" // ReasonFailedAdapterUpdate indicates that the update of an adapter object failed. ReasonFailedAdapterUpdate = "FailedAdapterUpdate" // ReasonBadSinkURI indicates that the URI of a sink can't be determined. ReasonBadSinkURI = "BadSinkURI" )
Reasons for API Events
Variables ¶
This section is empty.
Functions ¶
func CommonObjectLabels ¶
func CommonObjectLabels(rtr kmeta.OwnerRefable) labels.Set
CommonObjectLabels returns a set of labels which are always applied to objects reconciled for the given source type.
func ComponentName ¶
func ComponentName(rtr kmeta.OwnerRefable) string
ComponentName returns the component name for the given source object.
func CreateCloudEventAttributes ¶
func CreateCloudEventAttributes(source string, eventTypes []string) []duckv1.CloudEventAttributes
CreateCloudEventAttributes returns CloudEvent attributes for the event types supported by the source.
func EnqueueObjectsInNamespaceOf ¶
func EnqueueObjectsInNamespaceOf(inf cache.SharedInformer, resyncFn filteredGlobalResyncFunc, logger *zap.SugaredLogger) func(interface{})
EnqueueObjectsInNamespaceOf accepts an object and triggers a global resync of all objects in the given informer matching that object's namespace. Intended to be used to resync source objects when the state of their (common) multi-tenant adapter changes.
func MTAdapterObjectName ¶
func MTAdapterObjectName(rtr kmeta.OwnerRefable) string
MTAdapterObjectName returns a unique name to apply to all objects related to the given source's multi-tenant adapter (RBAC, KnService, ...).
func NewMTAdapterKnService ¶
NewMTAdapterKnService is a wrapper around resource.NewKnService which pre-populates attributes common to all multi-tenant adapters backed by a Knative Service.
func OwnByServiceAccount ¶
func OwnByServiceAccount(obj metav1.Object, owner *corev1.ServiceAccount)
OwnByServiceAccount sets the owner of obj to the given ServiceAccount.
Types ¶
type AdapterServiceBuilder ¶
type AdapterServiceBuilder interface { RBACOwnersLister BuildAdapter(r v1alpha1.Router, sinkURI *apis.URL) *servingv1.Service }
AdapterServiceBuilder provides all the necessary information for building objects related to a Router's adapter backed by a Knative Service.
type GenericRBACReconciler ¶
type GenericRBACReconciler struct { // API clients SAClient func(namespace string) coreclientv1.ServiceAccountInterface RBClient func(namespace string) rbacclientv1.RoleBindingInterface // objects listers SALister func(namespace string) corelistersv1.ServiceAccountNamespaceLister RBLister func(namespace string) rbaclistersv1.RoleBindingNamespaceLister }
GenericRBACReconciler reconciles RBAC objects for source adapters.
func NewGenericRBACReconciler ¶
func NewGenericRBACReconciler(ctx context.Context) *GenericRBACReconciler
NewGenericRBACReconciler creates a new GenericRBACReconciler.
type GenericServiceReconciler ¶
type GenericServiceReconciler struct { // URI resolver for sinks SinkResolver *resolver.URIResolver // API clients Client func(namespace string) servingclientv1.ServiceInterface // objects listers Lister func(namespace string) servinglistersv1.ServiceNamespaceLister *GenericRBACReconciler }
GenericServiceReconciler contains interfaces shared across Service reconcilers.
func NewMTGenericServiceReconciler ¶
func NewMTGenericServiceReconciler(ctx context.Context, typ kmeta.OwnerRefable, tracker tracker.Interface, adapterHandlerFn func(obj interface{}), ) GenericServiceReconciler
NewMTGenericServiceReconciler creates a new GenericServiceReconciler for a multi-tenant adapter and attaches a default event handler to its Service informer.
func (*GenericServiceReconciler) ReconcileAdapter ¶
func (r *GenericServiceReconciler) ReconcileAdapter(ctx context.Context, ab AdapterServiceBuilder) reconciler.Event
ReconcileAdapter reconciles a receive adapter.
type RBACOwnersLister ¶
type RBACOwnersLister interface {
RBACOwners(namespace string) ([]kmeta.OwnerRefable, error)
}
RBACOwnersLister returns a list of OwnerRefable to be set as a the OwnerReferences metadata attribute of a ServiceAccount.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package event contains functions for generating Kubernetes API events.
|
Package event contains functions for generating Kubernetes API events. |
Package resource contains helpers to generate Kubernetes API objects.
|
Package resource contains helpers to generate Kubernetes API objects. |
Package skip allows a Context to carry the intention to skip parts of the code execution.
|
Package skip allows a Context to carry the intention to skip parts of the code execution. |