Before creating the Job, how can I update the parameter information in the YAML file in my code? #5660
-
Based on the following code, I want to update the jobName, but it shows an error
How can I ensure that the item name and operation name stay consistent? |
Beta Was this translation helpful? Give feedback.
Answered by
rohanKanojia
Dec 20, 2023
Replies: 1 comment
-
Hello, it looks like the name you want to set NonNamespaceOperation<GenericKubernetesResource, GenericKubernetesResourceList, Resource<GenericKubernetesResource>> volcanoJobResource = client
.genericKubernetesResources("batch.volcano.sh/v1alpha1", "Job")
.inNamespace("foo");
GenericKubernetesResource volcanoJob = volcanoJobResource.load(VolcanoJobCreate.class.getClassLoader().getResourceAsStream(volcanoJobYamlPath)).item();
volcanoJob.getMetadata().setName(jobName);
volcanoJobResource.resource(volcanoJob).serverSideApply(); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hzp01
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, it looks like the name you want to set
test1
is conflicting with name that's already present in the YAML manifest. Do you want to keep YAML name? If yes, you can removeresourceResource.item().getMetadata().setName(jobName);
line. If you want to modify YAML manifest name, you can first load the object, modify name and then apply it: