Documentation ¶
Index ¶
- Constants
- func AddOrUpdateAddressableHandler(cfg eventingtls.ClientConfig, addressable duckv1.Addressable)
- func ConfigureConnectionArgs(ca *ConnectionArgs)
- func CreateHandler(handler http.Handler) http.Handler
- func DeleteAddressableHandler(addressable duckv1.Addressable)
- func SelectiveRetry(_ context.Context, response *http.Response, err error) (bool, error)
- func SetClientCleanupInterval(cleanupInterval time.Duration, forceRestart bool)
- func WithShutdownTimeout(ctx context.Context, timeout time.Duration) context.Context
- type Backoff
- type CheckRetry
- type ConnectionArgs
- type DispatchInfo
- type Dispatcher
- type HTTPEventReceiver
- type HTTPEventReceiverOption
- func WithChecker(checker http.HandlerFunc) HTTPEventReceiverOption
- func WithDrainQuietPeriod(duration time.Duration) HTTPEventReceiverOption
- func WithReadTimeout(duration time.Duration) HTTPEventReceiverOption
- func WithTLSConfig(cfg *tls.Config) HTTPEventReceiverOption
- func WithWriteTimeout(duration time.Duration) HTTPEventReceiverOption
- type RetryConfig
- type SendOption
- func WithDeadLetterSink(dls *duckv1.Addressable) SendOption
- func WithEventFormat(format *v1.FormatType) SendOption
- func WithEventTypeAutoHandler(handler *eventtype.EventTypeAutoHandler, ref *duckv1.KReference, ...) SendOption
- func WithHeader(header http.Header) SendOption
- func WithOIDCAuthentication(serviceAccount *types.NamespacedName) SendOption
- func WithReply(reply *duckv1.Addressable) SendOption
- func WithRetryConfig(retryConfig *RetryConfig) SendOption
- func WithTransformers(transformers ...binding.Transformer) SendOption
Constants ¶
const ( // noDuration signals that the dispatch step hasn't started NoDuration = -1 NoResponse = -1 )
const (
DefaultShutdownTimeout = time.Minute * 1
)
Variables ¶
This section is empty.
Functions ¶
func AddOrUpdateAddressableHandler ¶ added in v0.38.0
func AddOrUpdateAddressableHandler(cfg eventingtls.ClientConfig, addressable duckv1.Addressable)
func ConfigureConnectionArgs ¶ added in v0.17.9
func ConfigureConnectionArgs(ca *ConnectionArgs)
ConfigureConnectionArgs configures the new connection args. Use sparingly, because it might lead to creating a lot of clients, none of them sharing their connection pool!
func DeleteAddressableHandler ¶ added in v0.38.0
func DeleteAddressableHandler(addressable duckv1.Addressable)
func SelectiveRetry ¶ added in v0.21.0
SelectiveRetry is an alternative function to determine whether to retry based on response
Note - Returning true indicates a retry should occur. Returning an error will result in that
error being returned instead of any errors from the Request.
A retry is triggered for: * nil responses * emitted errors * status codes that are 5XX, 404, 408, 409, 429 as well if the statuscode is -1.
func SetClientCleanupInterval ¶ added in v0.38.0
SetClientCleanupInterval sets the interval before the clients map is re-checked for expired entries. forceRestart will force the loop to restart with the new interval, cancelling the current iteration.
Types ¶
type Backoff ¶ added in v0.17.0
Backoff specifies a policy for how long to wait between retries. It is called after a failing request to determine the amount of time that should pass before trying again.
type CheckRetry ¶ added in v0.17.0
CheckRetry specifies a policy for handling retries. It is called following each request with the response and error values returned by the http.Client. If CheckRetry returns false, the Client stops retrying and returns the response to the caller. If CheckRetry returns an error, that error value is returned in lieu of the error from the request. The Client will close any response body when retrying, but if the retry is aborted it is up to the CheckRetry callback to properly close any response body before returning.
type ConnectionArgs ¶ added in v0.10.0
type ConnectionArgs struct { // MaxIdleConns refers to the max idle connections, as in net/http/transport. MaxIdleConns int // MaxIdleConnsPerHost refers to the max idle connections per host, as in net/http/transport. MaxIdleConnsPerHost int }
ConnectionArgs allow to configure connection parameters to the underlying HTTP Client transport.
type DispatchInfo ¶ added in v0.39.0
type Dispatcher ¶ added in v0.39.0
type Dispatcher struct {
// contains filtered or unexported fields
}
func NewDispatcher ¶ added in v0.39.0
func NewDispatcher(clientConfig eventingtls.ClientConfig, oidcTokenProvider *auth.OIDCTokenProvider) *Dispatcher
func (*Dispatcher) SendEvent ¶ added in v0.39.0
func (d *Dispatcher) SendEvent(ctx context.Context, event event.Event, destination duckv1.Addressable, options ...SendOption) (*DispatchInfo, error)
SendEvent sends the given event to the given destination.
func (*Dispatcher) SendMessage ¶ added in v0.39.0
func (d *Dispatcher) SendMessage(ctx context.Context, message binding.Message, destination duckv1.Addressable, options ...SendOption) (*DispatchInfo, error)
SendMessage sends the given message to the given destination. SendMessage is kept for compatibility and SendEvent should be used whenever possible.
type HTTPEventReceiver ¶ added in v0.39.0
type HTTPEventReceiver struct { // Used to signal when receiver is listening Ready chan interface{} // contains filtered or unexported fields }
func NewHTTPEventReceiver ¶ added in v0.39.0
func NewHTTPEventReceiver(port int, o ...HTTPEventReceiverOption) *HTTPEventReceiver
func (*HTTPEventReceiver) GetAddr ¶ added in v0.39.0
func (recv *HTTPEventReceiver) GetAddr() string
func (*HTTPEventReceiver) StartListen ¶ added in v0.39.0
Blocking
type HTTPEventReceiverOption ¶ added in v0.39.0
type HTTPEventReceiverOption func(*HTTPEventReceiver)
HTTPEventReceiverOption enables further configuration of a HTTPEventReceiver.
func WithChecker ¶ added in v0.21.0
func WithChecker(checker http.HandlerFunc) HTTPEventReceiverOption
WithChecker takes a handler func which will run as an additional health check in Drainer. kncloudevents HTTPEventReceiver uses Drainer to perform health check. By default, Drainer directly writes StatusOK to kubelet probe if the Pod is not draining. Users can configure customized liveness and readiness check logic by defining checker here.
func WithDrainQuietPeriod ¶ added in v0.22.0
func WithDrainQuietPeriod(duration time.Duration) HTTPEventReceiverOption
WithDrainQuietPeriod configures the QuietPeriod for the Drainer.
func WithReadTimeout ¶ added in v0.34.0
func WithReadTimeout(duration time.Duration) HTTPEventReceiverOption
WithReadTimeout sets the HTTP server's ReadTimeout. It covers the duration from reading the entire request (Headers + Body)
func WithTLSConfig ¶ added in v0.37.0
func WithTLSConfig(cfg *tls.Config) HTTPEventReceiverOption
WithTLSConfig configures the TLS config for the receiver.
func WithWriteTimeout ¶ added in v0.34.0
func WithWriteTimeout(duration time.Duration) HTTPEventReceiverOption
WithWriteTimeout sets the HTTP server's WriteTimeout. It covers the time between end of reading Request Header to end of writing response.
type RetryConfig ¶ added in v0.17.0
type RetryConfig struct { // Maximum number of retries RetryMax int // These next two variables are just copied from the original DeliverySpec so // we can detect if anything has changed. We can not do that with the CheckRetry // Backoff (at least not easily). BackoffDelay *string BackoffPolicy *v1.BackoffPolicyType CheckRetry CheckRetry Backoff Backoff // RequestTimeout represents the timeout of the single request RequestTimeout time.Duration // RetryAfterMaxDuration represents an optional override for the maximum // value allowed for "Retry-After" headers in 429 / 503 responses. A nil // value indicates no maximum override. A value of "0" indicates "Retry-After" // headers are to be ignored. RetryAfterMaxDuration *time.Duration }
func NoRetries ¶ added in v0.17.0
func NoRetries() RetryConfig
func RetryConfigFromDeliverySpec ¶ added in v0.17.0
func RetryConfigFromDeliverySpec(spec v1.DeliverySpec) (RetryConfig, error)
type SendOption ¶ added in v0.39.0
type SendOption func(*senderConfig) error
func WithDeadLetterSink ¶ added in v0.39.0
func WithDeadLetterSink(dls *duckv1.Addressable) SendOption
func WithEventFormat ¶ added in v0.43.0
func WithEventFormat(format *v1.FormatType) SendOption
func WithEventTypeAutoHandler ¶ added in v0.41.0
func WithEventTypeAutoHandler(handler *eventtype.EventTypeAutoHandler, ref *duckv1.KReference, ownerUID types.UID) SendOption
func WithHeader ¶ added in v0.39.0
func WithHeader(header http.Header) SendOption
func WithOIDCAuthentication ¶ added in v0.39.0
func WithOIDCAuthentication(serviceAccount *types.NamespacedName) SendOption
func WithReply ¶ added in v0.39.0
func WithReply(reply *duckv1.Addressable) SendOption
func WithRetryConfig ¶ added in v0.39.0
func WithRetryConfig(retryConfig *RetryConfig) SendOption
func WithTransformers ¶ added in v0.39.0
func WithTransformers(transformers ...binding.Transformer) SendOption