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

Add Fabric8 Kubernetes client integration #5167

Merged
merged 19 commits into from
Jan 29, 2024

Conversation

ikhoon
Copy link
Contributor

@ikhoon ikhoon commented Sep 4, 2023

Motivation:

Fabric8 is one of the popular Kubernetes client implementations. It has an abstract layer for HTTP and WebSocket protocols.

If Armeria provides a Kubernetes client to better support the cloud infrastructure, other useful functions such as #4497 will be able to be implemented based on it.

Modifications:

  • Add kubernetes module to provide Fabric StandardHttpClient.
    • ArmeriaHttpClientFactory is automatically activated via Java SPI.
    • Both HTTP and WebSocket clients have been implemented in compliance with Reactive Streams specification.
    • WebSocket is working over HTTP/1. WebSocket over HTTP/2 is disabled for compatibility.
    • Forked test suites from the upstream repo.
  • Miscellaneous)
    • Allow ProxyConfig to configure proxy headers.
    • Allow WebSocketClient to configure HttpHeaders and RequestOptions when starting a WebSocket session.

Result:

You can use the Fabric Kubernetes client on top of the Armeria client.

@andreaTP
Copy link

@ikhoon quick note that there are chaos tests that you can possibly re-use to test that the implementation is solid enough:
https://github.com/fabric8io/kubernetes-client/tree/main/chaos-tests

@ikhoon
Copy link
Contributor Author

ikhoon commented Sep 15, 2023

Thanks for the tip. I will take a look.

Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Attention: 172 lines in your changes are missing coverage. Please review.

Comparison is base (52d130f) 0.00% compared to head (4305c06) 73.66%.
Report is 6 commits behind head on main.

Files Patch % Lines
...linecorp/armeria/kubernetes/it/CheckerCommand.java 0.00% 49 Missing ⚠️
...linecorp/armeria/kubernetes/it/ControlCommand.java 0.00% 49 Missing ⚠️
...ia/client/kubernetes/ArmeriaHttpClientBuilder.java 61.90% 15 Missing and 9 partials ⚠️
...rp/armeria/client/kubernetes/ArmeriaWebSocket.java 68.88% 9 Missing and 5 partials ⚠️
...p/armeria/client/kubernetes/ArmeriaHttpClient.java 83.92% 4 Missing and 5 partials ⚠️
...armeria/client/kubernetes/ArmeriaHttpResponse.java 63.63% 7 Missing and 1 partial ⚠️
...eria/client/kubernetes/ArmeriaWebSocketClient.java 86.20% 5 Missing and 3 partials ⚠️
...armeria/client/kubernetes/AsyncBodySubscriber.java 71.42% 7 Missing and 1 partial ⚠️
...a/com/linecorp/armeria/client/HttpChannelPool.java 66.66% 1 Missing ⚠️
...ecorp/armeria/client/proxy/ConnectProxyConfig.java 83.33% 0 Missing and 1 partial ⚠️
... and 1 more
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5167       +/-   ##
===========================================
+ Coverage        0   73.66%   +73.66%     
- Complexity      0    20636    +20636     
===========================================
  Files           0     1791     +1791     
  Lines           0    76335    +76335     
  Branches        0     9716     +9716     
===========================================
+ Hits            0    56233    +56233     
- Misses          0    15448    +15448     
- Partials        0     4654     +4654     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

api(libs.kubernetes.client.api)
testImplementation(variantOf(libs.kubernetes.client.api) { classifier("tests") })
testImplementation(libs.kubernetes.server.mock)
testImplementation(libs.logback13)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Logback 1.3.x is required since the Fabric Kubernetes client uses SLF4J 2.0.
Should it be nicer to exclude SLF4J 2.0 from transitive dependencies?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible? If so, yes I think we should exclude it.

@ikhoon ikhoon marked this pull request as ready for review December 11, 2023 08:45
@ikhoon ikhoon added this to the 1.27.0 milestone Dec 11, 2023
Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! Left some minor questions 🙇

.github/workflows/e2e-chaos-tests.yml Show resolved Hide resolved

```bash
eval $(minikube -p minikube docker-env)
./gradlew :it:kubernetes-chaos-tests:k8sBuild :it:kubernetes-chaos-tests:test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just plainly running this fails due to the gradle junit timeout (although I saw the @Timeout annotation in the test). Were you able to get this to run in your environment?

org.awaitility.core.ConditionTimeoutException: Condition with com.linecorp.armeria.kubernetes.it.ChaosIT was not fulfilled within 1 minutes.

https://ge.armeria.dev/s/hkphofabit2xo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've tested locally and debugged many problems.
The test might be failed due to a wrong setup.
Would you paste the output of docker images?

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically looks good to me! Can you check the CI failures?

Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks so nice! 🎉 🎉 🎉
I didn't see the chaos part though. 😅

Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will review once more after #5357 is merged. Thanks! 🎉

api(libs.kubernetes.client.api)
testImplementation(variantOf(libs.kubernetes.client.api) { classifier("tests") })
testImplementation(libs.kubernetes.server.mock)
testImplementation(libs.logback13)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible? If so, yes I think we should exclude it.

@ikhoon
Copy link
Contributor Author

ikhoon commented Jan 24, 2024

Would it be possible? If so, yes I think we should exclude it.

Excluded via exclusions in dependencies.toml

runtimeClasspath - Runtime classpath of source set 'main'.
+--- project :core
|    +--- org.slf4j:slf4j-api:1.7.36
|    +--- com.fasterxml.jackson.core:jackson-core -> 2.15.3
|    |    \--- com.fasterxml.jackson:jackson-bom:2.15.3
|    |         +--- com.fasterxml.jackson.core:jackson-annotations:2.15.3 (c)
|    |         +--- com.fasterxml.jackson.core:jackson-core:2.15.3 (c)
|    |         +--- com.fasterxml.jackson.core:jackson-databind:2.15.3 (c)
...
+--- it.unimi.dsi:fastutil:8.5.12
+--- com.google.guava:guava:32.1.3-jre (*)
+--- com.google.code.findbugs:jsr305:3.0.2
+--- org.jctools:jctools-core:4.0.1
+--- org.slf4j:slf4j-api:1.7.36
+--- org.reflections:reflections:0.9.11 (*)
\--- io.projectreactor.tools:blockhound:1.0.8.RELEASE

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice, only left nit questions! Thanks @ikhoon 🙇 👍 🙇

Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM. 👍
Please address the comment from @jrhee17. 😉

@ikhoon
Copy link
Contributor Author

ikhoon commented Jan 29, 2024

Thanks for the thorough review! 🙇‍♂️

@ikhoon ikhoon merged commit d2afcd9 into line:main Jan 29, 2024
15 of 17 checks passed
@ikhoon ikhoon deleted the fabric-kubernetes-client branch June 28, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants