-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Generic kubernetes api client #738
Generic kubernetes api client #738
Conversation
note that #86 is solved in this pull, as is shown in the test.. |
2704e24
to
ca376b4
Compare
/hold until #742 in |
@yue9944882 is this ready for review? |
@brendandburns let's freeze the pull until the migration to openapi-generator, the work isn't necessary to get into the next release i think. |
ca376b4
to
bba887e
Compare
0cb7bf9
to
76bfcef
Compare
/hold cancel @brendandburns let's move on reviewing this pull. @runzexia feel free to drop your comments too |
91fac76
to
07f32ff
Compare
@brendandburns bumping for review |
extended/src/main/java/io/kubernetes/client/extended/generic/GenericKubernetesApi.java
Outdated
Show resolved
Hide resolved
|
||
private Class<ApiType> apiTypeClass; | ||
private Class<ApiListType> apiListTypeClass; | ||
private String apiGroup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to use the native Kubernetes object here for this? It has these fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you refering to V1APIGroup? the so-called field "apiGroup" here should be the name of the serving resource api group e.g. apps
, networking.k8s.io
, apiextensions.k8s.io
, etc. while the V1APIGroup
is used for representing all the fundamental information about the an api group . we need only a tiny bit of that, which is V1APIGroup#name. simply a string value would be sufficient, wdyt?
CustomObjectsApi customObjectsApi) { | ||
if ("".equals(apiGroup)) { | ||
throw new IllegalArgumentException( | ||
"core group (\"\") not supported, use CoreV1Api otherwise"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this say use "v1" instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to core group (v1) api not supported, use CoreV1Api instead
, does that sound better?
extended/src/main/java/io/kubernetes/client/extended/generic/GenericKubernetesApi.java
Show resolved
Hide resolved
extended/src/main/java/io/kubernetes/client/extended/generic/options/CreateOptions.java
Outdated
Show resolved
Hide resolved
|
||
import io.kubernetes.client.openapi.models.V1DeleteOptions; | ||
|
||
public class DeleteOptions extends V1DeleteOptions {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the purpose of this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i added a class named ListOptions
in this package and it's probably good to gather those option class into the same package. the DeleteOptions
here is just a link to the generated delete option class. wdyt?
@@ -0,0 +1,71 @@ | |||
package io.kubernetes.client.extended.generic.options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we use the generated class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a new class named ListOption
introduced by this pull. the point of defining option classes here is to provide the developers a better programming interface, which looks making more logical sense comparing to those generated long-list parameters calls. in golang, we have similar option structs defined over the actual API parameters, developer works on that logical options and the SDK translates them to api interface options.. does that make sense to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments. Thanks for this PR!
07f32ff
to
ea084c4
Compare
@yue9944882 fwiw, I'm waiting on responses to the other comments before re-reviewing. Let me know when it's ready for another pass. Thanks! |
@brendandburns am i missing anything? i seem to replied the comments on the page. please let me know, thx! |
Was wondering about this comment: |
I guess it's fine, the plurals and everything else are represented in that object too, afaik. But this seems like a fine place to start. /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, yue9944882 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@brendandburns
NOTE: i will sanitize the pull l8r (the license, formatting, etc..)..
it's neat and simple. w/ the help of this generic client, what we only need is the generated model. i just drafted initial version of code and test, it already covers all the api paths on the kubernetes apiserver.
the general idea is to make use of CustomObjectApi as best as we can, this will help us access custom resources in kubernetes in an easier way. appreciated if you feel like shed some light on it