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", "channelTemplate": map[string]interface{}{ "apiVersion": "channelimpl/v1", "kind": "mychannel", "spec": map[string]string{ "thing1": "value1", "thing2": "value2", }, }, "steps": []map[string]interface{}{{ "ref": map[string]string{ "apiVersion": "step0-api", "kind": "step0-kind", "name": "step0", "namespace": "bar", }, "uri": "/extra/path", }, { "ref": map[string]string{ "apiVersion": "step1-api", "kind": "step1-kind", "name": "step1", "namespace": "bar", }, "uri": "/extra/path", }}, "reply": map[string]interface{}{ "ref": map[string]string{ "apiVersion": "reply-api", "kind": "reply-kind", "name": "reply", "namespace": "bar", }, "uri": "/extra/path", }, } files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: flows.knative.dev/v1 kind: Sequence metadata: name: foo namespace: bar spec: channelTemplate: apiVersion: channelimpl/v1 kind: mychannel spec: thing1: value1 thing2: value2 steps: - ref: kind: step0-kind namespace: bar name: step0 apiVersion: step0-api uri: /extra/path - ref: kind: step1-kind namespace: bar name: step1 apiVersion: step1-api uri: /extra/path reply: ref: kind: reply-kind namespace: bar name: reply apiVersion: reply-api uri: /extra/path
Example (FullDelivery) ¶
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", "channelTemplate": map[string]interface{}{ "apiVersion": "channelimpl/v1", "kind": "mychannel", "spec": map[string]interface{}{ "delivery": map[string]interface{}{ "retry": 8, }, "thing2": "value2", }, }, "steps": []map[string]interface{}{{ "ref": map[string]string{ "apiVersion": "step0-api", "kind": "step0-kind", "name": "step0", "namespace": "bar", }, "uri": "/extra/path", }, { "ref": map[string]string{ "apiVersion": "step1-api", "kind": "step1-kind", "name": "step1", "namespace": "bar", }, "uri": "/extra/path", }}, "reply": map[string]interface{}{ "ref": map[string]string{ "apiVersion": "reply-api", "kind": "reply-kind", "name": "reply", "namespace": "bar", }, "uri": "/extra/path", }, } files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: flows.knative.dev/v1 kind: Sequence metadata: name: foo namespace: bar spec: channelTemplate: apiVersion: channelimpl/v1 kind: mychannel spec: delivery: retry: 8 thing2: value2 steps: - ref: kind: step0-kind namespace: bar name: step0 apiVersion: step0-api uri: /extra/path - ref: kind: step1-kind namespace: bar name: step1 apiVersion: step1-api uri: /extra/path reply: ref: kind: reply-kind namespace: bar name: reply apiVersion: reply-api 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", } files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: flows.knative.dev/v1 kind: Sequence metadata: name: foo namespace: bar spec: steps:
Example (WithReply) ¶
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/sequence" ) //go:embed *.yaml var yaml embed.FS func main() { ctx := testlog.NewContext() images := map[string]string{} cfg := map[string]interface{}{ "name": "foo", "namespace": "bar", } sequence.WithReply(&v1.KReference{ Kind: "repkind", APIVersion: "repversion", Name: "repname", }, "/extra/path")(cfg) files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: flows.knative.dev/v1 kind: Sequence metadata: name: foo namespace: bar spec: steps: reply: ref: kind: repkind namespace: bar name: repname apiVersion: repversion uri: /extra/path
Example (WithStep) ¶
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/sequence" ) //go:embed *.yaml var yaml embed.FS func main() { ctx := testlog.NewContext() images := map[string]string{} cfg := map[string]interface{}{ "name": "foo", "namespace": "bar", } sequence.WithStep(&v1.KReference{ Kind: "step0-kind", APIVersion: "step0-api", Namespace: "bar", Name: "step0name", }, "/extra/path")(cfg) sequence.WithStep(&v1.KReference{ Kind: "step1-kind", APIVersion: "step1-api", Namespace: "bar", Name: "step1name", }, "")(cfg) sequence.WithStep(nil, "http://full/path")(cfg) files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: flows.knative.dev/v1 kind: Sequence metadata: name: foo namespace: bar spec: steps: - ref: kind: step0-kind namespace: bar name: step0name apiVersion: step0-api uri: /extra/path - ref: kind: step1-kind namespace: bar name: step1name apiVersion: step1-api - uri: http://full/path
Index ¶
- func Address(ctx context.Context, name string, timings ...time.Duration) (*apis.URL, error)
- func AsRef(name string) *duckv1.KReference
- func GVK() schema.GroupVersionKind
- func GVR() schema.GroupVersionResource
- func Install(name string, opts ...manifest.CfgFn) feature.StepFn
- func IsAddressable(name string, timing ...time.Duration) feature.StepFn
- func IsReady(name string, timing ...time.Duration) feature.StepFn
- func WithChannelTemplate(template ChannelTemplate) manifest.CfgFn
- func WithReply(ref *duckv1.KReference, uri string) manifest.CfgFn
- func WithStep(ref *duckv1.KReference, uri string) manifest.CfgFn
- type ChannelTemplate
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsRef ¶
func AsRef(name string) *duckv1.KReference
AsRef returns a KRef for a Parallel without namespace.
func GVK ¶
func GVK() schema.GroupVersionKind
func GVR ¶
func GVR() schema.GroupVersionResource
func IsAddressable ¶
IsAddressable tests to see if a Parallel becomes addressable within the time given.
func WithChannelTemplate ¶ added in v0.25.4
func WithChannelTemplate(template ChannelTemplate) manifest.CfgFn
WithChannelTemplate adds the top level channel references.
Types ¶
type ChannelTemplate ¶ added in v0.25.4
Click to show internal directories.
Click to hide internal directories.