Comments (5)
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.
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.
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.
from hikaru.
Fixed in 0.5b
from hikaru.
Related Issues (20)
- Black maybe better be a dev dependency HOT 5
- Node from_dict fails on required field port (in DeamonEndpoint) HOT 3
- List methods aren't assigned to classes consistently HOT 4
- obj.metadata.selfLink is always None HOT 3
- convert underscore to dash implicitely in _clean_dict may introduce in un-expected labels HOT 5
- Hikaru functions should return a specific type HOT 3
- support for auto-generation HOT 4
- VolumeSnapshot missing HOT 11
- deserialize/serialize yaml preserving comments and formatting HOT 1
- Support for Argo Workflows? HOT 4
- Support for K8s v1.25 HOT 5
- Unpin Black version HOT 2
- PodStatus's podIP and hostIP attributes are not set on readNamespacedPod(...) HOT 3
- Import errors HOT 2
- Full correctness checking of objects HOT 1
- Kubernetes 409 when updating CRD with context manager HOT 4
- Errors importing Pod from hikaru on latest version HOT 3
- Missing fields in Pod.spec.containers[*].livenessProbe HOT 8
- Update tests for newer version of pytest
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 hikaru.