Make the replica transformer kind aware.

The previous implementation had a bug and poorly handled
types that should not have a `spec: replica:` field.

Documentation is updated to reflect the change in behavior,
and better highlights the cases where a patch should be
used instead of this shorthand.
This commit is contained in:
Damien Robichaud
2019-06-13 17:31:53 -07:00
parent 05e3dead7b
commit 8d4b6452d4
9 changed files with 232 additions and 58 deletions

View File

@@ -32,6 +32,7 @@ func GetDefaultFieldSpecs() []byte {
[]byte(varReferenceFieldSpecs),
[]byte(nameReferenceFieldSpecs),
[]byte(imagesFieldSpecs),
[]byte(replicasFieldSpecs),
}
return bytes.Join(configData, []byte("\n"))
}
@@ -47,5 +48,6 @@ func GetDefaultFieldSpecsAsMap() map[string]string {
result["varreference"] = varReferenceFieldSpecs
result["namereference"] = nameReferenceFieldSpecs
result["images"] = imagesFieldSpecs
result["replicas"] = replicasFieldSpecs
return result
}

View File

@@ -0,0 +1,20 @@
package defaultconfig
const replicasFieldSpecs = `
replicas:
- path: spec/replicas
create: true
kind: Deployment
- path: spec/replicas
create: true
kind: ReplicationController
- path: spec/replicas
create: true
kind: ReplicaSet
- path: spec/replicas
create: true
kind: StatefulSet
`