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", "brokerName": "baz", "filter": map[string]interface{}{ "attributes": map[string]string{ "x": "y", "type": "z", }, }, "subscriber": map[string]interface{}{ "ref": map[string]string{ "kind": "subkind", "name": "subname", "apiVersion": "subversion", }, "uri": "/extra/path", }, } files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: eventing.knative.dev/v1 kind: Trigger metadata: name: foo namespace: bar spec: broker: baz filter: attributes: type: "z" x: "y" subscriber: ref: kind: subkind namespace: bar name: subname apiVersion: subversion uri: /extra/path
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: eventing.knative.dev/v1 kind: Trigger metadata: name: foo namespace: bar spec: broker: baz 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: eventing.knative.dev/v1 kind: Trigger metadata: name: foo namespace: bar spec:
Index ¶
- Variables
- func GVR() schema.GroupVersionResource
- func Install(name, brokerName string, opts ...manifest.CfgFn) feature.StepFn
- func IsReady(name string, timing ...time.Duration) feature.StepFn
- func WithAnnotation(key string, value string) manifest.CfgFn
- func WithFilter(attributes map[string]string) manifest.CfgFn
- func WithSubscriber(ref *duckv1.KReference, uri string) 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 Trigger spec.
View Source
var WithRetry = delivery.WithRetry
WithRetry adds the retry related config to a Trigger spec.
View Source
var WithTimeout = delivery.WithTimeout
WithTimeout adds the timeout related config to the config.
Functions ¶
func GVR ¶ added in v0.31.0
func GVR() schema.GroupVersionResource
func WithAnnotation ¶ added in v0.24.0
WithAnnotation adds an annotation to the trigger
func WithFilter ¶
WithFilter adds the filter related config to a Trigger spec.
Example ¶
package main import ( "embed" "os" "knative.dev/eventing/test/rekt/resources/trigger" 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", } trigger.WithFilter(map[string]string{ "x": "y", "type": "z", })(cfg) files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: eventing.knative.dev/v1 kind: Trigger metadata: name: foo namespace: bar spec: broker: baz filter: attributes: type: "z" x: "y"
func WithSubscriber ¶
func WithSubscriber(ref *duckv1.KReference, uri string) manifest.CfgFn
WithSubscriber adds the subscriber related config to a Trigger spec.
Example ¶
package main import ( "embed" "os" "knative.dev/eventing/test/rekt/resources/trigger" 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{}{ "name": "foo", "namespace": "bar", "brokerName": "baz", } trigger.WithSubscriber(&v1.KReference{ Kind: "subkind", Name: "subname", APIVersion: "subversion", }, "/extra/path")(cfg) files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: eventing.knative.dev/v1 kind: Trigger metadata: name: foo namespace: bar spec: broker: baz subscriber: ref: kind: subkind namespace: bar name: subname apiVersion: subversion uri: /extra/path
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.