Skip to content

Add GraalVM native image support for Fabric8 autoconfig module#2247

Open
kamalcis wants to merge 1 commit into
spring-cloud:mainfrom
kamalcis:fix/graalvm-aot-sck-support
Open

Add GraalVM native image support for Fabric8 autoconfig module#2247
kamalcis wants to merge 1 commit into
spring-cloud:mainfrom
kamalcis:fix/graalvm-aot-sck-support

Conversation

@kamalcis

@kamalcis kamalcis commented Jun 7, 2026

Copy link
Copy Markdown

Problem

Spring Cloud Kubernetes Fabric8 autoconfig module does not support
GraalVM native image compilation. The README explicitly states native
images are unsupported. Native builds fail at runtime with:

java.lang.ClassNotFoundException:
io.fabric8.kubernetes.client.impl.KubernetesClientImpl

Closes #1350

Solution

Add Fabric8RuntimeHints implementing RuntimeHintsRegistrar to register:

  • Reflection hints for KubernetesClientImpl, KubernetesClientBuilder,
    and Config
  • Reflection hint for Fabric8ProfileEnvironmentPostProcessor
  • Resource hints for Kubernetes service account and kubeconfig files

Testing

Tested on:

  • GraalVM CE 25.0.2
  • Spring Boot 4.1.0-SNAPSHOT
  • Spring Cloud Kubernetes 5.0.2-SNAPSHOT
  • Kubernetes 1.34.1 (live kubeadm cluster)

Note

User applications must set spring.main.cloud-platform=kubernetes
in their configuration to enable SCK auto-configuration in
native image environments. Auto-detection of the Kubernetes
platform is not yet supported in native images and is a
separate concern from this PR.

Results on Merge:
Deployed the user application image ( containing the SCK library ) into Kubeadm cluster. Pods started successfully, logs were clean, and SCK auto-configuration loaded correctly at runtime. Pods start instantly, logs are clean, and SCK auto-configuration loads correctly at runtime.

Signed-off-by: Abu Hena Mostafa Kamal <kamalcis@gmail.com>
@kamalcis kamalcis force-pushed the fix/graalvm-aot-sck-support branch from d272d9d to 9b6a0eb Compare June 7, 2026 21:24
@kamalcis kamalcis mentioned this pull request Jun 8, 2026
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.

Spring Native support

2 participants