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",
"schedule": "*/1 * * * *",
"contentType": "application/json",
"data": `{"message": "Hello world!"}`,
"sink": map[string]interface{}{
"ref": map[string]string{
"kind": "sinkkind",
"namespace": "sinknamespace",
"name": "sinkname",
"apiVersion": "sinkversion",
},
"uri": "uri/parts",
},
}
files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
if err != nil {
panic(err)
}
manifest.OutputYAML(os.Stdout, files)
}
Output: apiVersion: sources.knative.dev/v1 kind: PingSource metadata: name: foo namespace: bar spec: schedule: '*/1 * * * *' contentType: 'application/json' data: '{"message": "Hello world!"}' sink: ref: kind: sinkkind namespace: sinknamespace name: sinkname apiVersion: sinkversion uri: uri/parts
Example (Fullbase64) ¶
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",
"schedule": "*/1 * * * *",
"contentType": "application/json",
"dataBase64": "aabbccddeeff",
"sink": map[string]interface{}{
"ref": map[string]string{
"kind": "sinkkind",
"namespace": "sinknamespace",
"name": "sinkname",
"apiVersion": "sinkversion",
},
"uri": "uri/parts",
"CACerts": "xyz",
},
}
files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
if err != nil {
panic(err)
}
manifest.OutputYAML(os.Stdout, files)
}
Output: apiVersion: sources.knative.dev/v1 kind: PingSource metadata: name: foo namespace: bar spec: schedule: '*/1 * * * *' contentType: 'application/json' dataBase64: 'aabbccddeeff' sink: ref: kind: sinkkind namespace: sinknamespace name: sinkname apiVersion: sinkversion uri: uri/parts CACerts: |- xyz
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",
}
files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
if err != nil {
panic(err)
}
manifest.OutputYAML(os.Stdout, files)
}
Output: apiVersion: sources.knative.dev/v1 kind: PingSource metadata: name: foo namespace: bar spec:
Example (Schedule_with_secs) ¶
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",
"schedule": "10 0/5 * * * ?",
"contentType": "application/json",
"data": `{"message": "Hello world!"}`,
"sink": map[string]interface{}{
"ref": map[string]string{
"kind": "sinkkind",
"namespace": "sinknamespace",
"name": "sinkname",
"apiVersion": "sinkversion",
},
"uri": "uri/parts",
},
}
files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
if err != nil {
panic(err)
}
manifest.OutputYAML(os.Stdout, files)
}
Output: apiVersion: sources.knative.dev/v1 kind: PingSource metadata: name: foo namespace: bar spec: schedule: '10 0/5 * * * ?' contentType: 'application/json' data: '{"message": "Hello world!"}' sink: ref: kind: sinkkind namespace: sinknamespace name: sinkname apiVersion: sinkversion uri: uri/parts
Index ¶
- func Gvr() schema.GroupVersionResource
- func Install(name string, opts ...manifest.CfgFn) feature.StepFn
- func IsReady(name string, timings ...time.Duration) feature.StepFn
- func WithData(contentType, data string) manifest.CfgFn
- func WithDataBase64(contentType, dataBase64 string) manifest.CfgFn
- func WithSchedule(schedule string) manifest.CfgFn
- func WithSink(dest *duckv1.Destination) manifest.CfgFn
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gvr ¶
func Gvr() schema.GroupVersionResource
func WithDataBase64 ¶
WithDataBase64 adds the contentType and dataBase64 config to a PingSource spec.
func WithSchedule ¶ added in v0.34.5
WithSchedule add the schedule config to a Pingsource spec.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.