-
Notifications
You must be signed in to change notification settings - Fork 39.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the kubectl apply command #14621
Conversation
Unit, integration and GCE e2e test build/test passed for commit 9aa318241bf6d701114b25d9d49462f363ffcba6. |
Labelling this PR as size/XXL |
9aa3182
to
91adc9b
Compare
Unit, integration and GCE e2e build/test failed for commit 91adc9bcfb77484be336c9efaea473a8c8baf982. |
cc @kubernetes/kubectl |
|
||
# Apply the JSON passed into stdin to a pod. | ||
$ cat pod.json | kubectl apply -f -` | ||
apply_annotation = "k8s-kubectl-apply" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use something like kubectl.kubernetes.io/config
See also the annotations used by rolling update:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/rolling_updater.go#L38
kubernetes/pkg/kubectl/kubectl.go
Line 27 in 77a06cb
const kubectlAnnotationPrefix = "kubectl.kubernetes.io/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Will need an e2e test. |
91adc9b
to
e4053d2
Compare
Unit, integration and GCE e2e test build/test passed for commit e4053d297cc440d439242e7cf07ab550fa5b5226. |
5f2c43f
to
1b50c05
Compare
Unit, integration and GCE e2e build/test failed for commit 1b50c0538170e52af97404ad773b4b132e80296d. |
Unit, integration and GCE e2e test build/test passed for commit 5f2c43fc85f0bcad352145c7541fabe253ea778b. |
1b50c05
to
31c8d47
Compare
Unit, integration and GCE e2e test build/test passed for commit 31c8d47b1fbb515828ac0d4e4327d3470a6a9250. |
62e6c7f
to
e1914c4
Compare
Unit, integration and GCE e2e build/test failed for commit 62e6c7f2c9c6af97a8761d180b9449e9269d7aaf. |
Unit, integration and GCE e2e build/test failed for commit e1914c4a57fd45ee00cc32a87436ae3c42613735. |
3984e41
to
c651fdf
Compare
@jlowdermilk Done. PTAL. |
Unit, integration and GCE e2e test build/test passed for commit aa686d31c19642844d29bb59cdefa8e70246761e. |
Unit, integration and GCE e2e test build/test passed for commit 3984e416c1d1f875199e56423b9afad32be337a0. |
NamespaceParam(cmdNamespace).DefaultNamespace(). | ||
FilenameParam(enforceNamespace, options.Filenames...). | ||
Flatten(). | ||
Latest(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove Latest() here. The reason is that the resource builder will overwrite info.Object
when you call Visit
with the latest version from server. You want to save/serialize the object as loaded from file before you get the latest version of the object in order to do a 3-way patch. See suggested changes below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code works correctly as currently written. Without Latest(), it did not fetch from the server. With Latest(), it does, but does not overwrite the Versioned Object, which is what we use to diff against the annotation. I'd like to better understand what you're asking for before changing anything.
Unit, integration and GCE e2e test build/test passed for commit c651fdf92b0d3c08fa811086b6e568f67e5e63d0. |
GCE e2e build/test failed for commit 64a4f6430a35653a053602c8a1783f23c4a05105. |
Not sure how, but the edits I made yesterday got lost during the rebase. Restored them and resubmitted. cc @jlowdermilk |
lgtm |
GCE e2e test build/test passed for commit 413104f05c1190a39011453d96da828d440f53e8. |
GCE e2e test build/test passed for commit 703a3e1. |
Removing LGTM because there was a change after LGTM was granted. @jlowdermilk could you please take a look? |
Add the kubectl apply command
This pull request adds the kubectl apply command. It does not yet create configuration annotations automatically when configuration is updated through other code paths. However, it does create them when it applies new configurations, so two or more invocations of kubectl apply will bootstrap them.
The next and final step in implementing #1702 will be automatically creating configuration annotations when configuration is updated through other code paths.