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 8d4b6452d4
commit 3f8b1fe05b

View File

@@ -45,7 +45,7 @@ fieldSpecs:
create: true
kind: StatefulSet
`, `
apiVersion: builtin
apiVersion: apps/v1
kind: Service
metadata:
name: myapp
@@ -54,21 +54,21 @@ spec:
- port: 1111
targetport: 1111
---
apiVersion: builtin
apiVersion: apps/v1
kind: Deployment
metadata:
name: otherapp
spec:
replicas: 5
---
apiVersion: builtin
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 5
---
apiVersion: builtin
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: myapp
@@ -77,7 +77,7 @@ spec:
matchLabels:
app: app
---
apiVersion: builtin
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: myapp
@@ -86,7 +86,7 @@ spec:
matchLabels:
app: app
---
apiVersion: builtin
apiVersion: apps/v1
kind: ReplicationController
metadata:
name: myapp
@@ -97,7 +97,7 @@ spec:
`)
th.AssertActualEqualsExpected(rm, `
apiVersion: builtin
apiVersion: apps/v1
kind: Service
metadata:
name: myapp
@@ -106,21 +106,21 @@ spec:
- port: 1111
targetport: 1111
---
apiVersion: builtin
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 23
---
apiVersion: builtin
apiVersion: apps/v1
kind: Deployment
metadata:
name: otherapp
spec:
replicas: 5
---
apiVersion: builtin
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: myapp
@@ -130,7 +130,7 @@ spec:
matchLabels:
app: app
---
apiVersion: builtin
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: myapp
@@ -140,7 +140,7 @@ spec:
matchLabels:
app: app
---
apiVersion: builtin
apiVersion: apps/v1
kind: ReplicationController
metadata:
name: myapp