Skip to content

v0.0.23

Latest

Choose a tag to compare

@github-actions github-actions released this 23 Nov 05:01
· 2 commits to main since this release
v0.0.23
0b2a6a2

Highlights

Native library selected by OS and architecture (#460, fixes #459)

With more than one platform artifact on the classpath, the native library used to be whichever came first on the classpath. It's now chosen in this order:

  1. the first platform artifact whose declared OS and architecture match the running JVM;
  2. otherwise, the first one that declares no platform (custom implementations, or platform artifacts older than 0.0.23);
  3. otherwise, loading fails with an error naming os.name, os.arch and the implementations found. No download from Maven Central is attempted in that case.

Two new system properties:

  • com.marcnuri.jkube-helm.nativeLibrary: fully qualified class name of a registered NativeLibrary to use regardless of the detected platform.
  • com.marcnuri.jkube-helm.tempDir: base directory where the native library is extracted (defaults to java.io.tmpdir). Useful when /tmp is mounted noexec.

Maven builds on Linux ARM64 hosts, where the JVM reports os.arch=aarch64, now get the linux-arm64 artifact through a new linux-aarch64 profile.

JVM signal handling fixed (#411, #463, fixes #409)

After the first install (or upgrade --install), the native library replaced the JVM's SIGINT, SIGTERM and SIGQUIT handlers for good. The JVM then ignored SIGTERM: shutdown hooks never ran, kill -3 thread dumps stopped working, and Kubernetes pods hung until they were killed after terminationGracePeriodSeconds. The native library no longer registers signal handlers, so the JVM keeps its own. Starting the test OCI registry no longer replaces them either.

Trade-off: a signal no longer cancels an in-flight install, so an interrupted install can leave the release in pending-install.

Thanks to @WellMafra for reporting the issue and contributing the fix.

Remote native JAR download: verified, cached per user, and bounded (#464, #465)

This applies to applications that rely on the download from Maven Central, i.e. with no platform artifact on the classpath (for example with Gradle).

  • New cache location. The native library JAR is now cached in ~/.cache/helm-java (or $XDG_CACHE_HOME/helm-java) on Linux and macOS, and in %LOCALAPPDATA%\helm-java\cache on Windows, instead of the temporary directory.
    • The first run after upgrading downloads the JAR once more.
    • JARs cached by earlier versions in the temporary directory (<os>-<arch>-<version>.jar) are no longer used and can be deleted.
  • New com.marcnuri.jkube-helm.cacheDir system property to use another cache directory.
  • Checksum verification, fail-closed. Downloads are verified against the repository's .sha1 checksum. A missing or invalid checksum fails the download.
  • Owner-only cache. On Linux and macOS, the cache directory and its files are readable and writable only by their owner. A cached JAR is used only if other users can't write it and it still has the size recorded when it was verified; otherwise it's downloaded again.
  • Refused directories. A cache directory that is a symbolic link, belongs to another user, or is group- or world-writable is refused with an error naming the property. So is a configured cacheDir that can't be created or written.
  • Temporary-directory fallback with a warning. If the default directory can't be used (no home directory, or a read-only file system as in some containers or AWS Lambda), the JAR is downloaded to a private temporary directory on each start, and a java.util.logging warning says so. Set com.marcnuri.jkube-helm.cacheDir to keep a persistent cache.
  • Download timeouts. Downloads now time out: 10 s to connect, 30 s without data. A truncated download is rejected instead of cached.
  • forceUpdate keeps the previous JAR on failure. With com.marcnuri.jkube-helm.forceUpdate, the previously cached JAR is kept when the new download fails. Before, it was deleted first.
  • Clearer errors. When no native library is found and the download failed, the No NativeLibrary implementation found error now carries the underlying failure (a timeout, an HTTP 404, a checksum mismatch, …) as its cause.

Behaviour changes

  • NativeLibrary.serviceProviderLibrary(ClassLoader) can now throw an IllegalStateException: when native library implementations are registered but none can be used on the current platform, or when the class forced with com.marcnuri.jkube-helm.nativeLibrary isn't registered. Before, it always returned the first registered implementation.
  • A native library declaring another platform is never used, even if it's the only one on the classpath.
  • The remote JAR cache moves out of the temporary directory (see above), which causes a one-time re-download.
  • A download whose .sha1 is missing or doesn't match now fails instead of being used.
  • The native library no longer installs signal handlers, so a signal doesn't cancel an in-flight install.

Dependency updates

  • golang.org/x/crypto 0.58.0 → 0.59.0 (#461)
  • k8s.io/cli-runtime and k8s.io/client-go 0.37.1 → 0.37.2 (#456)
  • sigs.k8s.io/controller-runtime and sigs.k8s.io/controller-runtime/tools/setup-envtest 0.25.2 → 0.25.3 (#462)
  • github.com/gofrs/flock 0.13.1 → 0.13.2 (#457)
  • go.opentelemetry.io/otel/sdk/log 0.21.0 → 1.47.0 (indirect, #458)
  • maven-jar-plugin pinned to 3.5.1 (#465)

The embedded Helm SDK is still helm.sh/helm/v3 v3.22.1.

What's Changed

  • chore(ci): use setup-java env-var inputs for Maven credentials by @manusa in #454
  • chore(ci): create the GitHub Release from the release workflow by @manusa in #455
  • build(deps): bump the kubernetes group in /native with 2 updates by @dependabot[bot] in #456
  • build(deps): bump github.com/gofrs/flock from 0.13.1 to 0.13.2 in /native by @dependabot[bot] in #457
  • build(deps): bump go.opentelemetry.io/otel/sdk/log from 0.21.0 to 1.47.0 in /native by @dependabot[bot] in #458
  • fix(jni): select the native library by OS and architecture by @manusa in #460
  • build(deps): bump golang.org/x/crypto from 0.58.0 to 0.59.0 in /native in the golang-x group by @dependabot[bot] in #461
  • build(deps): bump the kubernetes group in /native with 2 updates by @dependabot[bot] in #462
  • fix(go): stop replacing host process signal handlers during install by @WellMafra in #411
  • fix(go): close the last signal.Notify path in the test OCI server by @manusa in #463
  • fix: isolate tests from the user's Helm config, harden JAR download by @manusa in #464
  • fix(jni): verify the remote native library JAR and cache it per user by @manusa in #465

New Contributors

Full Changelog: v0.0.22...v0.0.23