kubernetes-client
kubernetes-client copied to clipboard
io.fabric8.kubernetes-client:version6.13.0 io.sundr.builder-annotations:version0.103.1
java: java.lang.IllegalStateException: No template renderer found for:jar:file:/D:/Maven/apache-maven-3.8.5/conf/repository/io/fabric8/kubernetes-model-gatewayapi/6.13.0/kubernetes-model-gatewayapi-6.13.0.jar!/manifest.vm
java.lang.RuntimeException: java.lang.IllegalStateException: No template renderer found for:jar:file:/D:/Maven/apache-maven-3.8.5/conf/repository/io/fabric8/kubernetes-model-gatewayapi/6.13.0/kubernetes-model-gatewayapi-6.13.0.jar!/manifest.vm
at com.sun.tools.javac.main.Main.compile(Main.java:553)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:239)
at org.jetbrains.jps.javac.ExternalJavacProcess.compile(ExternalJavacProcess.java:189)
at org.jetbrains.jps.javac.ExternalJavacProcess.access$400(ExternalJavacProcess.java:28)
at org.jetbrains.jps.javac.ExternalJavacProcess$CompilationRequestsHandler$1.run(ExternalJavacProcess.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.IllegalStateException: No template renderer found for:jar:file:/D:/Maven/apache-maven-3.8.5/conf/repository/io/fabric8/kubernetes-model-gatewayapi/6.13.0/kubernetes-model-gatewayapi-6.13.0.jar!/manifest.vm
at io.sundr.transform.internal.TemplateTransformationProcessor.lambda$process$0(TemplateTransformationProcessor.java:141)
at java.util.Optional.orElseThrow(Optional.java:290)
at io.sundr.transform.internal.TemplateTransformationProcessor.process(TemplateTransformationProcessor.java:141)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
at com.sun.tools.javac.main.Main.compile(Main.java:523)
... 9 more
Could you share more details about your project?
It might be that your jar archive is corrupt or your project is having trouble loading it. The mentioned resource does exist in the officially released artifact: https://repo1.maven.org/maven2/io/fabric8/kubernetes-model-gatewayapi/6.13.0/kubernetes-model-gatewayapi-6.13.0.jar
Is this necessary?
How do you use it?
This is used to generate the META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource file at the Kubernetes Client compile time.
It's not necessary for downstream usage. If you are using the Kubernetes Client in your project, then this is not a required resource From your screenshot, I'm completely confused about what you're trying to do. For some reason it looks like if you're actually recompiling the Kubernetes Client project.
1:
2:
Are these two steps the way to use Java to access Volcano?
How to create a pod inside a container?
This is a pod created before, it is possible
May I ask why this cannot inherit the client's IP and port
That code is sort of deprecated.
The way you should instantiate your client for Volcano (or any other extension or model type) is by:
try (
KubernetesClient kc = new KubernetesClientBuilder().build();
VolcanoClient volcanoClient = kc.adapt(VolcanoClient.class)
) {
volcanoClient.//...
}
May I ask why this cannot inherit the client's IP and port
That's weird, both clients are initialized the same way.
Anyway, as you can see in the previous snippet, the right approach is to adapt your original client to a volcano client: client.adapt(VolcanoClient.class).queues().//...
@mafei-github : Could you please share code snippets instead of screenshots? Could you please check with kubectl whether you have v1beta1.VolcanoJob resource installed in your Kubernetes cluster?
queue、podgroup
volcanojob?
How to create volcanojob in this project
@mafei-github : It looks like VolcanoJob resource isn't added to the model of volcano extension. We need to add it to the model and client DSL
public interface V1beta1APIGroupDSL extends Client { MixedOperation<PodGroup, PodGroupList, Resource<PodGroup>> podGroups(); MixedOperation<Queue, QueueList, Resource<Queue>> queues(); MixedOperation<VolcanoJob, VolcanoJobList, Resource<VolcanoJob>> volcanoJobs(); }
VolcanoJob volcanoJob = new VolcanoJobBuilder() .withNewMetadata() .withNamespace(namespace) .withName("test-job") .withLabels(baseLabels) // .withResourceVersion("66").withSelfLink("/apis/scheduling.volcano.sh/v1beta1/volcanojob/test-job") .endMetadata() .withNewSpec() .withSchedulerName("volcano") .withMinAvailable(1) .withWeight(2) .withPriorityClassName("high-priority") .withMaxRetry(3) .withQueue("queue.com") .withVolumeMounts(volumeMounts) .withVolumes(volumes) .withTasks(tasks) .endSpec() .build(); VolcanoJob orReplace = defaultVolcanoClient.v1beta1().volcanoJobs().inNamespace(namespace).createOrReplace(volcanoJob);
public class V1beta1APIGroupClient extends ClientAdapter<V1beta1APIGroupClient> implements V1beta1APIGroupDSL { @Override public V1beta1APIGroupClient newInstance() { return new V1beta1APIGroupClient(); }
@Override
public MixedOperation<PodGroup, PodGroupList, Resource<PodGroup>> podGroups() {
return resources(PodGroup.class, PodGroupList.class);
}
@Override
public MixedOperation<Queue, QueueList, Resource<Queue>> queues() {
return resources(Queue.class, QueueList.class);
}
@Override
public MixedOperation<VolcanoJob, VolcanoJobList, Resource<VolcanoJob>> volcanoJobs() {
return resources(VolcanoJob.class, VolcanoJobList.class);
}
}
java.lang.IllegalStateException: No adapter available for type:class com.dmai.model.common.k8s.volcano.client.V1beta1APIGroupClient
@mafei-github Is it possible for you to create a draft pull request? It'll be easier to check with that.
2NPU-volcanojob.txt java.lang.IllegalStateException: com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter definitions for property "volumes": com.dmai.model.common.k8s.volcano.model.src.scheduling.VolcanoJobSpec#setVolumes(1 params) vs com.dmai.model.common.k8s.volcano.model.src.scheduling.VolcanoJobSpec#setVolumeMounts(1 params)
step one:create queue
is ok

step two:create podgroup
is ok
The queue and podgroup in the first two steps actually refers to this project
step three:create volcanojob
It's not ok
I modified this based on the original k8s job reference
Could you please create a GitHub repository with some sort of reproducer (or whatever public code you already have). Maybe this way we can provide better suggestions. Otherwise it's hard for us to understand what problems you're facing.
@mafei-github : Could you please provide a resource where all volcano resources and supported apiGroups are listed? We can add them in upcoming release.
Do we need to support this interface on the k8s SDK? Does the latest version of K8S currently not support this interface?
Does this not support v1alpha1 version?
@mafei-github : No, it doesn't look like we support it at the moment.
Would it be possible for you to contribute these to KubernetesClient ?
Of course I am willing, what should I do?
I am using this template Do I need any more information to create this error message using the k8s client in Java?
@mafei-github : Okay, let me try to explain the steps:
Model Generation
To add new resources to Volcano Model, you would need to edit extensions/volcano/generator-v1beta1/cmd/generate/generate.go and then issue make (requires GoLang 1.21) in generator-v1beta1 . You can also run build inside a docker container:
sh kubernetes-model-generator/generateModelDocker.sh extensions/volcano/generator-v1beta1
If you want to add other apiGroups v1alpha1 you would need to add new module generator-v1alpha1 and model-v1alpha1` respectively
VolcanoClient DSL changes
In order to make these added types available in VolcanoClient, you would need to add new resources in V1beta1APIGroupDSL and V1beta1APIGroupClient
. For new resources in v1alpha1 apiGroup, equivalent V1Alpha1APIGroupDSL and V1Alpha1APIGroupClient would need to be created.
Similar Pull Request
There is a similar old pull request that adds some resource types to volcano extension https://github.com/fabric8io/kubernetes-client/pull/3849
Besides this, remember that you can also use the official CRDs published by Volcano in conjunction with the Java generator Maven Plugin: https://github.com/fabric8io/kubernetes-client/blob/main/doc/java-generation-from-CRD.md
Do I need to refer to this template myself and write the code for the V1Alpha1APIGroupDSL extension that supports Volcano for this project?https://github.com/fabric8io/kubernetes-client/pull/3849
@mafei-github : Sorry I don't understand. Is your question reply to Marc's comment about using the Java Generator or to my comment about submitting a PR?
@mafei-github : If you want to solve problem just for yourself (generate Volcano Java classes from CRD) . Follow https://github.com/fabric8io/kubernetes-client/blob/main/doc/java-generation-from-CRD.md?rgh-link-date=2024-07-18T08%3A44%3A53Z
write the code for the V1Alpha1APIGroupDSL extension that supports Volcano for this project?
If you want to modify the codebase to provide support for new Volcano types, you would need to add code
According to this tutorial, can I solve the problem I am currently facing