provisioners

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PortName   = "http"
	PortNumber = 80
	// EventingChannelLabel carries the name of knative's label for the channel
	EventingChannelLabel = "eventing.knative.dev/channel"
	// EventingProvisionerLabel carries the name of knative's label for the provisioner
	EventingProvisionerLabel = "eventing.knative.dev/provisioner"

	// OldEventingChannelLabel carries the name of knative's old label for the channel
	OldEventingChannelLabel = "channel"
	// OldEventingProvisionerLabel carries the name of knative's old label for the provisioner
	OldEventingProvisionerLabel = "provisioner"
)
View Source
const (
	FinalizerAlreadyPresent AddFinalizerResult    = false
	FinalizerAdded          AddFinalizerResult    = true
	FinalizerRemoved        RemoveFinalizerResult = true
	FinalizerNotFound       RemoveFinalizerResult = false
)
View Source
const (
	// MessageHistoryHeader is the header containing all channel hosts traversed by the message
	// This is an experimental header: https://github.com/knative/eventing/issues/638
	MessageHistoryHeader    = "ce-knativehistory"
	MessageHistorySeparator = "; "
)
View Source
const (
	// MessageReceiverPort is the port that MessageReceiver opens an HTTP server on.
	MessageReceiverPort = 8080
)

Variables

View Source
var ErrUnknownChannel = errors.New("unknown channel")

ErrUnknownChannel is returned when a message is received by a channel dispatcher for a channel that does not exist.

Functions

func DispatcherLabels

func DispatcherLabels(ccpName string) map[string]string

func NewHostNameToChannelRefMap added in v0.6.0

func NewHostNameToChannelRefMap(cList []eventingv1alpha1.Channel) (map[string]ChannelReference, error)

NewHostNameToChannelRefMap parses each channel from cList and creates a map[string(Status.Address.HostName)]ChannelReference

func NewLoggingConfig

func NewLoggingConfig() *logging.Config

NewLoggingConfig creates a static logging configuration appropriate for a provisioner. All logging levels are set to Info.

func NewProvisionerLoggerFromConfig

func NewProvisionerLoggerFromConfig(config *logging.Config) *zap.SugaredLogger

NewProvisionerLoggerFromConfig creates a new zap logger for the provisioner component based on the provided configuration

func UpdateChannel

func UpdateChannel(ctx context.Context, client runtimeClient.Client, u *eventingv1alpha1.Channel) error

Types

type AddFinalizerResult added in v0.3.0

type AddFinalizerResult bool

AddFinalizerResult is used to indicate whether a finalizer was added or already present.

func AddFinalizer

func AddFinalizer(o metav1.Object, finalizerName string) AddFinalizerResult

AddFinalizer adds finalizerName to the Object.

type ChannelReference added in v0.2.1

type ChannelReference struct {
	Namespace string
	Name      string
}

ChannelReference references a Channel within the cluster by name and namespace.

func ParseChannel added in v0.2.1

func ParseChannel(host string) (ChannelReference, error)

ParseChannel converts the channel's hostname into a channel reference.

func (*ChannelReference) String added in v0.2.1

func (r *ChannelReference) String() string

type DispatchDefaults added in v0.2.1

type DispatchDefaults struct {
	Namespace string
}

DispatchDefaults provides default parameter values used when dispatching a message.

type Dispatcher added in v0.3.0

type Dispatcher interface {
	// DispatchMessage dispatches a message to a destination over HTTP.
	//
	// The destination and reply are DNS names. For names with a single label,
	// the default namespace is used to expand it into a fully qualified name
	// within the cluster.
	DispatchMessage(message *Message, destination, reply string, defaults DispatchDefaults) error
}

type K8sServiceOption added in v0.6.0

type K8sServiceOption func(*corev1.Service) error

K8sServiceOption is a functional option that can modify the K8s Service in CreateK8sService

func ExternalService added in v0.6.0

func ExternalService(c *eventingv1alpha1.Channel) K8sServiceOption

ExternalService is a functional option for CreateK8sService to create a K8s service of type ExternalName.

type Message added in v0.2.1

type Message struct {
	// Headers provide metadata about the message payload. All header keys
	// should be lowercase.
	Headers map[string]string `json:"headers,omitempty"`

	// Payload is the raw binary content of the message. The payload format is
	// often described by the 'content-type' header.
	Payload []byte `json:"payload,omitempty"`
}

Message represents a chunk of data within a channel dispatcher. The message contains both a map of string headers and a binary payload. This struct gets marshaled/unmarshaled in order to preserve and pass Header information to the event subscriber.

A message may represent a CloudEvent.

