Documentation ¶
Overview ¶
Example (Full) ¶
package main import ( "embed" "os" v1 "k8s.io/api/core/v1" "knative.dev/reconciler-test/pkg/manifest" "knative.dev/reconciler-test/pkg/resources/secret" testlog "knative.dev/reconciler-test/pkg/logging" ) //go:embed *.yaml var yaml embed.FS func main() { ctx := testlog.NewContext() images := map[string]string{} cfg := map[string]interface{}{ "name": "foo", "namespace": "bar", } opts := []manifest.CfgFn{ secret.WithLabels(map[string]string{ "color": "green", }), secret.WithAnnotations(map[string]interface{}{ "app.kubernetes.io/name": "app", }), secret.WithType(v1.SecretTypeOpaque), secret.WithData(map[string][]byte{ "key1": []byte("val1"), }), secret.WithStringData(map[string]string{ "key2": "val2", }), } 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: Secret metadata: name: foo namespace: bar annotations: app.kubernetes.io/name: "app" labels: color: "green" type: Opaque data: key1: dmFsMQ== stringData: key2: val2
Example (Min) ¶
package main import ( "embed" "os" "knative.dev/reconciler-test/pkg/manifest" testlog "knative.dev/reconciler-test/pkg/logging" ) //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: v1 kind: Secret metadata: name: foo namespace: bar
Index ¶
- Variables
- func Install(name string, options ...manifest.CfgFn) feature.StepFn
- func IsPresent(name string, assertions ...Assertion) feature.StepFn
- func IsPresentInNamespace(name string, ns string, assertions ...Assertion) feature.StepFn
- func WithData(data map[string][]byte) manifest.CfgFn
- func WithStringData(stringdata map[string]string) manifest.CfgFn
- func WithType(secretType corev1.SecretType) manifest.CfgFn
- type Assertion
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WithAnnotations = manifest.WithAnnotations
View Source
var WithLabels = manifest.WithLabels
Functions ¶
func IsPresentInNamespace ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.