Documentation ¶
Overview ¶
Package replacement contains a kio.Filter implementation of the kustomize replacement transformer (accepts sources and looks for targets to replace their values with values from the sources).
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
Replacements []types.Replacement `json:"replacements,omitempty" yaml:"replacements,omitempty"`
}
Example ¶
f := Filter{} err := yaml.Unmarshal([]byte(` replacements: - source: kind: Foo2 fieldPath: spec.replicas targets: - select: kind: Foo1 fieldPaths: - spec.replicas`), &f) if err != nil { log.Fatal(err) } err = kio.Pipeline{ Inputs: []kio.Reader{&kio.ByteReader{Reader: bytes.NewBufferString(` apiVersion: example.com/v1 kind: Foo1 metadata: name: instance spec: replicas: 3 --- apiVersion: example.com/v1 kind: Foo2 metadata: name: instance spec: replicas: 99 `)}}, Filters: []kio.Filter{f}, Outputs: []kio.Writer{kio.ByteWriter{Writer: os.Stdout}}, }.Execute() if err != nil { log.Fatal(err) }
Output: apiVersion: example.com/v1 kind: Foo1 metadata: name: instance spec: replicas: 99 --- apiVersion: example.com/v1 kind: Foo2 metadata: name: instance spec: replicas: 99
Click to show internal directories.
Click to hide internal directories.