-
Notifications
You must be signed in to change notification settings - Fork 38
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
osm/smi: update dir structure and add test #118
Conversation
Codecov Report
@@ Coverage Diff @@
## master #118 +/- ##
==========================================
+ Coverage 31.46% 38.85% +7.38%
==========================================
Files 12 12
Lines 518 525 +7
==========================================
+ Hits 163 204 +41
+ Misses 340 304 -36
- Partials 15 17 +2
Continue to review full report at Codecov.
|
ce68617
to
f0c6d2d
Compare
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.
💡 Thank you for this PR and pinging us for review.
I have added few key comments, I assume you have tested all this for SMI\OSM
scenario and all works as expected.
- If the
yaml
changes are specific toSMI/OSM
needs, you might only want to keep them in your consuming tools. - Please add some unit-test for this collector if possible, currently it decreases the over-all code-coverage. ( )
- Regarding the over all, after you are GA, we should align a work for converting it using
client-go
packages into this collector, that will add better test-ability as well. https://github.com/kubernetes/client-go- There are some recent refactors we have done for those reason, one of the sample implementation is in Pod Container work or systemperf collector.
Thank you
@@ -197,8 +198,8 @@ func (collector *OsmCollector) collectDataFromEnvoys(namespace string) error { | |||
// Remove certificate secrets from Envoy config i.e., "inline_bytes" field from response | |||
re := regexp.MustCompile("(?m)[\r\n]+^.*inline_bytes.*$") | |||
secretRemovedResponse := re.ReplaceAllString(string(responseBody), "---redacted---") | |||
|
|||
collector.data[query+"_"+podName] = secretRemovedResponse | |||
filePath := meshName + "/envoy/"+ podName + query |
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.
💡 question: I don't know much about this scenario hence I am not not sure what these changes are, but I am guessing this mesh
which is passed throughout is for a specific reasons?
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.
There can be multiple meshes in a cluster and the collector collects all resources for each of them, so the number of files was getting overwhelming and had to discern between. Passing in mesh
allows the file system to be organized so that resources collected for each mesh are grouped together, at least. Initially I was trying to just use a smarter naming system without creating subdirectories but the names were getting very long and unwieldy, ex: <meshName>_namespace_<namespaceName>_pod_<podName>_logs
. If your team is open to it, I would prefer to include further subdirectories for each mesh, namespace, etc. as we had before the code was refactored so we can avoid such complex naming
cc: @arnaud-tincelin
@@ -220,8 +221,8 @@ func (collector *OsmCollector) collectPodLogs(namespace string) error { | |||
output = fmt.Sprintf("Failed to collect logs for pod %s: %+v", podName, err) | |||
log.Print(output) | |||
} | |||
|
|||
collector.data[podName+"_logs"] = output | |||
filePath := meshName + "/" + podName + "_podLogs" |
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.
💡 what is the outcome of this change? does this automatically generates the folder
structure?
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.
yes, more context here: #118 (comment)
2a404a7
to
3998c55
Compare
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.
💡 🙏 Thanks for this, there are few comments, especially the yaml changes are something which need re-look. I see mainly PR is just the name and folder structure change and if you have tested this and only thing left is the yaml
changes which is not needed in the core. Thank you for adding very initial test class for this as well.
Can you please open a tracking item for the conversion of these collector to client-go
we have already implemented logic clients
and podDecribe
For example a sample reside here: https://github.com/Azure/aks-periscope/blob/master/pkg/collector/kubeobjects_collector.go#L54
for future purpose regarding the client-go > api
based implementation, I can help and implement this the conversion with you but I will need someone who understand the SMI/OSM scenario to test them alongside. 🙏☕️
Thank you so much,
3db237a
to
84eb0de
Compare
That is correct, I've now updated the title of the PR to reflect the same and opened an issue to track the conversion to client go here #124. Thanks for your help with this. |
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.
👍
meshName/resourceName_resourceType
andsmi/resourceName_resourceType>
kubectl apply -k deployment