Comments (9)
@ncdc thank you for the pointer and sorry for the delay.
Adding something like this seems to work:
func ClusterAwareBuilderWithOptions(options cache.Options) cache.NewCacheFunc {
return func(config *rest.Config, opts cache.Options) (cache.Cache, error) {
if options.Scheme == nil {
options.Scheme = opts.Scheme
}
if options.Mapper == nil {
options.Mapper = opts.Mapper
}
if options.Resync == nil {
options.Resync = opts.Resync
}
if options.Namespace == "" {
options.Namespace = opts.Namespace
}
if opts.Resync == nil {
opts.Resync = options.Resync
}
return kcp.NewClusterAwareCache(config, options)
}
}
I would think it belongs to the wrapper. What do you think?
cc @varshaprasad96
from controller-runtime.
If you're managing the NewCache function, you need to make sure it does this:
controller-runtime/pkg/kcp/wrappers.go
Lines 62 to 72 in 824b15a
from controller-runtime.
from controller-runtime.
Note: "seems to work" except that there is no label conversion for APIBinding so that I cannot filter through spec.reference.workspace.exportName and spec.reference.workspace.path but it would work for Pods for instance. Obviously the fact that not many resources support the mechanism significantly diminishes its value
from controller-runtime.
Yeah, field selectors are very hard-coded and limited :|
from controller-runtime.
Could you use an index here?
from controller-runtime.
Could you use an index here?
I am not sure to follow. My understanding is that indexes help with retrieving resources from cache not avoiding them to get cached. Please let me know what I am missing. My original intent was not to cache the resources that I don't need to save some memory. As a workaround I am filtering the event and add unnecessary apibindings into the cache. As I am not expecting a huge amount of apibindings it is not a major concern for me.
An open question is: do we see value in making a cluster aware version of controller-runtime BuilderWithOptions?
As you stated for field selectors it is not granted but possibly for the other configurations? I am happy to create a PR if the answer is yes.
from controller-runtime.
Please let me know what I am missing.
Sorry, I didn't realize your intent was to make your cache size smaller in memory. The index won't help there.
do we see value in making a cluster aware version of controller-runtime BuilderWithOptions?
I swear we had a PR open to do this .. yes, I think it's a good idea ish.
from controller-runtime.
ack. I will look at that tomorrow.
from controller-runtime.
Related Issues (16)
- Provide instructions / examples for writing tests with kcp-dev/controller-runtime & envtest HOT 5
- Unable to use controller-runtime for ClusterWorkspaceType initializer HOT 7
- Update to logicalcluster v2 HOT 7
- Add test that verifies multi-cluster behavior HOT 5
- Matching controller-runtime & kcp HOT 6
- APIReader client is not cluster-aware
- Failed to create Event in KCP using standard way HOT 4
- Godoc what we added for kcp
- Respect custom cache function HOT 2
- List requests with field selector are not cluster scoped
- Look into discovery/dynamic rest mapper HOT 1
- Update to Kubernetes 1.28 HOT 3
- controller runtime client list fails with error "Index with name cluster does not exist"
- Set up CI
- Cluster aware Client does not use cluster aware RESTMapper HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from controller-runtime.