-
Notifications
You must be signed in to change notification settings - Fork 18
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
#587 - Disable caching for packageRevisionResources #55
Conversation
Signed-off-by: Kushal Harish Naidu <kushal.harish.naidu@ericsson.com>
This is a generated file based on kubebuilder directives in the controller go code. Please update those instead of this file. |
Sure, I'll make the change. |
Signed-off-by: Kushal Harish Naidu <kushal.harish.naidu@ericsson.com>
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
Looks fine to me, let's get some more reviews.
@@ -73,6 +73,8 @@ const ( | |||
//+kubebuilder:rbac:groups=config.porch.kpt.dev,resources=packagevariantsets/status,verbs=get;update;patch | |||
//+kubebuilder:rbac:groups=config.porch.kpt.dev,resources=packagevariantsets/finalizers,verbs=update | |||
//+kubebuilder:rbac:groups=config.porch.kpt.dev,resources=packagevariants,verbs=create;delete;get;list;patch;update;watch | |||
//+kubebuilder:rbac:groups=porch.kpt.dev,resources=packagerevisions,verbs=create;delete;get;list;patch;update;watch |
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.
If we really need this, which I can't see why we do, maybe refine the roles to only the required ones. list and watch.
@@ -73,6 +73,8 @@ const ( | |||
//+kubebuilder:rbac:groups=config.porch.kpt.dev,resources=packagevariantsets/status,verbs=get;update;patch | |||
//+kubebuilder:rbac:groups=config.porch.kpt.dev,resources=packagevariantsets/finalizers,verbs=update | |||
//+kubebuilder:rbac:groups=config.porch.kpt.dev,resources=packagevariants,verbs=create;delete;get;list;patch;update;watch | |||
//+kubebuilder:rbac:groups=porch.kpt.dev,resources=packagerevisions,verbs=create;delete;get;list;patch;update;watch | |||
//+kubebuilder:rbac:groups=porch.kpt.dev,resources=packagerevisionresources,verbs=create;delete;get;list;patch;update;watch |
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.
Update controllergen to v0.15.0 and run make generate.
As I mentioned, the setup here is a bit messy. The changes here only get generated if/when we run the "make generate" target. The updated Roles/Bindings are updated but the reality is that the catalog porch pkg itself needs to be updated also. https://github.com/nephio-project/catalog/blob/main/nephio/core/porch/9-porch-controller-packagevariantsets-clusterrole.yaml
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.
Hey Fiachra, yes, I have discussed with greg, we're trying to reproduce this issue and re-verify. Might need an update to the code itself. Also, I just re-used the same roles from packagevariant_controller.go. I will refactor this if it is still needed. I've added the do-not-merge label for now.
Signed-off-by: Kushal Harish Naidu <kushal.harish.naidu@ericsson.com>
/remove-approve |
To my understanding the following is the issue:
So the cache was never working, but instead of it failing back ungracefully to requesting the data every time, the cache is disabled by default. An alternative solution could be that watch is implemented for packageRevisionResources. The metadata updates, including the resourceVersion is shared between the packageRevisions and packageRevisionResources. But because packageRevisionResources include all the data from the kpt package itself, building an in-memory cache of those might be quite expensive. And as I understand, there is no cache eviction policy, and packageRevisions are edited for a short time, then they become dormant as they get approved. All in all, I don't think it's a good idea for any client to cache packageRevisionResources. |
Nice explanation. Thanks @nagygergo |
/approve |
Signed-off-by: Kushal Harish Naidu <kushal.harish.naidu@ericsson.com>
/approve |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: efiacor, kushnaidu, liamfallon 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 |
This change disables caching for packageRevisionResources in the porch controller.
Context -
The use case works for creating a PVS, but after someone creates a PVS, the controller logs are populated with errors saying the controllers cannot 'watch' the packageRevisionResources because there is no 'watch' function on the porch server side.
Example -
E0523 16:49:14.393038 1 reflector.go:140] pkg/mod/k8s.io/client-go@v0.26.9/tools/cache/reflector.go:169: Failed to watch *v1alpha1.PackageRevisionResources: the server does not allow this method on the requested resource (get packagerevisionresources.porch.kpt.dev)