kubernetes-client icon indicating copy to clipboard operation
kubernetes-client copied to clipboard

io.fabric8.kubernetes-client:version6.13.0 io.sundr.builder-annotations:version0.103.1

Open mafei-github opened this issue 1 year ago • 49 comments

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

mafei-github avatar Jul 03 '24 07:07 mafei-github

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

manusa avatar Jul 03 '24 07:07 manusa

8BAAE537-E693-4d88-969F-3602F070DBD9 Is this necessary? How do you use it?

mafei-github avatar Jul 03 '24 09:07 mafei-github

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.

manusa avatar Jul 03 '24 10:07 manusa

1: 图片 2: 图片 Are these two steps the way to use Java to access Volcano? How to create a pod inside a container?

mafei-github avatar Jul 04 '24 01:07 mafei-github

图片 This is a pod created before, it is possible 图片 图片 图片 May I ask why this cannot inherit the client's IP and port

mafei-github avatar Jul 04 '24 01:07 mafei-github

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().//...

manusa avatar Jul 08 '24 07:07 manusa

图片 图片 图片

mafei-github avatar Jul 15 '24 08:07 mafei-github

@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?

rohanKanojia avatar Jul 15 '24 08:07 rohanKanojia

图片 queue、podgroup volcanojob?

mafei-github avatar Jul 15 '24 08:07 mafei-github

How to create volcanojob in this project

mafei-github avatar Jul 16 '24 05:07 mafei-github

@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

rohanKanojia avatar Jul 16 '24 06:07 rohanKanojia

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 avatar Jul 16 '24 06:07 mafei-github

@mafei-github Is it possible for you to create a draft pull request? It'll be easier to check with that.

rohanKanojia avatar Jul 16 '24 06:07 rohanKanojia

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)

mafei-github avatar Jul 16 '24 07:07 mafei-github

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

mafei-github avatar Jul 16 '24 08:07 mafei-github

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.

manusa avatar Jul 16 '24 10:07 manusa

图片 图片

mafei-github avatar Jul 18 '24 06:07 mafei-github

图片 图片

mafei-github avatar Jul 18 '24 06:07 mafei-github

@mafei-github : Could you please provide a resource where all volcano resources and supported apiGroups are listed? We can add them in upcoming release.

rohanKanojia avatar Jul 18 '24 06:07 rohanKanojia

Do we need to support this interface on the k8s SDK? Does the latest version of K8S currently not support this interface?

mafei-github avatar Jul 18 '24 06:07 mafei-github

图片 Does this not support v1alpha1 version?

mafei-github avatar Jul 18 '24 06:07 mafei-github

@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 ?

rohanKanojia avatar Jul 18 '24 07:07 rohanKanojia

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 avatar Jul 18 '24 07:07 mafei-github

@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

rohanKanojia avatar Jul 18 '24 08:07 rohanKanojia

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

manusa avatar Jul 18 '24 08:07 manusa

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 avatar Jul 23 '24 02:07 mafei-github

@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?

rohanKanojia avatar Jul 23 '24 03:07 rohanKanojia

图片

mafei-github avatar Jul 23 '24 03:07 mafei-github

@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

rohanKanojia avatar Jul 23 '24 04:07 rohanKanojia

According to this tutorial, can I solve the problem I am currently facing

mafei-github avatar Jul 23 '24 05:07 mafei-github