-
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
kubectl replace-or-create would be helpful #14040
Comments
apply is the recommended way to do this. |
I use |
A flag on create would be the simplest approach to this. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
I'm creating or replacing a configmap from a file and use this pattern:
|
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/reopen |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
/kind feature |
This seems useful to me as someone completely new to k8s. I'm reading the docs and trying to futz my way through how I'd use it in a sensible manner, and it looks like I don't want to use |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
@montanaflynn this doesn't help for the issue described by @discordianfish in #14040 (comment) |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle stale |
@soltysh has this been considered? |
@alculquicondor with |
The canonical way to create or update is /close |
@seans3: Closing this issue. In response to this:
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. |
Just a heads up that This normally isn't a big deal but this subtle difference can cause production issues. For example, if you rename a container or volumeMount between deployments, the merge result may end up with more containers or volumes than you wanted. |
you can do this: |
create || replace is pretty good, although it's worth noting that for yamls with multiple objects in them it would be really nice to have a kubectl command that handles the create/replace on a case-by-case basis |
I often find myself doing this:
kubectl replace -f template || kubectl create -f template
, because I want to replace the existing RC, but I also want to create it if it was deleted. This works, but it is messy (the error handling isn't quite right; error messages when kubectl replace fails etc).It would be helpful to have
kubectl replace -or-create -f template
do the right thing: check if the named object exists, then do a replace if so and a create if not.(Deliberately bad straw-man argument naming :-) )
The text was updated successfully, but these errors were encountered: