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

codegen for openshift/origin APIs? #214

Open
rudoi opened this issue Sep 16, 2018 · 11 comments
Open

codegen for openshift/origin APIs? #214

rudoi opened this issue Sep 16, 2018 · 11 comments
Labels
help-wanted We'd love your contributions on this issue kind/enhancement Improvements or new features

Comments

@rudoi
Copy link

rudoi commented Sep 16, 2018

From the Makefile, I see that code generation is based on the openapi spec for the specified KUBE_VERSION.

There are a few custom objects in Origin that aren't part of the Kubernetes api spec (Route, BuildConfig, etc).

Would support for Origin be achieved by simply pointing the codegen at the Origin openapi spec? I understand that would need to be a completely separate release/build/etc, but I'm curious if it would be that simple. 🍕

@hausdorff
Copy link
Contributor

In principle we should be able to share much or the codegen routines, but i'm not sure how time-intensive they would be to adapt. I'm guessing we'll either want to fork this codegen or adapt it to handle both cases, though I'm not sure when we'd get to that (significant customer interest makes it much more likely).

The reason why involves a bit of history: the unfortunate truth is that the Kubernetes OpenAPI spec is quirky and capricious enough that our codegen routines don't always work even between Kubernetes versions. We would use the official OpenAPI codegen routines, but they generate monstrous code, and because Kubernetes changes the way the types are addressed in the spec fairly frequently, tracking that would cause us to make breaking changes every minor Kubernetes release.

@lukehoban
Copy link
Member

I think (correct me if I'm wrong!) that @rudeland's original question here was just whether it would be possible for the @pulumi/kubernetes code generator to be pointed at the Origin API spec to create the wrappers for the additional resources defined there.

I believe the answer is yes. These may need additional logic in awaiters and elsewhere to customize the behaviour.

The question though would be how to distribute these additional APIs. It's not clear they should be part of @pulumi/kubernetes - but is is possible to deliver them separately?

Note also that I believe that technically - you could use these Origin APIs without needing the strongly-typed code-generation. @hausdorff Is that possible and if so do you have an example? This may be part of how to answer the question in the previous paragraph.

@rudoi
Copy link
Author

rudoi commented Sep 17, 2018

Understood. Thanks for that clarification!

@rudoi rudoi closed this as completed Sep 17, 2018
@lukehoban lukehoban added this to the 0.18 milestone Sep 17, 2018
@rudoi
Copy link
Author

rudoi commented Sep 17, 2018

Re-opening as @lukehoban commented exactly when I did. 😎

That was my original question, yes. I was curious if those APIs would just work wholesale. I was able to get route.openshift.io/v1/route to work, for example, with only a few slight modifications, but was wondering how quickly that would become unmaintainable.

@rudoi rudoi reopened this Sep 17, 2018
@hausdorff
Copy link
Contributor

hausdorff commented Sep 18, 2018

To clarify, I do think you can adapt the codegen routines to generate a library for OpenShift, but it's not clear to me how hard it is to do.

Remember: it is difficult to use these codegen routines even between minor versions of Kubernetes, because the OpenAPI spec is so volatile. This is to say nothing of the transition to OpenShift, which is a different project.

One example: from Kubernetes 1.8 -> 1.9, the types names changed from the form V1beta2Deployment -> IoK8sKubernetesPkgApisAppsV1beta2Deployment, which forced all downstream clients to break and rev major versions. In order to provide a stable experience for our users, we needed to map both of these type names to a stable class name (in this case k8s.apps.v1beta2.Deployment).

This sort of work is very nitty, detail-intensive work, and it can't be automated. We would need to undertake a similar process to get OpenShift support, too. I think we should not underestimate the time that will take.

Also, FWIW, I very seriously doubt that generating the types will be an impediment to the time to deliver a solution. Historically, just parsing the OpenAPI spec has been the serious time suck, probably by a factor of 10.

@hausdorff
Copy link
Contributor

@rudeland I think we can keep this open, it's something I expect we'll get asked about more, and we'll probably want to decide what we want to do. :)

@hausdorff
Copy link
Contributor

I'm tentatively moving this to M19 since I don't think I have enough time to address it in M18. @rudeland if you happen to want to do this work for M18, I'm happy to facilitate/get on calls/review code. :)

@hausdorff hausdorff modified the milestones: 0.18, 0.19 Sep 23, 2018
@rudoi
Copy link
Author

rudoi commented Sep 23, 2018

@hausdorff that sounds like a plan. I'll do some homework and see how much API-breaking Origin does, too. :)

I imagine other people will ask about this, but to be honest I don't actually view it as that critical. OpenShift/Origin don't have THAT many unique objects, and it took me only a few minutes to amend the already-generated code for the 2 unique objects I actually use.

@hausdorff hausdorff modified the milestones: 0.19, 0.20 Oct 22, 2018
@hausdorff hausdorff removed this from the 0.20 milestone Dec 18, 2018
@hausdorff hausdorff added the help-wanted We'd love your contributions on this issue label Dec 18, 2018
@albestia
Copy link

I'm really interested on Pulumi OpenShift support. For me, sounds good to have a new pulumi resource provider called pulumi-openshift that depends on the specific version of pulumi-kubernetes compatible with that OpenShift implementation.
I'm not sure I have enough knowledge about pulumi to assert my proposal, but sounds nice in my mind :P.
If I can help in any way, just guide me please.

@lukehoban lukehoban assigned lblackstone and unassigned hausdorff Nov 27, 2019
@infin8x infin8x added kind/enhancement Improvements or new features and removed kind/feature labels Jul 10, 2021
@lblackstone lblackstone removed their assignment Jul 14, 2023
@AvlWx2014
Copy link

Just catching up on this. Started learning about Pulumi recently and wanted to see if support for Routes is possible before I venture too far since the project I'm targeting to use Pulumi is Openshift based.

Sounds like there's no Pulumi Openshift API, but it's probably enough if we can extend the existing Pulumi Kubernetes API to add custom resource definitions like Route. Sadly if even that's not possible I'll have to abandon ship and hope first-class support for e.g. openshift-* type Pulumi projects is added in the future.

@blampe
Copy link
Contributor

blampe commented Aug 22, 2024

@rquitales is currently working on something to this effect -- #3121 might be the best public-facing issue. Stay tuned!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted We'd love your contributions on this issue kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

8 participants