Documentation ¶
Overview ¶
Package common contains reconciliation helpers shared between source reconcilers.
Index ¶
- Constants
- func CommonObjectLabels(src kmeta.OwnerRefable) labels.Set
- func ComponentName(src kmeta.OwnerRefable) string
- func CreateCloudEventAttributes(source string, eventTypes []string) []duckv1.CloudEventAttributes
- func EnqueueObjectsInNamespaceOf(inf cache.SharedInformer, resyncFn filteredGlobalResyncFunc, ...) func(interface{})
- func GetStatefulBridgeID(object metav1.Object) string
- func MTAdapterObjectName(src kmeta.OwnerRefable) string
- func MaybeAppendValueFromEnvVar(envs []corev1.EnvVar, key string, valueFrom v1alpha1.ValueFromField) []corev1.EnvVar
- func NewAdapterDeployment(src v1alpha1.EventSource, sinkURI *apis.URL, opts ...resource.ObjectOption) *appsv1.Deployment
- func NewAdapterKnService(src v1alpha1.EventSource, sinkURI *apis.URL, opts ...resource.ObjectOption) *servingv1.Service
- func NewMTAdapterDeployment(src v1alpha1.EventSource, opts ...resource.ObjectOption) *appsv1.Deployment
- func NewMTAdapterKnService(src v1alpha1.EventSource, opts ...resource.ObjectOption) *servingv1.Service
- func OwnByServiceAccount(obj metav1.Object, owner *corev1.ServiceAccount)
- type AdapterDeploymentBuilder
- type AdapterServiceBuilder
- type GenericDeploymentReconciler
- type GenericRBACReconciler
- type GenericServiceReconciler
- type RBACOwnersLister
Constants ¶
const ( EnvName = "NAME" EnvNamespace = "NAMESPACE" // Common Azure attributes EnvTenantID = "AZURE_TENANT_ID" EnvClientID = "AZURE_CLIENT_ID" EnvClientSecret = "AZURE_CLIENT_SECRET" EnvConnStr = "AZURE_CONN_STR" // Azure EventHub auth attributes EnvHubName = "AZURE_HUB_NAME" EnvHubNamespace = "AZURE_HUB_NAMESPACE" EnvHubKeyName = "EVENTHUB_KEY_NAME" EnvHubKeyValue = "EVENTHUB_KEY_VALUE" // Bridge identifier for stateful flows EnvBridgeIdentifier = "BRIDGE_IDENTIFIER" )
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" // ReasonInvalidSpec indicates that spec of a reconciled object is invalid. ReasonInvalidSpec = "InvalidSpec" )
Reasons for API Events
Variables ¶
This section is empty.
Functions ¶
func CommonObjectLabels ¶ added in v1.4.0
func CommonObjectLabels(src kmeta.OwnerRefable) labels.Set
CommonObjectLabels returns a set of labels which are always applied to objects reconciled for the given source type.
func ComponentName ¶ added in v1.4.0
func ComponentName(src kmeta.OwnerRefable) string
ComponentName returns the component name for the given source object.
func CreateCloudEventAttributes ¶ added in v0.4.1
func CreateCloudEventAttributes(source string, eventTypes []string) []duckv1.CloudEventAttributes
CreateCloudEventAttributes returns CloudEvent attributes for the event types supported by the source.
func EnqueueObjectsInNamespaceOf ¶ added in v1.4.0
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 GetStatefulBridgeID ¶ added in v1.1.0
GetStatefulBridgeID returns the BridgeID based on an object metadata.
All bridge components controlled by Triggerflow have labels informing their relation with the bridges they are part of. A component can only have one dominant bridge, which is the one it synchronizes with. This function uses that label to retrieve the bridge name and use it as unique ID.
func MTAdapterObjectName ¶ added in v1.4.0
func MTAdapterObjectName(src kmeta.OwnerRefable) string
MTAdapterObjectName returns a unique name to apply to all objects related to the given source's multi-tenant adapter (RBAC, Deployment/KnService, ...).
func MaybeAppendValueFromEnvVar ¶ added in v1.3.0
func MaybeAppendValueFromEnvVar(envs []corev1.EnvVar, key string, valueFrom v1alpha1.ValueFromField) []corev1.EnvVar
MaybeAppendValueFromEnvVar conditionally appends an EnvVar to env based on the contents of valueFrom. ValueFromSecret takes precedence over Value in case the API didn't reject the object despite the CRD's schema validation
func NewAdapterDeployment ¶ added in v1.3.0
func NewAdapterDeployment(src v1alpha1.EventSource, sinkURI *apis.URL, opts ...resource.ObjectOption) *appsv1.Deployment
NewAdapterDeployment is a wrapper around resource.NewDeployment which pre-populates attributes common to all adapters backed by a Deployment.
func NewAdapterKnService ¶ added in v1.3.0
func NewAdapterKnService(src v1alpha1.EventSource, sinkURI *apis.URL, opts ...resource.ObjectOption) *servingv1.Service
NewAdapterKnService is a wrapper around resource.NewKnService which pre-populates attributes common to all adapters backed by a Knative Service.
func NewMTAdapterDeployment ¶ added in v1.4.0
func NewMTAdapterDeployment(src v1alpha1.EventSource, opts ...resource.ObjectOption) *appsv1.Deployment
NewMTAdapterDeployment is a wrapper around resource.NewDeployment which pre-populates attributes common to all multi-tenant adapters backed by a Deployment.
func NewMTAdapterKnService ¶ added in v1.4.0
func NewMTAdapterKnService(src v1alpha1.EventSource, opts ...resource.ObjectOption) *servingv1.Service
NewMTAdapterKnService is a wrapper around resource.NewKnService which pre-populates attributes common to all multi-tenant adapters backed by a Knative Service.
func OwnByServiceAccount ¶ added in v1.4.0
func OwnByServiceAccount(obj metav1.Object, owner *corev1.ServiceAccount)
OwnByServiceAccount sets the owner of obj to the given ServiceAccount.
Types ¶
type AdapterDeploymentBuilder ¶ added in v1.3.0
type AdapterDeploymentBuilder interface { RBACOwnersLister BuildAdapter(src v1alpha1.EventSource, sinkURI *apis.URL) *appsv1.Deployment }
AdapterDeploymentBuilder provides all the necessary information for building objects related to a source's adapter backed by a Deployment.
type AdapterServiceBuilder ¶ added in v1.3.0
type AdapterServiceBuilder interface { RBACOwnersLister BuildAdapter(src v1alpha1.EventSource, sinkURI *apis.URL) *servingv1.Service }
AdapterServiceBuilder provides all the necessary information for building objects related to a source's adapter backed by a Knative Service.
type GenericDeploymentReconciler ¶
type GenericDeploymentReconciler struct { // URI resolver for sinks SinkResolver *resolver.URIResolver // API clients Client func(namespace string) appsclientv1.DeploymentInterface PodClient func(namespace string) coreclientv1.PodInterface // objects listers Lister func(namespace string) appslistersv1.DeploymentNamespaceLister *GenericRBACReconciler }
GenericDeploymentReconciler contains interfaces shared across Deployment reconcilers.
func NewGenericDeploymentReconciler ¶
func NewGenericDeploymentReconciler(ctx context.Context, gvk schema.GroupVersionKind, resolverCallback func(types.NamespacedName), adapterHandlerFn func(obj interface{}), ) GenericDeploymentReconciler
NewGenericDeploymentReconciler creates a new GenericDeploymentReconciler and attaches a default event handler to its Deployment informer.
func (*GenericDeploymentReconciler) ReconcileSource ¶
func (r *GenericDeploymentReconciler) ReconcileSource(ctx context.Context, ab AdapterDeploymentBuilder) reconciler.Event
ReconcileSource reconciles an event source type.
type GenericRBACReconciler ¶ added in v1.3.0
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 ¶ added in v1.4.0
func NewGenericRBACReconciler(ctx context.Context) *GenericRBACReconciler
NewGenericRBACReconciler creates a new GenericRBACReconciler.
type GenericServiceReconciler ¶ added in v1.2.0
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 NewGenericServiceReconciler ¶ added in v1.2.0
func NewGenericServiceReconciler(ctx context.Context, gvk schema.GroupVersionKind, resolverCallback func(types.NamespacedName), adapterHandlerFn func(obj interface{}), ) GenericServiceReconciler
NewGenericServiceReconciler creates a new GenericServiceReconciler and attaches a default event handler to its Service informer.
func NewMTGenericServiceReconciler ¶ added in v1.4.0
func NewMTGenericServiceReconciler(ctx context.Context, typ kmeta.OwnerRefable, resolverCallback func(types.NamespacedName), 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) ReconcileSource ¶ added in v1.2.0
func (r *GenericServiceReconciler) ReconcileSource(ctx context.Context, ab AdapterServiceBuilder) reconciler.Event
ReconcileSource reconciles an event source type.
type RBACOwnersLister ¶ added in v1.3.0
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. |