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

Sonobuoy existing preflight check #345

Merged
merged 1 commit into from
Mar 8, 2018

Conversation

liztio
Copy link
Contributor

@liztio liztio commented Mar 8, 2018

Checks to see if a Sonobuoy pod exists in this namespace already.

$ sonobuoy run
Running plugins: e2e, systemd-logs
INFO[0000] created object                                name=heptio-sonobuoy namespace= resource=namespaces
INFO[0000] created object                                name=sonobuoy-serviceaccount namespace=heptio-sonobuoy resource=serviceaccounts
INFO[0000] created object                                name=sonobuoy-serviceaccount namespace= resource=clusterrolebindings
INFO[0000] object already exists                         name=sonobuoy-serviceaccount namespace= resource=clusterroles
INFO[0000] created object                                name=sonobuoy-config-cm namespace=heptio-sonobuoy resource=configmaps
INFO[0000] created object                                name=sonobuoy-plugins-cm namespace=heptio-sonobuoy resource=configmaps
INFO[0000] created object                                name=sonobuoy namespace=heptio-sonobuoy resource=pods
INFO[0000] created object                                name=sonobuoy-master namespace=heptio-sonobuoy resource=services
$ sonobuoy run
Running plugins: e2e, systemd-logs
ERRO[0000] Preflight checks failed
ERRO[0000] sonobuoy run already exists in this namespace

Signed-off-by: liz [email protected]

@liztio liztio requested a review from chuckha March 8, 2018 20:10
Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

lgtm!

return errors.Wrap(err, "error checking for Sonobuoy pod")
// No error: pod exists
case err == nil:
return errors.New("sonobuoy run already exists in this namespace")
Copy link
Contributor

Choose a reason for hiding this comment

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

probably out of scope for this, but what do you think about giving the user some action on a failed preflight? for instance in this case, either delete the pod or run it in a different namespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I thought about that. It doesn't feel right to put that sort of thing inside of a error message, though. Maybe at some point we could make an ErrorWithSolution() type that had both an Error() and a Solution() method on it, then the CLI could check for the latter?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah!

@liztio liztio force-pushed the preflight-sonobuoy' branch from 8f79e5d to aa73717 Compare March 8, 2018 20:22
@liztio liztio merged commit e46f80b into vmware-tanzu:master Mar 8, 2018
jhamilton1 pushed a commit to jhamilton1/sonobuoy that referenced this pull request Jun 27, 2018
jhamilton1 pushed a commit to jhamilton1/sonobuoy that referenced this pull request Jun 27, 2018
Signed-off-by: liz <[email protected]>
Signed-off-by: Jesse Hamilton [email protected]

Signed-off-by: Jesse Hamilton [email protected]
ceridwen pushed a commit to ceridwen/sonobuoy that referenced this pull request Jul 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants