Saransh Jain
03/04/2024, 6:10 PMdependency
groupIdorg.apache.flink/groupId
artifactIdflink-kubernetes-operator/artifactId
version1.7-SNAPSHOT/version
/dependency
I have followed rest of the steps for adding jar path in FLINK_PLUGINS_DIR
The mutateDeployment method starts as:
LOG.info("Entered Mutate Method");
String namespace = deployment.getMetadata().getNamespace();
LOG.info("Metadata namespace: {}", namespace);
But this is failing at deployment.getMetadata() at runtime with the below error:
java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.flink.kubernetes.operator.api.FlinkDeployment.getMetadata()Lio/fabric8/kubernetes/api/model/ObjectMeta;" the class loader org.apache.flink.core.plugin.PluginLoader$PluginClassLoader @1f11f64e (instance of org.apache.flink.core.plugin.PluginLoader$PluginClassLoader, child of 'platform' jdk.internal.loader.ClassLoaders$PlatformClassLoader) of the current class, org/apache/flink/mutator/CustomFlinkMutator, and the class loader 'app' (instance of jdk.internal.loader.ClassLoaders$AppClassLoader) for the method's defining class, io/fabric8/kubernetes/client/CustomResource, have different Class objects for the type io/fabric8/kubernetes/api/model/ObjectMeta used in the signature
From this I was able to understand that, the CustomFlinkMutator class is loaded by the PluginClassLoader, while the class io.fabric8.kubernetes.api.model.ObjectMeta is loaded by the application class loader (AppClassLoader).
The ObjectMeta is present in CustomResource.
I have tried multiple things like shading the io.fabric8.kubernetes.client and importing that in plugin project. But nothing is working.
Note: This is from a unreleased version.D. Draco O'Brien
03/06/2024, 8:18 PM