-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat : Valid (SingleNamespaced) Operator Installation in tenant namespace #2589
base: main
Are you sure you want to change the base?
Conversation
98cb58b
to
56d4773
Compare
from change #2589: |
1f928d0
to
e3fd824
Compare
from change #2589: |
33278d6
to
26570f7
Compare
from change #2589: |
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.
Initial set of comments
fad4dfa
to
822dfe9
Compare
2ba0ff8
to
475f7b6
Compare
from change #2589: |
tests/operator/suite.go
Outdated
operatorNamespaces := make(map[string]bool) | ||
for _, operator := range env.Operators { | ||
operatorNamespaces[operator.Namespace] = true | ||
} | ||
|
||
for operatorNamespace := range operatorNamespaces { |
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.
Just thinking aloud.
operatorNamespaces := make(map[string]bool) | |
for _, operator := range env.Operators { | |
operatorNamespaces[operator.Namespace] = true | |
} | |
for operatorNamespace := range operatorNamespaces { | |
singleNamespaceOperators := make(map[string]bool) | |
for _, operator := range env.Operators { | |
// Add short circuit/not add cluster wide namespace to the list. | |
singleNamespaceOperators[operator.Namespace] = true | |
} | |
for operatorNamespace := range singleNamespaceOperators { |
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 mark this as resolved by adding a new helper function to generate all non-compliant object message which would help to understand what conditions fail this test. Unit test is added for the same as well.
100a06b
to
4a90823
Compare
f1e2476
to
0e6d3e1
Compare
tests/operator/helper.go
Outdated
if len(podsBelongingToNoOperators) == 0 && allOperatorsFoundInNamespaceAreValid { | ||
return true, singleNamespacedCsvs, allNamespacedCsvs, podsBelongingToNoOperators, nil | ||
} else { | ||
return false, singleNamespacedCsvs, allNamespacedCsvs, podsBelongingToNoOperators, err |
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.
return nil here
validOwnerFound := false | ||
for _, owner := range topOwners { | ||
if owner.Kind == v1alpha1.ClusterServiceVersionKind && owner.Namespace == namespace { | ||
foundCsvs[owner.Name] = 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.
We may need more checks here. other valid top owner could be the operands created based on the crds installed by this operator. Actually these operands can only be installed in the single operator namespace. For instance, for prometheus, pods belonging to the prometheus object top owner should be valid. We could list all the crds installs by this operator by reading the crd label: "operatorframework.io/installed-alongside-..." or similar then use the crd name to identify valid top owners.
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.
@edcdavid that's only valid for operators installed with the ownNamespace mode. For singleNamespace operators, the controller is running in namespace A and watches for CRs in namespace B, so, in theory, operand pods should only be found in namespace B.
The problem is the requirement only referes to SingleNamespaced and AllNamespaced operators... so what about ownNamespaced and multiNamespaced ones?
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.
ah, you are right about single namespace vs own namespace, in single namespace only mode, the operand should be in only in namespace B, sorry for the confusion. So in this case, we still need a way to ignore the csv that will be created in namespace B otherwise it will be picked up as an operator namespace.
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.
The problem is the requirement only referes to SingleNamespaced and AllNamespaced operators... so what about ownNamespaced and multiNamespaced ones?
In my opinion, the multi namespace is similar to the single namespace and it would make sense to support it here.
from change #2589: |
a019beb
to
23f4b89
Compare
from change #2589: |
from change #2589: |
from change #2589: |
from change #2589: |
Refers the issue