...
1
2
3
4 package annotations
5
6 import (
7 "bytes"
8 "log"
9 "os"
10
11 "sigs.k8s.io/kustomize/api/internal/plugins/builtinconfig"
12 "sigs.k8s.io/kustomize/kyaml/kio"
13 )
14
15 func ExampleFilter() {
16 fss := builtinconfig.MakeDefaultConfig().CommonAnnotations
17 err := kio.Pipeline{
18 Inputs: []kio.Reader{&kio.ByteReader{Reader: bytes.NewBufferString(`
19 apiVersion: example.com/v1
20 kind: Foo
21 metadata:
22 name: instance
23 ---
24 apiVersion: example.com/v1
25 kind: Bar
26 metadata:
27 name: instance
28 `)}},
29 Filters: []kio.Filter{Filter{
30 Annotations: map[string]string{
31 "foo": "bar",
32 "booleanValue": "true",
33 "numberValue": "42",
34 },
35 FsSlice: fss,
36 }},
37 Outputs: []kio.Writer{kio.ByteWriter{Writer: os.Stdout}},
38 }.Execute()
39 if err != nil {
40 log.Fatal(err)
41 }
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 }
62
View as plain text