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

Show logs for a specific plugin #868

Merged

Conversation

zubron
Copy link
Contributor

@zubron zubron commented Sep 9, 2019

What this PR does / why we need it:
Add a new flag to the logs command to show the logs only for a
specific plugin. If not provided, or no pods are found for the plugin,
default to showing all logs.

We didn't have a way to uniquely identify pods for a plugin, so this
change adds a new label when creating Pods and DaemonSets which can
be used to filter the pods. This means that the flag will not work
for older versions of Sonobuoy, but it will still default to showing
all logs which was the original behaviour.

Signed-off-by: Bridget McErlean [email protected]

Which issue(s) this PR fixes

Release note:

Sonobuoy can now show only the logs for a specific plugin by using the flag `--plugin <plugin_name>` when using the logs command.

@zubron zubron requested a review from johnSchnake September 9, 2019 14:11
Add a new flag to the `logs` command to show the logs only for a
specific plugin. If not provided, or no pods are found for the plugin,
default to showing all logs.

We didn't have a way to uniquely identify pods for a plugin, so this
change adds a new label when creating Pods and DaemonSets which can
be used to filter the pods. This means that the flag will not work
for older versions of Sonobuoy, but it will still default to showing
all logs which was the original behaviour.

Signed-off-by: Bridget McErlean <[email protected]>
@zubron zubron force-pushed the show-logs-for-specific-plugin-702 branch from 1b08517 to 54094f1 Compare September 9, 2019 14:22
@codecov-io
Copy link

Codecov Report

Merging #868 into master will increase coverage by 0.27%.
The diff coverage is 88.46%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #868      +/-   ##
==========================================
+ Coverage    46.9%   47.18%   +0.27%     
==========================================
  Files          75       75              
  Lines        4863     4881      +18     
==========================================
+ Hits         2281     2303      +22     
+ Misses       2450     2448       -2     
+ Partials      132      130       -2
Impacted Files Coverage Δ
pkg/client/interfaces.go 82.5% <ø> (ø) ⬆️
pkg/plugin/driver/job/job.go 75.2% <100%> (+0.2%) ⬆️
pkg/plugin/driver/daemonset/daemonset.go 66.87% <100%> (+0.21%) ⬆️
cmd/sonobuoy/app/logs.go 38.88% <50%> (+0.65%) ⬆️
pkg/client/logs.go 40.16% <87.5%> (+7.75%) ⬆️
pkg/plugin/aggregation/aggregator.go 83.2% <0%> (+4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc64713...54094f1. Read the comment docs.

@johnSchnake
Copy link
Contributor

Seems like that sonobuoy-plugin label got removed accidentally when we moved away from template files. https://github.com/heptio/sonobuoy/pull/834/files#diff-90fec45294302b8f99ef89e826ce7e9bL30

LGTM but I'm going to run it manually to double check and then I'll approve.

Copy link
Contributor

@johnSchnake johnSchnake left a comment

Choose a reason for hiding this comment

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

Worked as expected for sonobuoy logs and sonobuoy logs --follow 👍

@zubron
Copy link
Contributor Author

zubron commented Sep 9, 2019

Seems like that sonobuoy-plugin label got removed accidentally when we moved away from template files. https://github.com/heptio/sonobuoy/pull/834/files#diff-90fec45294302b8f99ef89e826ce7e9bL30

The sonobuoy-plugin line shown in that commit was for an annotation. We still have those annotations (https://github.com/heptio/sonobuoy/blob/master/pkg/plugin/driver/daemonset/daemonset.go#L88) but the docs for annotations say that they shouldn't be used for identifying objects so that's why we have to now include the label as well. Still means that this new client won't work with the older versions :(

@zubron zubron merged commit 3975a9e into vmware-tanzu:master Sep 9, 2019
@zubron zubron deleted the show-logs-for-specific-plugin-702 branch September 9, 2019 15:08
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.

Sonobuoy logs should allow specification of a single plugin
3 participants