-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat: Change the file name convention when downloading pod logs #19938
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
Conversation
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
Signed-off-by: itaynvn-runai <itay.anavian@run.ai>
Signed-off-by: itaynvn-runai <itay.anavian@run.ai>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19938 +/- ##
==========================================
- Coverage 55.83% 55.81% -0.03%
==========================================
Files 320 320
Lines 44381 44396 +15
==========================================
- Hits 24782 24778 -4
- Misses 17029 17055 +26
+ Partials 2570 2563 -7 ☔ View full report in Codecov by Sentry. |
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 think we shouldn't give up the container name entirely, for cases of pods with sidecars.
Can we append the container name to the ns and pod in the file name?
fileName := "log" | ||
if container := req.URL.Query().Get("container"); len(container) > 0 && kube.IsValidResourceName(container) { | ||
fileName = container | ||
if kube.IsValidResourceName(appNamespace) && kube.IsValidResourceName(podName) { |
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.
if kube.IsValidResourceName(appNamespace) && kube.IsValidResourceName(podName) { | |
if kube.IsValidResourceName(appNamespace) && kube.IsValidResourceName(podName) { |
appNameswpace
is argocd always (until you change the namespace where argocd has been installed). Instead, the namespace should be the one that the pod is part of. Furthermore, testing the above changes will give me a filename as argocd-my-app-dev-798dbbd986-kc2vz.log
. If my pod wasn't part of deployment, I'd want to have log file in this format - <namespace that pod is part of>-<pod-name>
.
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.
PTAL.
I also agree with @reggie-k comments for the same. Thanks!
changed `appNamespace` to `namespace`. as `appNamespace` will always be "argocd", and `namespace` is based on the actual k8s namespace, and will be unique. so each log file name will always be unique, and descriptive. Signed-off-by: itaynvn-runai <165032271+itaynvn-runai@users.noreply.github.com>
if container := req.URL.Query().Get("container"); len(container) > 0 && kube.IsValidResourceName(container) { | ||
fileName = container | ||
if kube.IsValidResourceName(namespace) && kube.IsValidResourceName(podName) { | ||
fileName = fmt.Sprintf("%s-%s", namespace, podName) |
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.
+1 to Regina's comment we should append container name to this too.
added `container` to the file name Signed-off-by: itaynvn-runai <165032271+itaynvn-runai@users.noreply.github.com>
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
…proj#19938) * changed log file name convention Signed-off-by: itaynvn-runai <itay.anavian@run.ai> * fixed condition Signed-off-by: itaynvn-runai <itay.anavian@run.ai> * Update forwarder_overwrite.go changed `appNamespace` to `namespace`. as `appNamespace` will always be "argocd", and `namespace` is based on the actual k8s namespace, and will be unique. so each log file name will always be unique, and descriptive. Signed-off-by: itaynvn-runai <165032271+itaynvn-runai@users.noreply.github.com> * Update forwarder_overwrite.go added `container` to the file name Signed-off-by: itaynvn-runai <165032271+itaynvn-runai@users.noreply.github.com> --------- Signed-off-by: itaynvn-runai <itay.anavian@run.ai> Signed-off-by: itaynvn-runai <165032271+itaynvn-runai@users.noreply.github.com> Signed-off-by: Adrian Aneci <aneci@adobe.com>
Fixes #19937
Checklist: