fabric8io / kubernetes-client

Java client for Kubernetes & OpenShift
http://fabric8.io
Apache License 2.0
3.34k stars 1.44k forks source link

Consider splitting OpenShift Client module (GraalVM performance) #5592

Open manusa opened 7 months ago

manusa commented 7 months ago

Description

When creating a native image for a Java application that has a dependency to the io.fabric8:openshift-client module, it's likely that the GraalVM process runs into an java.lang.OutOfMemoryError (OOME).

The openshift-client module brings transitive dependencies to every openshift-model-* module. In addition, it provides DSL entrypoint methods in the OpenShiftClient interface, inevitably linking the classes from those modules.

We've got a couple of huge model modules. The most concerning one is io.fabric8:openshift-model-operator. When processing this model types, GraalVM runs out of memory unless we provide higher limits. This is problematic for memory-constrained environments such as continuous integration (CI) systems.

Adding manual exclusions to the model modules is not possible, since the DSL accessors prevents this modules from being optional.

Possible solutions

Relates to

/cc @jamesnetherton

shawkins commented 7 months ago

There was also an older issue about making the openshift support similar to other extensions - however I couldn't quite get there because there was too much usage of internal logic by the openshift module.

manusa commented 7 months ago

I'm going to try and provide a fix (exclusively) for Quarkus in the scope of this issue.

We can further discuss more suitable and generic approaches if the one for Quarkus works.

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

manusa commented 1 month ago

After the fixes in Quarkus and Fabric8:

This might not be needed anymore.

The final binary size is now reasonable enough. The added complexity to provide multiple clients for OpenShift-specific models might not be cost-effective.