eclipse-jkube / jkube

Build and Deploy java applications on Kubernetes
https://www.eclipse.dev/jkube/
Eclipse Public License 2.0
775 stars 520 forks source link

Cannot make k8s:helm-lint work with either 1.16.0 or 1.17-SNAPSHOT #2726

Closed ajeans closed 8 months ago

ajeans commented 8 months ago

Describe the bug

Looking at the release notes for 1.16.0 and its support for helm linting #2613 .

My previous build script was:

./mvnw -pl microservice-app k8s:resource k8s:helm
helm lint microservice-app/target/jkube/helm/microservice-app/kubernetes/microservice-app-0.0.1-SNAPSHOT.tar.gz

Which I tried to replace with

./mvnw -pl microservice-app k8s:resource k8s:helm k8s:helm-lint

With zero change to the project (no pom change, nothing).

While the standard call to helm lint works fine, the maven goal fails with the following output:

[INFO] --- k8s:1.16.0:helm-lint (default-cli) @ microservice-app ---
[INFO] k8s: Linting microservice-app 0.0.1-SNAPSHOT
[INFO] k8s: Using packaged file: /Volumes/Workspace/b2c/template-springboot-microservice/microservice-app/target/jkube/helm/microservice-app/kubernetes/microservice-app-0.0.1-SNAPSHOT.tar.gz
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.340 s
[INFO] Finished at: 2024-02-23T14:45:39+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.16.0:helm-lint (default-cli) on project microservice-app: Execution default-cli of goal org.eclipse.jkube:kubernetes-maven-plugin:1.16.0:helm-lint failed: An API incompatibility was encountered while executing org.eclipse.jkube:kubernetes-maven-plugin:1.16.0:helm-lint: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.eclipse.jkube:kubernetes-maven-plugin:1.16.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/arnaud.jeansen/.m2/repository/org/eclipse/jkube/kubernetes-maven-plugin/1.16.0/kubernetes-maven-plugin-1.16.0.jar
[ERROR] urls[1] = file:/Users/arnaud.jeansen/.m2/repository/org/eclipse/jkube/jkube-kit-config-service/1.16.0/jkube-kit-config-service-1.16.0.jar
[ERROR] urls[2] = file:/Users/arnaud.jeansen/.m2/repository/org/eclipse/jkube/jkube-kit-config-resource/1.16.0/jkube-kit-config-resource-1.16.0.jar
[ERROR] urls[3] = file:/Users/arnaud.jeansen/.m2/repository/org/eclipse/jkube/jkube-kit-build-service-docker/1.16.0/jkube-kit-build-service-docker-1.16.0.jar
[ERROR] urls[4] = file:/Users/arnaud.jeansen/.m2/repository/org/eclipse/jkube/jkube-kit-build-api/1.16.0/jkube-kit-build-api-1.16.0.jar
[ERROR] urls[5] = file:/Users/arnaud.jeansen/.m2/repository/org/apache/httpcomponents/httpclient/4.5.14/httpclient-4.5.14.jar
[ERROR] urls[6] = file:/Users/arnaud.jeansen/.m2/repository/org/apache/httpcomponents/httpcore/4.4.16/httpcore-4.4.16.jar
[... snip ...]
[ERROR] urls[156] = file:/Users/arnaud.jeansen/.m2/repository/org/eclipse/jkube/jkube-kit-watcher-standard/1.16.0/jkube-kit-watcher-standard-1.16.0.jar
[ERROR] urls[157] = file:/Users/arnaud.jeansen/.m2/repository/org/eclipse/jkube/jkube-kit-remote-dev/1.16.0/jkube-kit-remote-dev-1.16.0.jar
[ERROR] urls[158] = file:/Users/arnaud.jeansen/.m2/repository/org/apache/sshd/sshd-core/2.9.2/sshd-core-2.9.2.jar
[ERROR] urls[159] = file:/Users/arnaud.jeansen/.m2/repository/org/apache/sshd/sshd-common/2.9.2/sshd-common-2.9.2.jar
[ERROR] urls[160] = file:/Users/arnaud.jeansen/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.32/jcl-over-slf4j-1.7.32.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] : No NativeLibrary implementation found, please add one of the supported dependencies to your project
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

Same error with both 1.16.0 and today's snapshot. This is with mvn 3.9.5 (ticket drop-down doesn't contain it).

Do you have an idea where this could come from? Note that I have an ARM Macbook, thought I would mention it when I saw the "NativeLibrary" message.

Thanks!

Eclipse JKube version

SNAPSHOT

Component

Kubernetes Maven Plugin

Apache Maven version

other (please specify in additional context)

Gradle version

None

Steps to reproduce

  1. Run ./mvnw -pl microservice-app k8s:resource k8s:helm k8s:helm-lint

Expected behavior

Helm lint happening

Runtime

other (please specify in additional context)

Kubernetes API Server version

other (please specify in additional context)

Environment

macOS

Eclipse JKube Logs

No response

Sample Reproducer Project

No response

Additional context

No response

manusa commented 8 months ago

The upstream helm-java library is unable to download the suitable native implementation for your platform:

No NativeLibrary implementation found, please add one of the supported dependencies to your project

Could you please provide the output of both mvn -v and ./mvnw -v (also see if running without the wrapper works).

helm-java does several tricks under the hood to detect your platform and architecture (both macOS arm64 and amd64 should be supported). For some reason this is not working as expected.

ajeans commented 8 months ago

Hello @manusa

That makes sense, here it is:

mvn -v
Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
Maven home: /opt/homebrew/Cellar/maven/3.9.4/libexec
Java version: 21.0.1, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_FR, platform encoding: UTF-8
OS name: "mac os x", version: "13.6.4", arch: "aarch64", family: "mac"
./mvnw -v
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
Maven home: /Users/arnaud.jeansen/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5
Java version: 21.0.1, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_FR, platform encoding: UTF-8
OS name: "mac os x", version: "13.6.4", arch: "aarch64", family: "mac"
manusa commented 8 months ago

OK, aarch64 is not being considered. I'll try to provide a fix early next week, see if it resolves your problem.

manusa commented 8 months ago

I just merged #2732 which should fix the issue. Could you please try with tomorrow's snapshot and see of the new helm-lint goal works as expected.

ajeans commented 8 months ago

Sure @manusa

Will test in the coming days and report back. Thanks for the swift replies and fixes.

ajeans commented 8 months ago

Hello @manusa

I can happily report that helm-lintnow works fine on my machine. 👏

[INFO] --- k8s:1.17-SNAPSHOT:helm (default-cli) @ microservice-app ---
[INFO] k8s: Creating Helm Chart "microservice-app" for Kubernetes
[INFO] 
[INFO] --- k8s:1.17-SNAPSHOT:helm-lint (default-cli) @ microservice-app ---
[INFO] k8s: Linting microservice-app 0.0.1-SNAPSHOT
[INFO] k8s: Using packaged file: /Volumes/Workspace/b2c/template-springboot-microservice/microservice-app/target/jkube/helm/microservice-app/kubernetes/microservice-app-0.0.1-SNAPSHOT.tar.gz
[INFO] k8s: Linting successful

Thanks a lot for the very quick fix.

manusa commented 8 months ago

Awesome, thanks for reporting back.

manusa commented 8 months ago

Just FYI we just released v1.16.1 with the fix, you should now be able to use the stable release instead.