Git Product home page Git Product logo

Comments (5)

aantn avatar aantn commented on June 15, 2024
from kubernetes import config
config.load_kube_config()

import hikaru
from hikaru.model import *

class TestPod(Pod):
    pass


hikaru.register_version_kind_class(TestPod, Pod.apiVersion, Pod.kind)
l: PodList = PodList.listNamespacedPod("somens").obj
for p in l.items:
    print(type(p))

from hikaru.

aantn avatar aantn commented on June 15, 2024

Scenario 2: register_version_kind_class seems to be entirely broken for Job objects (perhaps because it isn't in the regular API group?)

First run: kubectl apply -f https://kubernetes.io/examples/controllers/job.yaml
Then run the following code:

from kubernetes import config
config.load_kube_config()

import hikaru
from hikaru.model import *

class TestJob(Job):
    pass


hikaru.register_version_kind_class(TestJob, Job.apiVersion, Job.kind)
j = Job.readNamespacedJob("pi", "default").obj
print(type(j))

from hikaru.

haxsaw avatar haxsaw commented on June 15, 2024

You managed to find two bugs related to registration. tl;dr, both are fixed on the dev branch.

The first issue, where a pod list didn't have the right derived pod classes, was an oversight on consulting the registry when those kinds of embedded objects were encountered in a list. Actually, there are two places where this happens, and both are fixed.

The second, involving registering a Job subclass, is a disagreement between what the doc advises and the implementation. Internally, Hikaru has no use for groups at runtime and so all registrations are based on version and kind alone (no group value). But the doc suggests using 'apiVersion' during registration, and some of those have groups in them. I decided that I like the documentations usage a bit better, so I changed the implementation to remove the group for you (it will work with pure version strings as well). In the short term, you could have gotten around this by registering a Job without the group portion of apiVersion.

from hikaru.

aantn avatar aantn commented on June 15, 2024

from hikaru.

haxsaw avatar haxsaw commented on June 15, 2024

Fixed in 0.5b

from hikaru.

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.