Skip to content

Conversation

itay-nvn-nv
Copy link
Contributor

@itay-nvn-nv itay-nvn-nv commented Sep 15, 2024

Fixes #19937

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@itay-nvn-nv itay-nvn-nv requested a review from a team as a code owner September 15, 2024 12:26
Copy link

bunnyshell bot commented Sep 15, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

bunnyshell bot commented Sep 15, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@itay-nvn-nv itay-nvn-nv changed the title Change the file name convention when downloading pod logs feature requestChange the file name convention when downloading pod logs Sep 15, 2024
@itay-nvn-nv itay-nvn-nv changed the title feature requestChange the file name convention when downloading pod logs feature request: Change the file name convention when downloading pod logs Sep 15, 2024
@itay-nvn-nv itay-nvn-nv changed the title feature request: Change the file name convention when downloading pod logs feat: Change the file name convention when downloading pod logs Sep 15, 2024
Signed-off-by: itaynvn-runai <itay.anavian@run.ai>
Signed-off-by: itaynvn-runai <itay.anavian@run.ai>
Copy link

codecov bot commented Sep 15, 2024

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 55.81%. Comparing base (60df9eb) to head (0ab6e24).
Report is 450 commits behind head on master.

Files with missing lines Patch % Lines
pkg/apiclient/application/forwarder_overwrite.go 0.00% 5 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@reggie-k reggie-k left a 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) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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>.

Copy link
Member

@nitishfy nitishfy left a 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)
Copy link
Member

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>
Copy link
Member

@gdsoumya gdsoumya left a comment

Choose a reason for hiding this comment

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

LGTM

@gdsoumya gdsoumya merged commit fd4cc93 into argoproj:master Sep 18, 2024
28 of 29 checks passed
adriananeci pushed a commit to adriananeci/argo-cd that referenced this pull request Dec 4, 2024
…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>
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.

Change the file name convention when downloading pod logs
4 participants