common

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package common contains constants shared by reconcilers.

Index

Constants

View Source
const (
	// Knative attributes
	EnvName      = "NAME"
	EnvNamespace = "NAMESPACE"
	EnvSink      = "K_SINK"

	// 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"
)

Common environment variables propagated to adapters.

View Source
const (
	// 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

View Source
const (
	// AppNameLabel is the name of the application.
	AppNameLabel = "app.kubernetes.io/name"
	// AppInstanceLabel is a unique name identifying the instance of an application.
	AppInstanceLabel = "app.kubernetes.io/instance"
	// AppVersionLabel is the current version of the application.
	AppVersionLabel = "app.kubernetes.io/version"
	// AppComponentLabel is the component within the architecture.
	AppComponentLabel = "app.kubernetes.io/component"
	// AppPartOfLabel is the name of a higher level application this one is part of.
	AppPartOfLabel = "app.kubernetes.io/part-of"
	// AppManagedByLabel is the tool being used to manage the operation of an application.
	AppManagedByLabel = "app.kubernetes.io/managed-by"
)

Kubernetes recommended labels https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/

View Source
const (
	PartOf           = "event-sources"
	ManagedBy        = "event-sources-controller"
	AdapterComponent = "adapter"
)

Common label values

Variables

This section is empty.

Functions

func AdapterName added in v0.5.0

func AdapterName(o kmeta.OwnerRefable) string

AdapterName returns the adapter's 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.

Types

type AdapterDeploymentBuilderFunc

type AdapterDeploymentBuilderFunc func(sinkURI *apis.URL) *appsv1.Deployment

AdapterDeploymentBuilderFunc builds a Deployment object for a source's adapter.

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
}

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) FindAdapter added in v0.5.0

FindAdapter returns the adapter Deployment for a given source if it exists.

func (*GenericDeploymentReconciler) ReconcileSource

ReconcileSource reconciles an event source type.

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.

Jump to

Keyboard shortcuts

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