Improved fn framework support for patching

- Generate patches with a func
- Generate patches for containers
This commit is contained in:
Phillip Wittrock
2020-11-24 12:02:55 -08:00
parent f8194bd3c2
commit f2706dce68
4 changed files with 261 additions and 9 deletions

View File

@@ -893,8 +893,8 @@ metadata:
// config.kubernetes.io/index: '1'
}
// ExamplePatchTemplateContainers_names patches all containers.
func ExamplePatchTemplateContainers() {
// ExamplePatchContainersWithString patches all containers.
func ExamplePatchContainersWithString() {
resources, err := kio.ParseAll(`
apiVersion: apps/v1
kind: Deployment
@@ -943,7 +943,7 @@ spec:
}
input := struct{ Value string }{Value: "new-value"}
err = framework.PatchTemplateContainers(resources, `
err = framework.PatchContainersWithString(resources, `
env:
KEY: {{ .Value }}
`, input)
@@ -1006,9 +1006,9 @@ env:
// <nil>
}
// ExamplePatchTemplateContainers_names patches containers matching
// PatchTemplateContainersWithString patches containers matching
// a specific name.
func ExamplePatchTemplateContainers_names() {
func ExamplePatchContainersWithString_names() {
resources, err := kio.ParseAll(`
apiVersion: apps/v1
kind: Deployment
@@ -1057,7 +1057,7 @@ spec:
}
input := struct{ Value string }{Value: "new-value"}
err = framework.PatchTemplateContainers(resources, `
err = framework.PatchContainersWithString(resources, `
env:
KEY: {{ .Value }}
`, input, "foo")