-
Notifications
You must be signed in to change notification settings - Fork 542
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
Improve example 2788 #2800
Improve example 2788 #2800
Conversation
… is never thrown eclipse-jkube#2780 Signed-off-by: wayne kirimi <kirimiwayne@gmail.com>
…f-by: wayne kirimi <kirimiwayne@gmail.com>
Eclipse JKube CI ReportStarted new GH workflow run for #2800 (2024-04-25T11:08:41Z) ⚙️ JKube E2E Tests (8831313734)
|
I am not yet sure how this example ties with JKube or K8S, so i have not added anything in the README file. However, this is how I have ran the example:
Output:
|
@waynemorphic : Are you able to deploy the application to a Kubernetes cluster ? See this minikube quickstart guide |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2800 +/- ##
=============================================
+ Coverage 59.36% 70.61% +11.24%
- Complexity 4586 5009 +423
=============================================
Files 500 486 -14
Lines 21211 19449 -1762
Branches 2830 2506 -324
=============================================
+ Hits 12591 13733 +1142
+ Misses 7370 4491 -2879
+ Partials 1250 1225 -25 ☔ View full report in Codecov by Sentry. |
…by: wayne kirimi <kirimiwayne@gmail.com>
@waynemorphic : It's necessary to test the application to see its behavior when you deploy the application to a Kubernetes Cluster using JKube. I think this was the original problem you faced when you tried this quickstart, right? Expected behavior would be to see application pod in |
|
@rohanKanojia : I have been able to solve the Tentative opinion -> What happens under the hood is, k8s pulls the built image from docker hub. However, since
<images>
<image>
<name>waynemorphic/helloworld-java:${project.version}</name>
<alias>hello-world</alias>
<build>
.....
[INFO] Scanning for projects...
[INFO]
[INFO] -----------< org.eclipse.jkube.quickstarts.maven:helloworld >-----------
[INFO] Building Eclipse JKube :: Quickstarts :: Maven :: Hello World 1.16.1
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- k8s:1.16.1:resource (default-cli) @ helloworld ---
[INFO] k8s: Using resource templates from /Users/jj/Documents/Open-source/jkube/quickstarts/maven/hello-world/src/main/jkube
[INFO] k8s: jkube-controller: Adding a default Deployment
[INFO] k8s: jkube-revision-history: Adding revision history limit to 2
[INFO] k8s: validating /Users/jj/Documents/Open-source/jkube/quickstarts/maven/hello-world/target/classes/META-INF/jkube/kubernetes/helloworld-deployment.yml resource
[INFO]
[INFO] --- k8s:1.16.1:apply (default-cli) @ helloworld ---
[INFO] k8s: Using Kubernetes at https://127.0.0.1:64151/ in namespace null with manifest /Users/jj/Documents/Open-source/jkube/quickstarts/maven/hello-world/target/classes/META-INF/jkube/kubernetes.yml
[INFO] k8s: Updating Deployment from kubernetes.yml
[INFO] k8s: Updated Deployment: target/jkube/applyJson/default/deployment-helloworld.json
[INFO] k8s: HINT: Use the command `kubectl get pods -w` to watch your pods start up
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.410 s
[INFO] Finished at: 2024-03-12T13:49:16+03:00
[INFO] ------------------------------------------------------------------------
NAME READY STATUS RESTARTS AGE
helloworld-f9fbcd4b8-5x2jg 1/1 Running 1 (27m ago) 34m
Mar 12, 2024 10:37:09 AM org.eclipse.jkube.sample.helloworld.App main
INFO: Server started on port: 8081 |
…iwayne@gmail.com>
quickstarts/maven/hello-world/src/main/java/org/eclipse/jkube/sample/helloworld/App.java
Outdated
Show resolved
Hide resolved
...aven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/ResourceMojo.java
Outdated
Show resolved
Hide resolved
@waynemorphic : I tried your changes and it seems to be running okay on my minikube cluster. After adding this property ``and changing port value to <properties>
<jkube.enricher.jkube-service.type>NodePort</jkube.enricher.jkube-service.type>
</properties>
|
… <kirimiwayne@gmail.com>
…by: wayne kirimi <kirimiwayne@gmail.com>
…irimiwayne@gmail.com>
… <kirimiwayne@gmail.com>
...kstarts/maven/hello-world/src/main/java/org/eclipse/jkube/sample/helloworld/RootHandler.java
Outdated
Show resolved
Hide resolved
...kstarts/maven/hello-world/src/main/java/org/eclipse/jkube/sample/helloworld/RootHandler.java
Outdated
Show resolved
Hide resolved
...kstarts/maven/hello-world/src/main/java/org/eclipse/jkube/sample/helloworld/RootHandler.java
Outdated
Show resolved
Hide resolved
String response = "Hello World"; | ||
exchange.sendResponseHeaders(200, response.length()); | ||
exchange.getResponseHeaders().set("Content-Type", "text/plain"); | ||
OutputStream outputStream = exchange.getResponseBody(); |
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.
Is it possible to use Java's try with resources here?
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.
Yes, it is possible. Working on it
…kirimi <kirimiwayne@gmail.com>
@waynemorphic : Thanks, PR looks good. Did you check Marc's suggestion #2788 (comment) about Java 21 to reduce boilerplate code for creating HTTP server? Do you know if we can further trim it down by relying on JDK21? |
@rohanKanojia : The suggestion by @manusa on Java 21 was the first POC I tried based on this resource but it did not work out. So, I fell back to the current solution. However, resources that can guide me on how to trim it further are welcome. I also have a question regarding Spring Boot config @rohanKanojia. If I want to run probes on a different port, say 8081 instead of the default port 8080, where can I change it? I bet using
|
@waynemorphic : Could you please try using |
@rohanKanojia : The container port is 8081 but probes are on 8080. Potential conflicts?
|
@waynemorphic : Umm, that's odd. I see in code we're getting management port from spring configuration and using it, if it's not present we're falling back to server port Is it possible for you to debug this? Run |
@rohanKanojia : Unfortunately it is not possible. I have followed this guide After running mvnDebug k8s:build
After running the app:
![]() ![]() |
@rohanKanojia : Maybe we could move the discussion elsewhere if this PR is okay? |
@waynemorphic : Yeah, could you please create a github discussion for this? |
@rohanKanojia : Sure |
Hello @rohanKanojia : Quick inquiry, will this PR be merged and the associated issue closed? |
@waynemorphic : Yes, let me review it again today |
@rohanKanojia : done |
@waynemorphic : Thanks a lot! |
Signed-off-by: Marc Nuri <marc@marcnuri.com>
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, thx!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2800 +/- ##
=============================================
+ Coverage 59.36% 70.62% +11.25%
- Complexity 4586 5009 +423
=============================================
Files 500 486 -14
Lines 21211 19449 -1762
Branches 2830 2506 -324
=============================================
+ Hits 12591 13735 +1144
+ Misses 7370 4489 -2881
+ Partials 1250 1225 -25 ☔ View full report in Codecov by Sentry. |
Description
Fixes #2788
Type of change
test, version modification, documentation, etc.)
Checklist