-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support of Istio Client API #3613
Conversation
fyi @metacosm |
Have you copy-pasted code from Istio Java API? Please preserve commit history We did something similar while porting Service Catalog extension #1605 (review) |
I didn't copy pasted code from the snowdrop repo. I only used the snowdrop repo as a reference ++ migrated the tests to here. |
.../istio/model-v1alpha3/src/main/java/io/fabric8/istio/api/networking/v1alpha3/CorsPolicy.java
Show resolved
Hide resolved
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.
LGTM, with some comments:
- I think we can fix the most of the test related code smells
- Some tests are failing on Windows
FYI, I'm investigating the issue with windows. |
Fixed the Windows check |
I could verify that this PR seems to work fine for us. |
Sometimes the go struct is defined like: ```go type MyClass struct { GoField *GoType `protobuf:"...,json=goField,proto3" json:"go_field,omitempty"` } ``` The json field is wrong ("go_field") and the protobuf field is right "goField". I would say that this is a wrong model, however this is a solution to pick the values from the protobuf section.
The "float" is mapped to Object by the json2pojo plugin. Using "number" will map the property to "double".
This PR supports v1alpha3 and v1beta1 Istio API Solution is based on https://github.com/snowdrop/istio-java-api Tests have been moved from the above repository to here. Fixes fabric8io#3593
SonarCloud Quality Gate failed. |
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.
Great job overall!
A few comments, though:
- We probably need to document how to migrate to this new version since some method names have changed and, obviously, the packages are now different
- This PR only covers the networking part of the Istio API. While this should cover quite a bit of what people use, there are several other APIs that would need to be ported/updated to match what was available in the
istio-java-api
project (mesh, policy, rbac, security and mixer APIs are missing). Not all of them might need to be ported since some of these are actually obsolete but this is still something that needs to be investigated. - The
istio-java-api
project also provided a CEL (https://opensource.google/projects/cel) parser via ANTLR to support validation of some of the configuration fields. Relevance to this new version needs to be assessed as well. - Basically, we need someone who routinely uses Istio to support this API to make sure that the relevant parts are covered correctly.
extensions/istio/client/src/main/java/io/fabric8/istio/client/DefaultIstioClient.java
Show resolved
Hide resolved
extensions/istio/client/src/main/java/io/fabric8/istio/client/DefaultIstioClient.java
Show resolved
Hide resolved
extensions/istio/client/src/main/java/io/fabric8/istio/client/V1alpha3APIGroupDSL.java
Show resolved
Hide resolved
|
||
@Override | ||
public Class<V1alpha3APIGroupDSL> getExtensionType() { | ||
return V1alpha3APIGroupDSL.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.
return V1alpha3APIGroupDSL.class; | |
return V1beta1APIGroupClient.class; |
...ions/istio/client/src/main/java/io/fabric8/istio/client/V1beta1APIGroupExtensionAdapter.java
Show resolved
Hide resolved
...ions/istio/client/src/main/java/io/fabric8/istio/client/V1beta1APIGroupExtensionAdapter.java
Show resolved
Hide resolved
...ions/istio/client/src/main/java/io/fabric8/istio/client/V1beta1APIGroupExtensionAdapter.java
Show resolved
Hide resolved
extensions/istio/tests/src/test/java/io/fabric8/istio/test/v1alpha3/DestinationRuleTest.java
Show resolved
Hide resolved
There doesn't seem to be any CRUD test for any resource. Would be nice to add some Crud tests to test suite as well. |
Thanks for your review! I will update the PR asap. Do you mean to also cover updates in these resources or something else? |
Sorry for not being clear, I was referring to CRUD mode in MockServer. You don't need to add expectations in this mode. Here is an example: |
Sorry, I didn't read the comments, before merging (just saw the approval). Could you add the requested changes to a new PR? |
ok ok! I've added the crud flag to true in the v1beta1 VirtualService test. |
This PR fixes all the requested changes by Rohan in fabric8io#3613.
Request changes fixed in #3650 |
This PR fixes all the requested changes by Rohan in #3613.
This PR supports v1alpha3 and v1beta1 Istio API
Solution is based on https://github.com/snowdrop/istio-java-api
Tests have been moved from the above repository to here.
Fixes #3593
Apart from adding the Istio API, we added two changes to the GO generator:
These changes are in separated commits.