Skip to content

Commit

Permalink
Update kubectl patch doc to use apps/v1beta2 APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
crimsonfaith91 committed Sep 12, 2017
1 parent 97f089e commit fbe7cba
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
5 changes: 4 additions & 1 deletion cn/docs/tasks/run-application/deployment-patch-demo.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: patch-demo
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
Expand Down
5 changes: 4 additions & 1 deletion docs/tasks/run-application/deployment-patch-demo.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: patch-demo
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
Expand Down
34 changes: 14 additions & 20 deletions docs/tasks/run-application/update-api-object-kubectl-patch.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,12 @@ get terminated and replaced by new ones.
At this point, each Pod has one Container that runs the nginx image. Now suppose
you want each Pod to have two containers: one that runs nginx and one that runs redis.

Create a file named `patch-file.yaml` that has this content:
Create a file named `patch-file.yaml` that has `.spec.template.spec.containers` field as follow:

```shell
spec:
template:
spec:
containers:
- name: patch-demo-ctr-2
image: redis
containers:
- name: patch-demo-ctr-2
image: redis
```

Patch your Deployment:
Expand All @@ -81,14 +78,14 @@ The output shows that the PodSpec in the Deployment has two Containers:

```shell
containers:
- image: nginx
imagePullPolicy: Always
name: patch-demo-ctr
...
- image: redis
imagePullPolicy: Always
name: patch-demo-ctr-2
...
- image: nginx
imagePullPolicy: Always
name: patch-demo-ctr
...
```

View the Pods associated with your patched Deployment:
Expand Down Expand Up @@ -118,10 +115,10 @@ The output shows that the Pod has two Containers: one running nginx and one runn

```
containers:
- image: nginx
...
- image: redis
...
- image: nginx
...
```

### Notes on the strategic merge patch
Expand Down Expand Up @@ -160,15 +157,12 @@ The default value for the `type` parameter is `strategic`. So in the preceding e
did a strategic merge patch.

Next, do a JSON merge patch on your same Deployment. Create a file named `patch-file-2.yaml`
that has this content:
that has `.spec.template.spec.containers` field as follow:

```shell
spec:
template:
spec:
containers:
- name: patch-demo-ctr-3
image: gcr.io/google-samples/node-hello:1.0
containers:
- name: patch-demo-ctr-3
image: gcr.io/google-samples/node-hello:1.0
```

In your patch command, set `type` to `merge`:
Expand Down

0 comments on commit fbe7cba

Please sign in to comment.