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: namespaced resources owned by cluster scoped resources don't show up in the UI #8222

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

Conversation

chetan-rns
Copy link
Member

@chetan-rns chetan-rns commented Jan 19, 2022

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

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

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).
  • 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.
  • Optional. My organization is added to USERS.md.
  • 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).

Currently, the namespaced resources owned by cluster scoped resources are not shown on the UI. This PR uses the right namespace for parent resources instead of copying the same namespace as the resource

GitOps Engine: argoproj/gitops-engine#366
Fixes: #7733

@chetan-rns chetan-rns changed the title fix: namespaced resources owned by clusterscoped resources don't show up in the UI fix: namespaced resources owned by cluster scoped resources don't show up in the UI Jan 19, 2022
@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

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

Project coverage is 49.56%. Comparing base (f87897c) to head (d57cb2e).
Report is 81 commits behind head on master.

❗ Current head d57cb2e differs from pull request most recent head 539a7c6. Consider uploading reports for the commit 539a7c6 to get more accurate results

Files Patch % Lines
controller/cache/cache.go 32.00% 17 Missing ⚠️
controller/appcontroller.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8222      +/-   ##
==========================================
- Coverage   49.73%   49.56%   -0.17%     
==========================================
  Files         274      273       -1     
  Lines       48948    48329     -619     
==========================================
- Hits        24343    23955     -388     
+ Misses      22230    22011     -219     
+ Partials     2375     2363      -12     

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

Comment on lines +196 to +263
if isNamespaced, _ := c.IsNamespaced(ownerGvk.GroupKind()); isNamespaced {
namespace = r.Ref.Namespace
}
Copy link
Member

Choose a reason for hiding this comment

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

I was just wondering if we need to check the namespace of the resource being allowed by the AppProject of the owning application? While a namespace-scoped object only refers to an owner in the same namespace, this check was not required. But a cluster-scoped owner can be referred to from any namespace, and the application managing the owner might not have access to those namespaces.

Would it be wise to display the dependents in non-allowed namespaces then?

@@ -596,7 +596,7 @@ export const ApplicationResourceTree = (props: ApplicationResourceTreeProps) =>
if (treeNodeKey(child) === treeNodeKey(root)) {
return;
}
if (node.namespace === child.namespace) {
if (node.namespace === child.namespace || node.namespace === undefined) {
Copy link
Contributor

@keithchong keithchong Apr 7, 2022

Choose a reason for hiding this comment

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

Hi @chetan-rns, help me to understand why/when the node namespace will be undefined as opposed to default? This part sets the edges (lines) between 'parent' nodes and the child nodes. So if the child node's namespace is defined OR undefined, then there will be lines connecting to them all. Is this intentional?

@blakebarnett
Copy link
Contributor

Is the only thing blocking this a rebase? This would be super useful.

@chetan-rns
Copy link
Member Author

@blakebarnett We need to get argoproj/gitops-engine#366 PR merged first which is under review

@woehrl01
Copy link
Contributor

woehrl01 commented Apr 6, 2024

Any chance to bring this into 2.11? @chetan-rns @crenshaw-dev

@woehrl01
Copy link
Contributor

woehrl01 commented Apr 15, 2024

@chetan-rns

We just built our own version to test that fix, we saw that the namespaced children are now visible in the UI, great 🎉 ! What we still don't see is the children of the children. e.g. Pods are not attached to the deployment, if the deployment is created by a cluster scoped resource. We can see the sub children for cluster scoped resources. Do you experience the same, or do you know what to enable to make that work, too?

@woehrl01
Copy link
Contributor

@chetan-rns Just pushed a PR to your fork, to also display grand children correctly: chetan-rns/gitops-engine#1

@chetan-rns
Copy link
Member Author

@woehrl01 Thanks for your help! The logic looks good. I will test it out once.

…w up in the UI

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
…ster resources

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
@chetan-rns chetan-rns force-pushed the fix-cluster-owned branch 2 times, most recently from 7413ed1 to 6d9ed6e Compare April 23, 2024 05:17
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Issue/PR had no activity for a long time and should be closed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Namespaced resources owned by clusterscoped resources don't show up in the UI.
6 participants