Giter Site home page Giter Site logo

Comments (10)

slok avatar slok commented on August 30, 2024

Hi @AllenZMC!

When you say retrieve what do you mean? when do you retrieve objects with kooper?, the object that you receive from kooper on each reconciliation loop iteration, is retrieved from the cache, and these objects are only updated when changes happen (that's the watcher purpose), the lister is used on start to get the initial full list of objects.

from kooper.

AllenZMC avatar AllenZMC commented on August 30, 2024

Hi @slok . See the following code. Is the operation to get the configmap obtained from the cache or directly access k8s etcd? (I use kooper in my operator)
Because getting resources such as pods or configmap from the cache is faster, which can reduce the pressure of etcd.

configMap, err := p.kubeClient.CoreV1().ConfigMaps(namespace).Get(name, metav1.GetOptions{})

from kooper.

slok avatar slok commented on August 30, 2024

Where is that line?

from kooper.

AllenZMC avatar AllenZMC commented on August 30, 2024

This code is in spotahome/redis-operator

from kooper.

AllenZMC avatar AllenZMC commented on August 30, 2024

I hope to quickly access the k8s resources such as pod, configmap, etc. in the operator.

from kooper.

AllenZMC avatar AllenZMC commented on August 30, 2024

Obtaining k8s resources such as pods and configmaps from the cache is faster than directly accessing etcd

from kooper.

slok avatar slok commented on August 30, 2024

oh, I understand now what do you mean.

That's business logic of the operator, not the operator framework itself, Kooper has nothing to do with that, Kooper maintains a reconciliation loop on specific resources, these resources are the ones that trigger the iteration handling of that resource changes, and this handling code is logic of the application (in this case the redis operator logic), so... the app should maintain it's own cache on the resources it wants.

Imagine those other resources as regular resources of any kind, a database query, a query to AWS API, a query to K8s API... whatever, Kooper is out of that scope of these resources.

Kooper caches the resources on what the reconciliation loop is based on, in this case, the RedisFailover CRDs, if the iteration logic needs to access to different resources (Redis commands, other Kubernetes resources, database access...) is part of the app, and is out of the scope of Kooper and the responsibility is on the app implementation.

from kooper.

AllenZMC avatar AllenZMC commented on August 30, 2024

OK, thanks.

from kooper.

slok avatar slok commented on August 30, 2024

Apart from that, Kooper only retrieves the resources it is subscribed to, so it will only cache those ones, so if my operator is based on pods, and when handling each pod log it access an ingress, Kooper cache will not have ingresses. So in case you could access the cache, the resources would not be stored there.

from kooper.

slok avatar slok commented on August 30, 2024

Can I close the issue? or do you have more questions regarding this (or maybe I didn't explain correctly 😞)

from kooper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.