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

fix: allow namespace default using valueFrom as arg for AnalysisTempl… #3436

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

newtondev
Copy link
Contributor

…ate (#3361)

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional with a list of types and scopes found here, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed my commits with DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My builds are green. Try syncing with master if they are not.
  • My organization is added to USERS.md.

Copy link

codecov bot commented Mar 10, 2024

Codecov Report

Attention: Patch coverage is 97.36842% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 82.88%. Comparing base (8405f2e) to head (758eada).
Report is 74 commits behind head on master.

Files Patch % Lines
analysis/analysis.go 97.36% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3436      +/-   ##
==========================================
+ Coverage   81.83%   82.88%   +1.04%     
==========================================
  Files         135      135              
  Lines       20688    17158    -3530     
==========================================
- Hits        16931    14221    -2710     
+ Misses       2883     2044     -839     
- Partials      874      893      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Mar 10, 2024

Go Published Test Results

2 161 tests   2 161 ✅  2m 53s ⏱️
  119 suites      0 💤
    1 files        0 ❌

Results for commit 758eada.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Mar 10, 2024

E2E Tests Published Test Results

  6 files    6 suites   5h 21m 4s ⏱️
110 tests  96 ✅  6 💤  8 ❌
688 runs  625 ✅ 36 💤 27 ❌

For more details on these failures, see this check.

Results for commit 758eada.

♻️ This comment has been updated with latest results.

@newtondev newtondev force-pushed the feat-valuefrom-default-for-namespace branch from dd458af to 51aab55 Compare March 11, 2024 14:58
@zachaller zachaller added this to the v1.7 milestone Mar 11, 2024
func resolveArgsFromValueFromFieldRef(arg v1alpha1.Argument, namespace string) v1alpha1.Argument {
if arg.ValueFrom.FieldRef != nil && arg.ValueFrom.FieldRef.FieldPath != "" {
switch arg.ValueFrom.FieldRef.FieldPath {
case "metadata.namespace":
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I am following this correctly does this mean that only metadata.namespace works?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wondering why this does not seem be called form this path:

value, err = fieldpath.ExtractFieldPathAsString(r, arg.ValueFrom.FieldRef.FieldPath)

@zachaller
Copy link
Collaborator

How are you creating the AnalysisRun, is the argo rollouts controller creating it or are you creating it say via kubectl or something similar outside of rollouts controller?

@newtondev
Copy link
Contributor Author

So it seems like the problem here is mainly that when wanting to not have to pass in the namespace from the Rollout to the AnalysisTemplate. If the arg is not specified but is referenced in the AnalysisTemplate like namespace, it should default to the namespace from the Rolllout to be used in metrics provider like Prometheus.

Thanks @zachaller , I will take a deeper look into the ExtractFieldPathAsString to see if there is a good way to handle this kind of default.

@zachaller zachaller modified the milestones: v1.7, v1.8 Mar 26, 2024
…ate (argoproj#3361)

Signed-off-by: Craig Newton <newtondev@gmail.com>
@zachaller zachaller force-pushed the feat-valuefrom-default-for-namespace branch from 51aab55 to 758eada Compare April 2, 2024 23:25
Copy link

sonarcloud bot commented Apr 2, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
12.7% Duplication on New Code

See analysis details on SonarCloud

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.

None yet

2 participants