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

Refactor third party extensions to make it easy to add own extensions #299

Closed
jimmidyson opened this issue Feb 11, 2016 · 11 comments
Closed

Comments

@jimmidyson
Copy link
Contributor

Third party extensions are used to extend kubernetes. If we make it easy to add third party extensions then this library can be used as a base to build services around kubernetes. We could add helpers to create rest APIs in spring boot/wildfly swarm/etc for the normal rest ops & watch functionality. A good poc for this would be certificate generation via letsencrypt & also Jenkins build integration potentially.

@jimmidyson
Copy link
Contributor Author

@iocanel Thinking about what we need to create a client for a third party resource would look like. Kube API details at https://github.com/kubernetes/kubernetes/blob/master/docs/design/extending-api.md.

Thinking something like client.extensions().thirdPartyResources().newClient(apiGroup, apiVersion, resourceClass, resourceListClass, resourceDoneableClass) but that just reads horribly.

Or how about client.extensions().thirdPartyResources().newClient().withApiGroup(apiGroup).withApiVersion(apiVersion).withResourceClass(resourceClass).build() with all those things required. List & Doneable classes can be inferred from resource class.

@jimmidyson
Copy link
Contributor Author

Forget this for a while until third party resources is more stable & usable in Kubernetes & maybe even adopted in OpenShift.

@prashantchitta
Copy link

@jimmidyson We are looking to query thirdparty resources through fabric8 kubernetes client. Looking at the above conversation, it does not look like it is supported currently. Is there any plan to support? If not, could you give any idea of how to implement it?

We created a thirdpartyobject called "clusters" in kubernetes and saving all the cluster related information there. From one of the pods I need to retrieve that information programatically. I am using fabric8 kubernetes client for it.

I can run the below command and get the response. I need similar using fabric8 client.
curl http://localhost:8080/apis/test.io/v1/clusters
{
"kind": "ClusterList",
"items": [ {"apiVersion":"test.io/v1","kind":"Cluster","metadata":{"namespace":"default","selfLink":"/apis/test.io/v1/namespaces/default/clusters/prodtest01","uid":"bc4764f4-1c54-11e6-a2ae-74dbd1809b75","resourceVersion":"892","creationTimestamp":"2016-05-17T17:28:14Z"},"spec":{"name":"prodtest01","vpc":"prod"}}
]
}

@jimmidyson
Copy link
Contributor Author

jimmidyson commented Jun 8, 2016

Right now there is no way to do this but I do want to make it possible, just not got time in the near future. I'd happily accept a PR that adds this. My thoughts on how to do it would be to have a method on thirdPartyResources that accepts the required info (e.g. api group, api version, resource name & annotated resource type) & returns a client that can do the basic crud+watch stuff.

@prashantchitta
Copy link

@jimmidyson I would love to contribute and send PR.
Could you let me know where to start? Is it the ThirdPartyResourceOperationsImpl.java file that i have make changes? If you could give me some reference of other files where this kind of implementation is done, it would be great.

@tazjin
Copy link

tazjin commented Sep 19, 2016

Hey, I currently need this functionality for a project I'm working on (see issue linked above).

Is anyone working on this? If not I'll probably take a look soon-ish.

@jimmidyson
Copy link
Contributor Author

No-one is looking at this yet - would love a contribution! Look forward to it.

@iyanuobidele
Copy link
Contributor

Any progress on this, or some fork currently working on this ?

cc @jimmidyson @tazjin @prashantchitta

@tazjin
Copy link

tazjin commented Nov 19, 2016

@iyanuobidele Not yet, we only needed simple CRUD operations for our TPRs so we went the evil way and did this:

  @SneakyThrows
  private static OkHttpClient getClient(BaseClient client) {
    final Field field = BaseClient.class.getDeclaredField("httpClient");
    try {
      field.setAccessible(true);
      return (OkHttpClient) field.get(client);
    } finally {
      field.setAccessible(false);
    }
  }

That HTTP client is configured to set correct authentication settings.

@erikerlandson
Copy link

@tazjin you should consider posting a little Q&A for your useful hack up on stackoverflow. I put one up about adding resource reqs, to help fill in some of these dark corners of fabric8 client know-how. Maybe append a short example of using the http client from getClient to PUT some json for a TPR object.

@stale
Copy link

stale bot commented Aug 6, 2019

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

@stale stale bot added the status/stale label Aug 6, 2019
@stale stale bot closed this as completed Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants