-
Notifications
You must be signed in to change notification settings - Fork 47
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
refactor: Prepare controller code for watching single namespace #987
Conversation
/retest |
Do you have some data about it, how much it improved memory load of the operator? What it was before, and will be after this PR is merged? |
I don't have much data, but it makes sense. Currently the operator is caching all objects of certain type that are in the cluster, like The only data I have is in the linked jira ticket: https://issues.redhat.com/browse/CNV-38130 |
This PR is only a refactoring. I'm still working on the change that will limit which objects are cached. |
@@ -113,32 +122,55 @@ func (r *sspReconciler) setupController(mgr ctrl.Manager) error { | |||
builder := ctrl.NewControllerManagedBy(mgr) | |||
watchSspResource(builder) | |||
|
|||
r.areCrdsMissing = len(r.crdList.MissingCrds()) > 0 | |||
s.areCrdsMissing = len(s.crdList.MissingCrds()) > 0 |
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.
This could be missing CRDs of other Controllers too, right?
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.
Yes, thanks for noticing. I will open a separate issue to fix this.
It does not break anything, but the resulting error message can be confusing.
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.
ACK
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Exposing the pod's namespace as an environment variable is cleaner than reading a file. Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Defined "Controller" interface that will be useful in future commits, and implemented this interface for VM controller. Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
This will be useful in a future PR, where we setup the cache in client according to what controllers need. Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
b14ccc4
to
a58ace9
Compare
Quality Gate passedIssues Measures |
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.
/approve
Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 0xFelix The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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
What this PR does / why we need it:
This is a refactoring PR before limiting the operator to watching SSPs only from a single namespace.
The main goal of this is to create controllers before creating the Manager. Then in a future PR, each controller will expose information needed to configure cache to only watch certain namespaces or labels. It will improve memory load of the operator.
Which issue(s) this PR fixes:
Jira: https://issues.redhat.com/browse/CNV-38130
Jira: https://issues.redhat.com/browse/CNV-41247
Release note: