Skip to content

Add YAML example to kubectl patch.#50532

Merged
k8s-github-robot merged 1 commit intokubernetes:masterfrom
steveperry-53:kubectl-patch
Sep 27, 2017
Merged

Add YAML example to kubectl patch.#50532
k8s-github-robot merged 1 commit intokubernetes:masterfrom
steveperry-53:kubectl-patch

Conversation

@steveperry-53
Copy link
Copy Markdown
Contributor

@steveperry-53 steveperry-53 commented Aug 11, 2017

What this PR does / why we need it:
A YAML example has been requested for the kubectl patch reference doc.

fixes #458

Special notes for your reviewer:

  • Added a YAML example.
  • Updated the description to include JSON patch and JSON merge patch.

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 11, 2017
@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels Aug 11, 2017
@steveperry-53
Copy link
Copy Markdown
Contributor Author

/assign @lavalamp

@thockin thockin assigned mengqiy and unassigned lavalamp and thockin Aug 11, 2017
# Partially update a node using a strategic merge patch. Specify the patch as YAML.
kubectl patch node k8s-node-1 -p $'spec:\n unschedulable: true'

# Update a container's image; spec.containers[*].name is required because it's a merge key
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it is worthwhile to keep this example. Why delete it?

Copy link
Copy Markdown
Contributor Author

@steveperry-53 steveperry-53 Aug 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mengqiy, Because I can't get it to work. I tried for half a day to do a strategic merge patch on a Pod object. I asked @pwittrock, and he said to patch a Deployment instead. That leads me to believe that you can't change the containers list of a Pod object by doing a strategic merge patch.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can change the image name in a pod spec, as this does

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks. I put the example back in.

# Partially update a node identified by the type and name specified in "node.json" using strategic merge patch
kubectl patch -f node.json -p '{"spec":{"unschedulable":true}}'
# Partially update a node using a strategic merge patch. Specify the patch as YAML.
kubectl patch node k8s-node-1 -p $'spec:\n unschedulable: true'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$'spec:\n unschedulable: true'

Yaml patch format doesn't look pretty, but it works.

@steveperry-53
Copy link
Copy Markdown
Contributor Author

@liggitt, @mengqiy, Thanks for the review. I put back the example about updating a container image.

@k8s-github-robot k8s-github-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels Aug 14, 2017
@mengqiy
Copy link
Copy Markdown
Member

mengqiy commented Aug 15, 2017

/lgtm
Thanks.
IMO we don't really need a release-note for this PR. You can put NONE in release-note body.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 15, 2017
@mengqiy
Copy link
Copy Markdown
Member

mengqiy commented Aug 15, 2017

/assign @pwittrock
for approval

@mengqiy
Copy link
Copy Markdown
Member

mengqiy commented Aug 20, 2017

/retest

@steveperry-53
Copy link
Copy Markdown
Contributor Author

@pwittrock, Can you take a look and add your approval if this PR seems OK to you. Thanks.

@pwittrock
Copy link
Copy Markdown
Member

/approve

@k8s-github-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mengqiy, pwittrock, steveperry-53

Associated issue: 458

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 26, 2017
@fejta-bot
Copy link
Copy Markdown

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

3 similar comments
@fejta-bot
Copy link
Copy Markdown

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@fejta-bot
Copy link
Copy Markdown

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@fejta-bot
Copy link
Copy Markdown

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@k8s-github-robot
Copy link
Copy Markdown

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

k8s-ci-robot commented Sep 27, 2017

@steveperry-53: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-gce-bazel 88ab64c link /test pull-kubernetes-e2e-gce-bazel

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-github-robot
Copy link
Copy Markdown

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@xiangpengzhao
Copy link
Copy Markdown
Contributor

/release-note-none

This PR doesn't need a release note. A release-note label will lead to noise in CHANGELOG.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Nov 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants