Skip to content

runbundle: refactor printing deployment/pod errors#3908

Merged
varshaprasad96 merged 8 commits intooperator-framework:masterfrom
bharathi-tenneti:refactorverifycsv
Oct 13, 2020
Merged

runbundle: refactor printing deployment/pod errors#3908
varshaprasad96 merged 8 commits intooperator-framework:masterfrom
bharathi-tenneti:refactorverifycsv

Conversation

@bharathi-tenneti
Copy link
Copy Markdown
Contributor

Description:
Refactor the existing printDeploymentErrors and printPodErrors() functions from client.go to collect and return errors in a struct/map.
https://github.com/operator-framework/operator-sdk/blob/master/internal/olm/client/client.go
Have the return type defined as custom error, for re-usability.
Refactor the test cases and write new ones as needed based on above code re-factor.

Comment thread internal/olm/client/client.go Outdated
Comment thread internal/olm/client/client.go
Comment thread internal/olm/client/client.go Outdated
Comment thread internal/olm/client/client.go Outdated
Comment thread internal/olm/client/client.go Outdated
Comment thread internal/olm/client/client.go Outdated
Comment thread internal/olm/client/client.go Outdated
jmrodri
jmrodri previously approved these changes Sep 28, 2020
Copy link
Copy Markdown
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 Sep 28, 2020
Comment thread internal/cmd/operator-sdk/bundle/validate/cmd.go Outdated
Comment thread internal/olm/client/client.go Outdated
@jmrodri jmrodri dismissed their stale review September 29, 2020 18:48

In light of eric's comments, I'm rescinding my lgtm

@jmrodri
Copy link
Copy Markdown
Member

jmrodri commented Sep 30, 2020

@bharathi-tenneti I honestly prefer the original implementation of this PR: d987f78 I think we should go back to that. I see @estroz point in that Result is meant for the validation and not meant to be a general error framework. @camilamacedo86 point is valid which is why we could make deploymentVerifyError but I'm not sure it's required.

Copy link
Copy Markdown
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

Comment thread internal/olm/client/client.go Outdated
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 2, 2020
Comment thread internal/olm/client/client.go Outdated
return err
if s.Type == appsv1.DeploymentAvailable && s.Status != corev1.ConditionTrue {
podError := c.checkPodErrors(ctx, depSelectors, key)
if podError.Error() == "" {
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.

Suggested change
if podError.Error() == "" {
if podError == nil {

Comment thread internal/olm/client/client.go Outdated
name: ds.Name,
issue: s.Reason,
})
return depErr
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.

Other deployments may have errors

Suggested change
return depErr
break

Comment thread internal/olm/client/client.go Outdated
name: ds.Name,
issue: podError.Error(),
})
return depErr
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.

Other deployments may have errors

Suggested change
return depErr
break

Comment thread internal/olm/client/client.go
Comment thread internal/olm/client/client.go Outdated
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 2, 2020
Comment thread internal/olm/client/client.go Outdated
Comment thread internal/olm/client/client.go Outdated
Comment thread internal/olm/client/client.go Outdated
Comment thread internal/olm/client/client.go Outdated
@camilamacedo86
Copy link
Copy Markdown
Contributor

Hii @estroz,

WDYT about merge this one and we working on in the fix/improvements in a follow-up. Do you see something that is a blocker to get it merged?

@varshaprasad96
Copy link
Copy Markdown
Member

@camilamacedo86 : Have taken this up from Bharathi. I can make the suggested changes and push it to this PR.

@varshaprasad96
Copy link
Copy Markdown
Member

Have addressed review comments

Copy link
Copy Markdown
Member

@estroz estroz 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 Oct 13, 2020
@varshaprasad96 varshaprasad96 merged commit 1254d83 into operator-framework:master Oct 13, 2020
estroz pushed a commit to estroz/operator-sdk that referenced this pull request Oct 14, 2020
…k#3908)

* refactor printDeployment and printPodError funcs

* Addressing PR comments

* fix sanity error

* Reverting a2ed4 and 8e004

* Reverting a2ed4 and 8e004

* Addressing PR comments

* Added podError struct, and other PR comments

* Address review comments

Co-authored-by: varshaprasad96 <varshaprasad96@gmail.com>
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.

7 participants