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{}{ "name": "foo", "namespace": "bar", "subscriber": map[string]interface{}{ "ref": map[string]string{ "kind": "subkind", "name": "subname", "apiVersion": "subversion", }, "uri": "/extra/path", }, "reply": map[string]interface{}{ "ref": map[string]string{ "kind": "repkind", "name": "repname", "apiVersion": "repversion", }, "uri": "/extra/path", }, "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: apiVersion: messaging.knative.dev/v1 kind: Subscription metadata: name: foo namespace: bar spec: subscriber: ref: kind: subkind namespace: bar name: subname apiVersion: subversion uri: /extra/path reply: ref: kind: repkind namespace: bar name: repname apiVersion: repversion uri: /extra/path 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{}{ "name": "foo", "namespace": "bar", "brokerName": "baz", "subscriber": map[string]interface{}{ "ref": map[string]string{ "kind": "subkind", "name": "subname", "apiVersion": "subversion", }, }, } files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: messaging.knative.dev/v1 kind: Subscription metadata: name: foo namespace: bar spec: subscriber: ref: kind: subkind namespace: bar name: subname apiVersion: subversion
Example (Zero) ¶
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{}{ "name": "foo", "namespace": "bar", } files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: messaging.knative.dev/v1 kind: Subscription metadata: name: foo namespace: bar spec:
Index ¶
- Variables
- func AsKReference(subscriptionName string) *duckv1.KReference
- func GVR() schema.GroupVersionResource
- func Install(name string, opts ...manifest.CfgFn) feature.StepFn
- func IsReady(name string, timing ...time.Duration) feature.StepFn
- func WithChannel(ref *duckv1.KReference) manifest.CfgFn
- func WithReply(ref *duckv1.KReference, uri string) manifest.CfgFn
- func WithSubscriber(ref *duckv1.KReference, uri, audience string) manifest.CfgFn
- func WithSubscriberFromDestination(dest *duckv1.Destination) manifest.CfgFn
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WithDeadLetterSink = delivery.WithDeadLetterSink
WithDeadLetterSink adds the dead letter sink related config to a Subscription spec.
View Source
var WithDeadLetterSinkFromDestination = delivery.WithDeadLetterSinkFromDestination
WithDeadLetterSinkFromDestination adds the dead letter sink related config to the config.
View Source
var WithRetry = delivery.WithRetry
WithRetry adds the retry related config to a Subscription spec.
Functions ¶
func AsKReference ¶ added in v0.41.0
func AsKReference(subscriptionName string) *duckv1.KReference
func GVR ¶ added in v0.42.0
func GVR() schema.GroupVersionResource
func WithChannel ¶
func WithChannel(ref *duckv1.KReference) manifest.CfgFn
WithChannel adds the channel related config to a Subscription spec.
Example ¶
package main import ( "embed" "os" v1 "knative.dev/pkg/apis/duck/v1" testlog "knative.dev/reconciler-test/pkg/logging" "knative.dev/reconciler-test/pkg/manifest" "knative.dev/eventing/test/rekt/resources/subscription" ) //go:embed *.yaml var yaml embed.FS func main() { ctx := testlog.NewContext() images := map[string]string{} cfg := map[string]interface{}{ "name": "foo", "namespace": "bar", } subscription.WithChannel(&v1.KReference{ Kind: "chkind", Name: "chname", APIVersion: "chversion", })(cfg) files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: messaging.knative.dev/v1 kind: Subscription metadata: name: foo namespace: bar spec: channel: kind: chkind name: chname apiVersion: chversion
func WithReply ¶
func WithReply(ref *duckv1.KReference, uri string) manifest.CfgFn
WithSubscriber adds the subscriber related config to a Subscription spec.
Example ¶
package main import ( "embed" "os" v1 "knative.dev/pkg/apis/duck/v1" testlog "knative.dev/reconciler-test/pkg/logging" "knative.dev/reconciler-test/pkg/manifest" "knative.dev/eventing/test/rekt/resources/subscription" ) //go:embed *.yaml var yaml embed.FS func main() { ctx := testlog.NewContext() images := map[string]string{} cfg := map[string]interface{}{ "name": "foo", "namespace": "bar", } subscription.WithReply(&v1.KReference{ Kind: "repkind", Name: "repname", APIVersion: "repversion", }, "/extra/path")(cfg) files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: messaging.knative.dev/v1 kind: Subscription metadata: name: foo namespace: bar spec: reply: ref: kind: repkind namespace: bar name: repname apiVersion: repversion uri: /extra/path
func WithSubscriber ¶
func WithSubscriber(ref *duckv1.KReference, uri, audience string) manifest.CfgFn
WithSubscriber adds the subscriber related config to a Subscription spec.
Example ¶
package main import ( "embed" "os" v1 "knative.dev/pkg/apis/duck/v1" testlog "knative.dev/reconciler-test/pkg/logging" "knative.dev/reconciler-test/pkg/manifest" "knative.dev/eventing/test/rekt/resources/subscription" ) //go:embed *.yaml var yaml embed.FS func main() { ctx := testlog.NewContext() images := map[string]string{} cfg := map[string]interface{}{ "name": "foo", "namespace": "bar", } subscription.WithSubscriber(&v1.KReference{ Kind: "subkind", Name: "subname", APIVersion: "subversion", }, "/extra/path", "test-audience")(cfg) files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: messaging.knative.dev/v1 kind: Subscription metadata: name: foo namespace: bar spec: subscriber: ref: kind: subkind namespace: bar name: subname apiVersion: subversion uri: /extra/path audience: test-audience
func WithSubscriberFromDestination ¶ added in v0.38.5
func WithSubscriberFromDestination(dest *duckv1.Destination) manifest.CfgFn
WithSubscriberFromDestination adds the subscriber related config to a Trigger spec.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.