Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide pre-built models for all core k8s resource #34

Open
Roni1993 opened this issue Jan 16, 2022 · 3 comments
Open

Provide pre-built models for all core k8s resource #34

Roni1993 opened this issue Jan 16, 2022 · 3 comments

Comments

@Roni1993
Copy link

I'm currently looking into using pykorm for a small project that I'm building with kopf. So far I've been using pykube but I'm not really happy with it's API.
pykorm looks very promising as it allows to properly map my CRD & core k8s resource to python objects.

One thing that are not clear to me or maybe might be missing are default models within pykorm for all the existing core resources.
Based on the example below i assume that i would need to build the models on my own?

@pykorm.pykorm.k8s_core(kind='Event')
class Event(pykorm.models.NamespacedModel):
action: str = pykorm.fields.DataField('action')
reason: str = pykorm.fields.DataField('reason')
type: str = pykorm.fields.DataField('type')
message: str = pykorm.fields.DataField('message')
@pykorm.pykorm.k8s_core(kind='Pod')
class Pod(pykorm.models.NamespacedModel):
_conditions: list = pykorm.fields.Status('conditions')
_containerStatuses: list = pykorm.fields.Status('containerStatuses', default=[])
_containers: list = pykorm.fields.Spec('containers', default=[])
_init_containers: list = pykorm.fields.Spec('initContainers', default=[])
_initContainerStatuses: list = pykorm.fields.Spec('initContainerStatuses', default=[])
phase: str = pykorm.fields.Status('phase')

If that is the case I'd propose to build these models & then create a PR to merge them into this lib

@Frankkkkk
Copy link
Owner

Hi @Roni1993 , yes exactly. I didn't have the time to do it but if you propose to do so I'd gladly accept your MR !

Cheers,

@Roni1993
Copy link
Author

alright, sounds good!

I've started with a few models today and figured it might make sense if i create a WIP MR so that you can check out the progress & also review the changes on the fly?
Python is not my main language so it might be nice to get early feedback before a create a huge MR.

@Frankkkkk
Copy link
Owner

Hi @Roni1993 Sorry for the delay. Yes of course, no problem (and hopefully I'll me quicker next time :) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants