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