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: show namespaced resources owned by cluster scoped resources #366

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

chetan-rns
Copy link
Member

Currently, the namespaced resources owned by cluster scoped resources are not shown on the UI. This PR updates IterateHierarchy() to consider all resources(both cluster and namespace scoped) while managing a cluster-level object.

Part of: argoproj/argo-cd#7733

Signed-off-by: Chetan Banavikalmutt chetanrns1997@gmail.com

@sonarcloud
Copy link

sonarcloud bot commented Jan 17, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
9.0% 9.0% Duplication

@codecov
Copy link

codecov bot commented Jan 17, 2022

Codecov Report

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

Project coverage is 55.23%. Comparing base (5fd9f44) to head (b1e7466).
Report is 3 commits behind head on master.

❗ Current head b1e7466 differs from pull request most recent head 1c693c0. Consider uploading reports for the commit 1c693c0 to get more accurate results

Files Patch % Lines
pkg/cache/cluster.go 84.93% 11 Missing ⚠️
pkg/cache/settings.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #366      +/-   ##
==========================================
+ Coverage   54.71%   55.23%   +0.51%     
==========================================
  Files          41       41              
  Lines        4834     4908      +74     
==========================================
+ Hits         2645     2711      +66     
- Misses       1977     1985       +8     
  Partials      212      212              

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

Copy link
Contributor

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

Added one comment regarding performance. I think introducing parent -> children index should reduce CPU usage and improve performance but it is a pretty dangerous change. I would move this change to v2.4

pkg/cache/cluster.go Outdated Show resolved Hide resolved
@empath-nirvana
Copy link

Is this issue dead?

@chetan-rns
Copy link
Member Author

@empath-nirvana Sorry! We moved it to v2.4 and I got busy with other stuff. I will try to address the comments soon and get them merged

@sonarcloud
Copy link

sonarcloud bot commented Mar 25, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
4.0% 4.0% Duplication

@chetan-rns chetan-rns requested a review from alexmt March 25, 2022 11:13
@empath-nirvana
Copy link

Are we still waiting on this?

@the-scott-hand
Copy link

when can this be added? we have a cluster scoped resource to represent a "tenant", which spins off many resources into a new namespace with the corresponding namespace name. without this merge we can only see the namespace, which is a huge bummer

@crenshaw-dev
Copy link
Collaborator

@alexmt can you take another look?

@the-scott-hand
Copy link

is this issue dead? would love to see this feature get added

@nicknezis
Copy link

I would also really like to have this feature. It's a big deficiency from the perspective of our management team. What is blocking this feature being added?

Are more changes needed? Is there an external dependency?

@chetan-rns
Copy link
Member Author

@alexmt @crenshaw-dev The PR is ready for review. Please let me know if there are any changes needed

@empath-nirvana
Copy link

@alexmt You asked me at kubecon to remind you about this PR -- said it's possible to enable this as a feature flag because of performance implications?

@alexmt
Copy link
Contributor

alexmt commented Oct 31, 2022

Thank you for bringing this up @empath-nirvana ! Yeah, main concern was how this change might affect performance. Adding a feature flag is a good compromise.

@alexmt
Copy link
Contributor

alexmt commented Oct 31, 2022

@chetan-rns can you please allow conditionally disable analyzing cluster level resource children to mitigate performance degradation?

@FlorisFeddema
Copy link

FlorisFeddema commented Jan 17, 2023

@chetan-rns Is there any progress on this issue?
We would love to see this added since we are now missing tracking of some of our custom resources.

Copy link
Contributor

@leoluz leoluz left a comment

Choose a reason for hiding this comment

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

please check my comment

pkg/cache/cluster.go Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Jan 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 2 Security Hotspots
Code Smell A 5 Code Smells

No Coverage information No Coverage information
1.7% 1.7% Duplication

@the-scott-hand
Copy link

@chetan-rns are there any remaining blockers for this feature to be added? Would love to see this make it into a release!

@chetan-rns
Copy link
Member Author

@the-scott-hand I've resolved the review comments @crenshaw-dev @leoluz Please do let me know if there are any other changes required to get this in.

@crenshaw-dev crenshaw-dev requested a review from leoluz April 3, 2023 13:47
@@ -1032,6 +1050,12 @@ func (c *clusterCache) onNodeRemoved(key kube.ResourceKey) {
if len(ns) == 0 {
delete(c.nsIndex, key.Namespace)
}

nsAll, ok := c.nsIndex[""]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand this line. Why c.nsIndex[""] and then delete by key instead of "".

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for the confusion. The nsIndex is a map of map and I was using a reference of the internal map in IterateHierarchy() . Since it was updating the original nsIndex I was removing the updated element here.

I have now changed it to use a copy of the internal map instead of a reference so that we get rid of this update here.

pkg/cache/cluster.go Show resolved Hide resolved
@the-scott-hand
Copy link

@leoluz @crenshaw-dev @chetan-rns any blockers or remaining changes that need to be made to get this merged and included in a release?

@lorelei-rupp-imprivata
Copy link

We really would love to get this fix here, as we really want argo to manage and track resources created by operators, such as the gpu operator by nvidia, it hits this bug when you deploy it

@crenshaw-dev
Copy link
Collaborator

@chetan-rns are you still able to work on this?

@chetan-rns chetan-rns force-pushed the fix-cluster-resources branch 2 times, most recently from 597e8ee to 78e42e9 Compare November 3, 2023 05:52
Copy link

sonarcloud bot commented Nov 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
1.8% 1.8% Duplication

@chetan-rns
Copy link
Member Author

@crenshaw-dev Thank you for your patience. I've addressed your comments. PTAL.

@stefan01
Copy link

Is there anything blocking this PR?

@crenshaw-dev
Copy link
Collaborator

@chetan-rns could you open an Argo CD PR using this branch so we can run tests there? Besides that, I think this is good to go.

Copy link

sonarcloud bot commented Feb 27, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarCloud

idea Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

@chetan-rns
Copy link
Member Author

@crenshaw-dev I've rebased the existing Argo CD PR pointing to this branch.

argoproj/argo-cd#8222

I think the SonarCloud check is failing due to issues already in the master.

@the-scott-hand
Copy link

@chetan-rns @crenshaw-dev Anything else blocking this PR? Would love to see this feature finally added!

chetan-rns and others added 8 commits April 23, 2024 12:02
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: Lukas Wöhrl <lukas.woehrl@plentymarkets.com>
Copy link

sonarcloud bot commented Apr 23, 2024

Quality Gate Passed Quality Gate passed

Issues
4 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
1.9% 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