Open mafei-github opened 4 months ago
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 class V1beta1APIGroupClient extends ClientAdapter
@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 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:
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
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.
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
@mafei-github : I haven't tried it myself but you should be able to do it.
You need to place volcano CRDs in project and then configure java-generator-maven-plugin to generate Java classes corresponding to missing volcano CRDs. See this blogpost for more details : How to generate code using Fabric8 Kubernetes Client Then you can use KubernetesClient to interact with volcano resources like this:
kubernetesClient.resources(VolcanoJob.class, VolcanoJobList.class).inNamespace("default").list()
this is why?
@mafei-github : Have you added entry for v1alpha1 client here?
It still doesn't work?
@mafei-github : You're missing @Override
annotation.
You need to add both clients, something like this:
@Override
public void registerClients(ClientFactory factory) {
factory.register(V1beta1APIGroupDSL.class, new V1beta1APIGroupClient());
factory.register(V1alpha1APIGroupDSL.class, new V1alpha1APIGroupClient());
}
It still doesn't work?? ![Uploading 图片.png…]() I'll interrupt, the program didn't include this method
@mafei-github : Please push your changes in some branch and share it with us. It's really hard to figure out what you're missing just looking at these screenshots.
ok. But I still don't have permission through Gitub or using tokens? remote: Permission to fabric8io/kubernetes-client.git denied to mafei-github. fatal: unable to access 'https://github.com/fabric8io/kubernetes-client/': The requested URL returned error: 403
@mafei-github : You need to fork the project and push your branch to your fork. Then you can create a pull request to merge your branch (in your fork) to Fabric8 Kubernetes Client main
remote: Permission to fabric8io/kubernetes-client.git denied to mafei-github. fatal: unable to access 'https://github.com/fabric8io/kubernetes-client.git/': The requested URL returned error: 403
@mafei-github : please take a look at my previous comment https://github.com/fabric8io/kubernetes-client/issues/6103#issuecomment-2283089639
You need to push your branch to https://github.com/mafei-github/kubernetes-client.git
(You need to fork the project to create this repository) not https://github.com/fabric8io/kubernetes-client.git
ok, https://github.com/mafei-github/kubernetes-client.git Please help me check if there are any issues. Thank you
Failure executing: POST at: https://10.196.10.137:6453/apis/batch.volcano.sh/v1alpha1/jobs. Message: Not Found. but Is it due to inconsistency between the kubectl version and Kubernetes version?
I have written these contents in the local project, which can be done for queue and podgroup, but not for job
Can you answer my question?
@mafei-github : I'll try to pull your branch and check it later today. If I find something wrong, I'll try to push to your branch
@rohanKanojia Thank you
I have noticed a phenomenon, defaultVolcanoClient.queues().createOrReplace(queue);This code is normal,because By default, client.podGroups() use v1beta1 version, but defaultVolcanoClient.v1beta1().queues().createOrReplace(queue); No adapter available for type:class com.dmai.model.common.k8s.volcano.client.impl.V1beta1APIGroupClient As long as I specify the version, an error will occur,v1beta1 or v1alpha1,
@rohanKanojia Can you answer my question? Thank you