Documentation ¶
Overview ¶
Example (Full) ¶
package main import ( "embed" "os" testlog "knative.dev/reconciler-test/pkg/logging" "knative.dev/reconciler-test/pkg/manifest" "knative.dev/reconciler-test/pkg/resources/namespace" ) //go:embed *.yaml var yaml embed.FS func main() { ctx := testlog.NewContext() images := map[string]string{} cfg := map[string]interface{}{ "name": "foo", } opts := []manifest.CfgFn{ namespace.WithLabels(map[string]string{ "color": "green", }), namespace.WithAnnotations(map[string]interface{}{ "app.kubernetes.io/name": "app", }), } for _, opt := range opts { opt(cfg) } files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: v1 kind: Namespace metadata: name: foo annotations: app.kubernetes.io/name: "app" labels: color: "green"
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", } files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: v1 kind: Namespace metadata: name: foo
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WithAnnotations = manifest.WithAnnotations
View Source
var WithLabels = manifest.WithLabels
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.