-
Notifications
You must be signed in to change notification settings - Fork 345
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
Add FieldSelectors and LabelSelector for GetPogLogs #800
Conversation
8b1e8fc
to
bdb75f1
Compare
Codecov Report
@@ Coverage Diff @@
## master #800 +/- ##
=========================================
+ Coverage 42.71% 42.91% +0.2%
=========================================
Files 71 71
Lines 4198 4229 +31
=========================================
+ Hits 1793 1815 +22
- Misses 2298 2308 +10
+ Partials 107 106 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty good; I left lots of comments.
- needs to reconfigure the flow related to getting the field selectors (no mutating config, easier to understand/test method signature)
- needs unit testing of new functionality
- I think some of the docs can be improved slightly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor changes requested; looks a lot better IMO now.
I'd have @zubron or @stevesloka do a more thorough look though since I had just a few min. to go over this and haven't tested it manually either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from me but I am unable to manually test this; need follow up review.
I'd like to just make sure someone actually tests the cases of setting one/all/neither of those new fields (field selectors/namespaces/sonobuoyNamespace).
👍 Great job though and thanks for the addition.
7f94dc9
to
0b423b3
Compare
I have squashed the commits into one, and retest all the possible test cases, working fine. I have also provided the commands that I used to test in the pull request summary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran a scan with the following config:
{
"Description": "DEFAULT",
"UUID": "178860c5-2d09-4516-9bdc-a3bfc2b825b0",
"Version": "v0.15.0-18-g0b423b3",
"ResultsDir": "/tmp/sonobuoy",
"Resources": ["apiservices", "certificatesigningrequests", "clusterrolebindings", "clusterroles", "componentstatuses", "configmaps", "controllerrevisions", "cronjobs", "customresourcedefinitions", "daemonsets", "deployments", "endpoints", "ingresses", "jobs", "leases", "limitranges", "mutatingwebhookconfigurations", "namespaces", "networkpolicies", "nodes", "persistentvolumeclaims", "persistentvolumes", "poddisruptionbudgets", "pods", "podlogs", "podsecuritypolicies", "podtemplates", "priorityclasses", "replicasets", "replicationcontrollers", "resourcequotas", "rolebindings", "roles", "servergroups", "serverversion", "serviceaccounts", "services", "statefulsets", "storageclasses", "validatingwebhookconfigurations", "volumeattachments"],
"Filters": {
"Namespaces": ".*",
"LabelSelector": ""
},
"Limits": {
"PodLogs": {
"Namespaces": "",
"SonobuoyNamespace": true,
"FieldSelectors": ["metadata.namespace==default"],
"LabelSelector": "",
"Previous": false,
"SinceSeconds": null,
"SinceTime": null,
"Timestamps": false,
"TailLines": null,
"LimitBytes": null,
"LimitSize": "",
"LimitTime": ""
}
},
"QPS": 30,
"Burst": 50,
"Server": {
"bindaddress": "0.0.0.0",
"bindport": 8080,
"advertiseaddress": "",
"timeoutseconds": 10800
},
"Plugins": [],
"PluginSearchPath": ["./plugins.d", "/etc/sonobuoy/plugins.d", "~/sonobuoy/plugins.d"],
"Namespace": "heptio-sonobuoy",
"WorkerImage": "gcr.io/heptio-images/sonobuoy:v0.15.0-18-g0b423b3",
"ImagePullPolicy": "IfNotPresent",
"ImagePullSecrets": ""
}
I expected to only see podlogs
in the default namespace, but I still see all namespaces:
There is one single "=" instead of "==". The site/docs/master/sonobuoy-config.md shows examples of the format: Also, after running the scan, check any error in logs: |
Are these docs wrong then? I copy/pasted: https://github.com/heptio/sonobuoy/pull/800/files#diff-8f0acbcbc04c588fc62d68fff9d8a5fcR69 |
sorry it's a typo
|
@MengmengZHANG I took out the double equals and have the same result, still got logs for all namespaces. |
Seems @stevesloka doesn't use the new container image, will check offline. |
All seems to work @MengmengZHANG, just need to clean up those docs. |
Signed-off-by: Mengmeng ZHANG <[email protected]>
0b423b3
to
8380685
Compare
Thanks @stevesloka , I have updated the docs. Could you merge the pull request? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
What this PR does / why we need it:
Add more control parameters to PodLogLimits
When collecting pod logs, the scope of pods is defined by:
Then for each pod, the format and size of logs is defined by other fields, e.g. SinceSeconds
Which issue(s) this PR fixes
Special notes for your reviewer:
SonobuoyNamespace's default value is true, which causes some problem when merging the user's input config and the default config. A workaround is implemented to avoid this issue:
Hopefully the merge library provides a better solution for this open issue
To test: