Code Monkey home page Code Monkey logo

Comments (3)

nolar avatar nolar commented on August 19, 2024

Quick-check results:

It might look like a good idea to use CustomObjectsApi() for the built-in resources too, e.g. @kopf.on.event('', 'v1', 'pods') — as an expected semantics. Sadly so, the resulting URLs are different:

Built-in V1 pods URL: /api/v1/namespaces/default/pods
Via custom resources: /apis//v1/namespaces/default/pods

First of all, the /api vs /apis is a problem, which leads to "404 Not Found".
Second, the double-slash // is a problem, it also returns "404 Not Found" (event with /api/).
When both of these are hacked, it works as expected.

The URL parts are quoted, so it is impossible to do anything like @kopf.on.event('../api', 'v1', 'pods'), as the resulting URL becomes /apis/..%2Fapi/v1/namespaces/default/pods.


Which means, there is no easy hack in Kopf itself to get to the built-in resources with the official client with all the hard-coded URLs. Runtime monkey-patching of the client library might be a bad idea for the stability of the Kopf-based operators that use this library.

So, the choice is either to map every known builtin resource to proper classes&methods, which means making Kopf into a Kubernetes client library (which is not the framework's mission), or using another Kubernetes client with dynamic mapping of any resources, builtin and custom, via the same interface.

from kopf.

nolar avatar nolar commented on August 19, 2024

This is actually solved in #15 as a side-effect (but needs to be merged first).

from kopf.

cliffburdick avatar cliffburdick commented on August 19, 2024

@nolar is there an example of watching a pod under a parent crd? I noticed you sketched ideas in several issues, but I'm not sure which you ended up on.

from kopf.

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.