Skip to content
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

Bug 1921458: run bundle-upgrade should handle error gracefully when a previous operator version doesn't exist #4448

Merged
merged 2 commits into from
Jan 28, 2021

Conversation

rashmigottipati
Copy link
Member

@rashmigottipati rashmigottipati commented Jan 28, 2021

Description of the change:
run bundle-upgrade command handles error instead of throwing a panic, when a previous version of the operator bundle doesn't exist in the cluster

Motivation for the change:

Without installing etcd operator, 
# operator-sdk run bundle-upgrade quay.io/olmqe/etcd-bundle:0.9.2-share

Result:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1978d29]

Expected behavior: The command should check that the etcd operator doesn't exist in the cluster and handle the error gracefully instead of throwing a panic.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

…or doesn't exist in the cluster

Signed-off-by: rashmigottipati <chowdary.grashmi@gmail.com>
@jmrodri
Copy link
Member

jmrodri commented Jan 28, 2021

@rashmigottipati please add changelog fragment.

@rashmigottipati rashmigottipati changed the title run bundle-upgrade should gracefully handle error when a previous operator version doesn't exist Bug 1921458 : run bundle-upgrade should handle error gracefully when a previous operator version doesn't exist Jan 28, 2021
Signed-off-by: rashmigottipati <chowdary.grashmi@gmail.com>
Copy link
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 28, 2021
@jmrodri jmrodri changed the title Bug 1921458 : run bundle-upgrade should handle error gracefully when a previous operator version doesn't exist Bug 1921458: run bundle-upgrade should handle error gracefully when a previous operator version doesn't exist Jan 28, 2021
@rashmigottipati
Copy link
Member Author

Reproduced this bug locally using kind and also on OCP.
Verified this fix locally and against and it works as expected and doesn't throw panic anymore.

Actual result:

▶ ./build/operator-sdk run bundle-upgrade quay.io/olmqe/etcd-bundle:0.9.2-share
FATA[0001] Failed to run bundle upgrade: no existing operator found in the cluster to upgrade

@rashmigottipati rashmigottipati merged commit 7bf5e3d into operator-framework:master Jan 28, 2021
@rashmigottipati
Copy link
Member Author

/cherry-pick v1.3.x

@openshift-cherrypick-robot

@rashmigottipati: new pull request created: #4451

In response to this:

/cherry-pick v1.3.x

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.

if len(subList.Items) == 0 {
return nil, errors.New("no existing operator found in the cluster to upgrade")
}

var subscription *v1alpha1.Subscription
Copy link
Member

Choose a reason for hiding this comment

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

This could still be nil if no subscription exists where s.Spec.Package == o.PackageName.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. Thanks for catching that.
#4452

reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 4, 2021
… a previous operator version doesn't exist (operator-framework#4448)

* `run bundle-upgrade` should handle error gracefully when a previous operator version doesn't exist

Signed-off-by: rashmigottipati <chowdary.grashmi@gmail.com>
Signed-off-by: Rein van 't Veer <reinvantveer@gmail.com>
reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 4, 2021
… a previous operator version doesn't exist (operator-framework#4448)

* `run bundle-upgrade` should handle error gracefully when a previous operator version doesn't exist

Signed-off-by: rashmigottipati <chowdary.grashmi@gmail.com>
Signed-off-by: Rein van 't Veer <reinvantveer@gmail.com>
reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 5, 2021
… a previous operator version doesn't exist (operator-framework#4448)

* `run bundle-upgrade` should handle error gracefully when a previous operator version doesn't exist

Signed-off-by: rashmigottipati <chowdary.grashmi@gmail.com>
Signed-off-by: Rein van 't Veer <reinvantveer@gmail.com>
reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 5, 2021
… a previous operator version doesn't exist (operator-framework#4448)

* `run bundle-upgrade` should handle error gracefully when a previous operator version doesn't exist

Signed-off-by: rashmigottipati <chowdary.grashmi@gmail.com>
Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl>
reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 5, 2021
… a previous operator version doesn't exist (operator-framework#4448)

* `run bundle-upgrade` should handle error gracefully when a previous operator version doesn't exist

Signed-off-by: rashmigottipati <chowdary.grashmi@gmail.com>
Signed-off-by: Rein van 't Veer <reinvantveer@gmail.com>
Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl>
rearl-scwx pushed a commit to rearl-scwx/operator-sdk that referenced this pull request Feb 5, 2021
… a previous operator version doesn't exist (operator-framework#4448)

* `run bundle-upgrade` should handle error gracefully when a previous operator version doesn't exist

Signed-off-by: rashmigottipati <chowdary.grashmi@gmail.com>Signed-off-by: rearl <rearl@secureworks.com>
@rashmigottipati rashmigottipati deleted the bugfix branch June 10, 2022 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants