Documentation
¶
Overview ¶
Package common contains reconciliation helpers shared between target reconcilers.
Index ¶
- Constants
- func CommonObjectLabels(o kmeta.OwnerRefable) labels.Set
- func ComponentName(o kmeta.OwnerRefable) string
- func CreateCloudEventResponseAttributes(source string, eventTypes []string) []duckv1.CloudEventAttributes
- func EnqueueObjectsInNamespaceOf(inf cache.SharedInformer, resyncFn filteredGlobalResyncFunc, ...) func(interface{})
- func GetStatefulBridgeID(object metav1.Object) string
- func MTAdapterObjectName(o kmeta.OwnerRefable) string
- func MaybeAppendValueFromEnvVar(envs []corev1.EnvVar, key string, valueFrom v1alpha1.ValueFromField) []corev1.EnvVar
- func NewAdapterKnService(rcl v1alpha1.Reconcilable, opts ...resource.ObjectOption) *servingv1.Service
- func NewMTAdapterKnService(rcl v1alpha1.Reconcilable, opts ...resource.ObjectOption) *servingv1.Service
- func OwnByServiceAccount(obj metav1.Object, owner *corev1.ServiceAccount)
- func ServiceAccountName(rcl v1alpha1.Reconcilable) string
- type AdapterServiceBuilder
- type GenericRBACReconciler
- type GenericServiceReconciler
- type RBACOwnersLister
Constants ¶
const ( EnvName = "NAME" EnvNamespace = "NAMESPACE" // Common AWS attributes EnvARN = "ARN" EnvAccessKeyID = "AWS_ACCESS_KEY_ID" EnvSecretAccessKey = "AWS_SECRET_ACCESS_KEY" //nolint:gosec // Common Azure attributes EnvAADTenantID = "AZURE_TENANT_ID" EnvAADClientID = "AZURE_CLIENT_ID" EnvAADClientSecret = "AZURE_CLIENT_SECRET" // Azure Event Hub attributes // https://pkg.go.dev/github.com/Azure/azure-event-hubs-go/v3#readme-environment-variables EnvHubNamespace = "EVENTHUB_NAMESPACE" EnvHubName = "EVENTHUB_NAME" EnvHubKeyName = "EVENTHUB_KEY_NAME" EnvHubKeyValue = "EVENTHUB_KEY_VALUE" EnvHubConnStr = "EVENTHUB_CONNECTION_STRING" // Google Cloud EnvGCloudSAKey = "GCLOUD_SERVICEACCOUNT_KEY" )
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" // ReasonInvalidSpec indicates that spec of a reconciled object is invalid. ReasonInvalidSpec = "InvalidSpec" )
Reasons for API Events
const ( LabelBridgeUsedByPrefix = "flow.triggermesh.io/used-by." LabelValueBridgeDominant = "dominant" // Bridge identifier for stateful flows EnvBridgeID = "EVENTS_BRIDGE_IDENTIFIER" )
Stateful events related
Variables ¶
This section is empty.
Functions ¶
func CommonObjectLabels ¶ added in v1.16.0
func CommonObjectLabels(o kmeta.OwnerRefable) labels.Set
CommonObjectLabels returns a set of labels which are always applied to objects reconciled for the given component type.
func ComponentName ¶ added in v1.16.0
func ComponentName(o kmeta.OwnerRefable) string
ComponentName returns the component name for the given object.
func CreateCloudEventResponseAttributes ¶ added in v1.16.0
func CreateCloudEventResponseAttributes(source string, eventTypes []string) []duckv1.CloudEventAttributes
CreateCloudEventResponseAttributes returns the CloudEvent attributes of responses returned by the target.
func EnqueueObjectsInNamespaceOf ¶ added in v1.16.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 objects when the state of their (common) multi-tenant adapter changes.
func GetStatefulBridgeID ¶ added in v1.16.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.16.0
func MTAdapterObjectName(o kmeta.OwnerRefable) string
MTAdapterObjectName returns a unique name to apply to all objects related to the given component's multi-tenant adapter (RBAC, Deployment/KnService, ...).
func MaybeAppendValueFromEnvVar ¶
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 NewAdapterKnService ¶ added in v1.16.0
func NewAdapterKnService(rcl v1alpha1.Reconcilable, 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 NewMTAdapterKnService ¶ added in v1.16.0
func NewMTAdapterKnService(rcl v1alpha1.Reconcilable, 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.16.0
func OwnByServiceAccount(obj metav1.Object, owner *corev1.ServiceAccount)
OwnByServiceAccount sets the owner of obj to the given ServiceAccount.
func ServiceAccountName ¶ added in v1.16.0
func ServiceAccountName(rcl v1alpha1.Reconcilable) string
ServiceAccountName returns the name to set on the ServiceAccount associated with the given component instance.
Types ¶
type AdapterServiceBuilder ¶ added in v1.16.0
type AdapterServiceBuilder interface {
RBACOwnersLister
BuildAdapter(rcl v1alpha1.Reconcilable) *servingv1.Service
}
AdapterServiceBuilder provides all the necessary information for building objects related to a component's adapter backed by a Knative Service.
type GenericRBACReconciler ¶ added in v1.16.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 components adapters.
func NewGenericRBACReconciler ¶ added in v1.16.0
func NewGenericRBACReconciler(ctx context.Context) *GenericRBACReconciler
NewGenericRBACReconciler creates a new GenericRBACReconciler.
type GenericServiceReconciler ¶ added in v1.16.0
type GenericServiceReconciler struct {
// 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.16.0
func NewGenericServiceReconciler(ctx context.Context, gvk schema.GroupVersionKind, 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.16.0
func NewMTGenericServiceReconciler(ctx context.Context, typ kmeta.OwnerRefable, 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 ¶ added in v1.16.0
func (r *GenericServiceReconciler) ReconcileAdapter(ctx context.Context, ab AdapterServiceBuilder) reconciler.Event
ReconcileAdapter reconciles a receive adapter for a component instance.
type RBACOwnersLister ¶ added in v1.16.0
type RBACOwnersLister interface {
RBACOwners(rcl v1alpha1.Reconcilable) ([]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. |