delivery

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Example (Full)
package main

import (
	"embed"
	"os"

	testlog "knative.dev/reconciler-test/pkg/logging"
	"knative.dev/reconciler-test/pkg/manifest"
)

//go:embed *.yaml
var yaml embed.FS

func main() {
	ctx := testlog.NewContext()
	images := map[string]string{}
	cfg := map[string]interface{}{
		"namespace": "bar",
		"delivery": map[string]interface{}{
			"retry":         "42",
			"backoffPolicy": "exponential",
			"backoffDelay":  "2007-03-01T13:00:00Z/P1Y2M10DT2H30M",
			"deadLetterSink": map[string]interface{}{
				"ref": map[string]string{
					"kind":       "deadkind",
					"name":       "deadname",
					"apiVersion": "deadapi",
				},
				"uri": "/extra/path",
			},
		},
	}

	files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
	if err != nil {
		panic(err)
	}

	manifest.OutputYAML(os.Stdout, files)
}
Output:

spec:
  delivery:
    deadLetterSink:
      ref:
        kind: deadkind
        namespace: bar
        name: deadname
        apiVersion: deadapi
      uri: /extra/path
    retry: 42
    backoffPolicy: exponential
    backoffDelay: "2007-03-01T13:00:00Z/P1Y2M10DT2H30M"
Example (Min)
package main

import (
	"embed"
	"os"

	testlog "knative.dev/reconciler-test/pkg/logging"
	"knative.dev/reconciler-test/pkg/manifest"
)

//go:embed *.yaml
var yaml embed.FS

func main() {
	ctx := testlog.NewContext()
	images := map[string]string{}
	cfg := map[string]interface{}{}

	files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
	if err != nil {
		panic(err)
	}

	manifest.OutputYAML(os.Stdout, files)
}
Output:

spec:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDeadLetterSink

func WithDeadLetterSink(ref *duckv1.KReference, uri string) manifest.CfgFn

WithDeadLetterSink adds the dead letter sink related config to the config.

Example
package main

import (
	"embed"
	"os"

	"knative.dev/eventing/test/rekt/resources/broker"

	v1 "knative.dev/pkg/apis/duck/v1"

	testlog "knative.dev/reconciler-test/pkg/logging"
	"knative.dev/reconciler-test/pkg/manifest"
)

//go:embed *.yaml
var yaml embed.FS

func main() {
	ctx := testlog.NewContext()
	images := map[string]string{}
	cfg := map[string]interface{}{
		"namespace": "bar",
	}
	broker.WithDeadLetterSink(&v1.KReference{
		Kind:       "deadkind",
		Name:       "deadname",
		APIVersion: "deadapi",
	}, "/extra/path")(cfg)

	files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
	if err != nil {
		panic(err)
	}

	manifest.OutputYAML(os.Stdout, files)
}
Output:

spec:
  delivery:
    deadLetterSink:
      ref:
        kind: deadkind
        namespace: bar
        name: deadname
        apiVersion: deadapi
      uri: /extra/path

func WithDeadLetterSinkFromDestination added in v0.40.0

func WithDeadLetterSinkFromDestination(dest *duckv1.Destination) manifest.CfgFn

WithDeadLetterSink adds the dead letter sink related config to the config.

func WithRetry

func WithRetry(count int32, backoffPolicy *eventingv1.BackoffPolicyType, backoffDelay *string) manifest.CfgFn

WithRetry adds the retry related config to the config.

Example
package main

import (
	"embed"
	"os"

	eventingv1 "knative.dev/eventing/pkg/apis/duck/v1"
	"knative.dev/eventing/test/rekt/resources/broker"
	"knative.dev/pkg/ptr"

	testlog "knative.dev/reconciler-test/pkg/logging"
	"knative.dev/reconciler-test/pkg/manifest"
)

//go:embed *.yaml
var yaml embed.FS

func main() {
	ctx := testlog.NewContext()
	images := map[string]string{}
	cfg := map[string]interface{}{}
	exp := eventingv1.BackoffPolicyExponential
	broker.WithRetry(42, &exp, ptr.String("2007-03-01T13:00:00Z/P1Y2M10DT2H30M"))(cfg)

	files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
	if err != nil {
		panic(err)
	}

	manifest.OutputYAML(os.Stdout, files)
}
Output:

spec:
  delivery:
    retry: 42
    backoffPolicy: exponential
    backoffDelay: "2007-03-01T13:00:00Z/P1Y2M10DT2H30M"
Example (OnlyCount)
package main

import (
	"embed"
	"os"

	"knative.dev/eventing/test/rekt/resources/broker"

	testlog "knative.dev/reconciler-test/pkg/logging"
	"knative.dev/reconciler-test/pkg/manifest"
)

//go:embed *.yaml
var yaml embed.FS

func main() {
	ctx := testlog.NewContext()
	images := map[string]string{}
	cfg := map[string]interface{}{}
	broker.WithRetry(42, nil, nil)(cfg)

	files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
	if err != nil {
		panic(err)
	}

	manifest.OutputYAML(os.Stdout, files)
}
Output:

spec:
  delivery:
    retry: 42

func WithTimeout added in v0.24.3

func WithTimeout(timeout string) manifest.CfgFn

WithTimeout adds the timeout related config to the config.

Types

This section is empty.

Jump to

Keyboard shortcuts

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