Skip to content

Commit

Permalink
Merge pull request #18337 from juanvallejo/jvallejo/restore-obj-onfai…
Browse files Browse the repository at this point in the history
…lure-apply

Automatic merge from submit-queue.

UPSTREAM: 58991: restore original object on apply err

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1539529

When `oc apply` is used with the `--force` flag, it will attempt to patch an existing object `A` up to 5 times before it deletes the existing object and re-creates it with a new object `B` originally used to patch `A`.

If object `B` has invalid syntax, or a change preventing it from passing validation, the new object will fail to be created and `oc apply` will simply delete the original object without informing the user that their object no longer exists, and a new one was not created.

This patch restores the original object in the event that an error occurs while attempting to outright replace it with a new one.

Hoping to use this thread to at least discuss the nature of `oc apply --force`, and better define its behavior when it encounters a non-conflict error.

cc @ironcladlou
  • Loading branch information
openshift-merge-robot authored Feb 8, 2018
2 parents 057e3b3 + 1816810 commit 75f08f0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apply.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75f08f0

Please sign in to comment.