-
Notifications
You must be signed in to change notification settings - Fork 246
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: check resource namespaces are managed #143
Conversation
Signed-off-by: John Pitman <jpitman@redhat.com>
Codecov Report
@@ Coverage Diff @@
## master #143 +/- ##
==========================================
+ Coverage 53.79% 54.07% +0.28%
==========================================
Files 25 25
Lines 2400 2415 +15
==========================================
+ Hits 1291 1306 +15
Misses 974 974
Partials 135 135
Continue to review full report at Codecov.
|
pkg/cache/cluster.go
Outdated
return true | ||
} | ||
if len(namespace) == 0 { | ||
return true |
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 should return false here. If len(namespace) == 0
is true then resource is a cluster-level resource. Cluster level resources are not managed if cluster is connected in namespaced mode so we should return false.
if namespace == "" {
return false
}
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've made the suggested change.
Signed-off-by: John Pitman <jpitman@redhat.com>
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
Hi @alexmt the SonarCloud failure look like it's due to duplicated code in the tests I added. I think that eliminating the duplication will make the tests harder to understand. Do you want me to eliminate the duplication anyway? |
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
@jopit the SonarCloud check is optional. I think it is ok to have duplication in test |
Signed-off-by: John Pitman jpitman@redhat.com
Related to argoproj/argo-cd#4329
Return an error from
clusterCache.GetManagedLiveObjs
if we find a target object in a namespace that is not managed by the cluster.