func (*Message) AppendToHistory added in v0.4.0

func (m *Message) AppendToHistory(host string)

AppendToHistory appends a new host at the end of the list of hosts of the message history

func (*Message) History added in v0.4.0

func (m *Message) History() []string

History returns the list of hosts where the message has been into

type MessageDispatcher added in v0.2.1

type MessageDispatcher struct {
	// contains filtered or unexported fields
}

MessageDispatcher dispatches messages to a destination over HTTP.

func NewMessageDispatcher added in v0.2.1

func NewMessageDispatcher(logger *zap.SugaredLogger) *MessageDispatcher

NewMessageDispatcher creates a new message dispatcher that can dispatch messages to HTTP destinations.

func (*MessageDispatcher) DispatchMessage added in v0.2.1

func (d *MessageDispatcher) DispatchMessage(message *Message, destination, reply string, defaults DispatchDefaults) error

DispatchMessage dispatches a message to a destination over HTTP.

The destination and reply are DNS names. For names with a single label, the default namespace is used to expand it into a fully qualified name within the cluster.

type MessageReceiver added in v0.2.1

type MessageReceiver struct {
	// contains filtered or unexported fields
}

MessageReceiver starts a server to receive new messages for the channel dispatcher. The new message is emitted via the receiver function.

func NewMessageReceiver added in v0.2.1

func NewMessageReceiver(receiverFunc func(ChannelReference, *Message) error, logger *zap.SugaredLogger, opts ...ReceiverOptions) (*MessageReceiver, error)

NewMessageReceiver creates a message receiver passing new messages to the receiverFunc.

func (*MessageReceiver) HandleRequest added in v0.2.1

func (r *MessageReceiver) HandleRequest(res http.ResponseWriter, req *http.Request)

HandleRequest is an http.Handler function. The request is converted to a Message and emitted to the receiver func.

The response status codes:

202 - the message was sent to subscribers
404 - the request was for an unknown channel
500 - an error occurred processing the request

func (*MessageReceiver) Start added in v0.3.0

func (r *MessageReceiver) Start(stopCh <-chan struct{}) error

Start begings to receive messages for the receiver.

Only HTTP POST requests to the root path (/) are accepted. If other paths or methods are needed, use the HandleRequest method directly with another HTTP server.

This method will block until a message is received on the stop channel.

type ReceiverOptions added in v0.6.0

type ReceiverOptions func(*MessageReceiver) error

ReceiverOptions provides functional options to MessageReceiver function.

func ResolveChannelFromHostHeader added in v0.6.0

func ResolveChannelFromHostHeader(hostToChannelFunc ResolveChannelFromHostFunc) ReceiverOptions

ResolveChannelFromHostHeader is a ReceiverOption for NewMessageReceiver which enables the caller to overwrite the default behaviour defined by ParseChannel function.

type RemoveFinalizerResult added in v0.6.0

type RemoveFinalizerResult bool

RemoveFinalizerResult is used to indicate whether a finalizer was found and removed (FinalizerRemoved), or finalizer not found (FinalizerNotFound).

func RemoveFinalizer

func RemoveFinalizer(o metav1.Object, finalizerName string) RemoveFinalizerResult

RemoveFinalizer removes the finalizer(finalizerName) from the object(o) if the finalizer is present. Returns: - FinalizerRemoved, if the finalizer was found and removed.

  • FinalizerNotFound, if the finalizer was not found.

type ResolveChannelFromHostFunc added in v0.6.0

type ResolveChannelFromHostFunc func(string) (ChannelReference, error)

ResolveChannelFromHostFunc function enables MessageReceiver to get the Channel Reference from incoming request HostHeader before calling receiverFunc.

type ServiceOption added in v0.6.0

type ServiceOption func(*v1.Service) error

ServiceOption can be used to optionally modify the K8s default that gets created for the Dispatcher in CreateDispatcherService

Directories

Path Synopsis
Package fanout provides an http.Handler that takes in one request and fans it out to N other requests, based on a list of Subscriptions.
Package fanout provides an http.Handler that takes in one request and fans it out to N other requests, based on a list of Subscriptions.
inmemory
Package multichannelfanout provides an http.Handler that takes in one request to a Knative Channel and fans it out to N other requests.
Package multichannelfanout provides an http.Handler that takes in one request to a Knative Channel and fans it out to N other requests.
Package swappable provides an http.Handler that delegates all HTTP requests to an underlying multichannelfanout.Handler.
Package swappable provides an http.Handler that delegates all HTTP requests to an underlying multichannelfanout.Handler.

Jump to

Keyboard shortcuts

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