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

@@ -239,10 +239,12 @@ func (kt *KustTarget) configureBuiltinReplicaCountTransformer(
tConfig *config.TransformerConfig) (
result []transformers.Transformer, err error) {
var c struct {
Replica types.Replica
Replica types.Replica
FieldSpecs []config.FieldSpec
}
for _, args := range kt.kustomization.Replicas {
c.Replica = args
c.FieldSpecs = tConfig.Replicas
p := builtin.NewReplicaCountTransformerPlugin()
err = kt.configureBuiltinPlugin(p, c, "replica")
if err != nil {