Merge pull request #754 from red-firefly/fix/pod-group-queue

[controller] Set `Queue` field when pod has queue name annotation
This commit is contained in:
Volcano Bot 2020-04-04 11:52:41 +08:00 committed by GitHub
commit cc110278d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -22,4 +22,8 @@ const KubeGroupNameAnnotationKey = "scheduling.k8s.io/group-name"
// VolcanoGroupNameAnnotationKey is the annotation key of Pod to identify
// which PodGroup it belongs to.
const VolcanoGroupNameAnnotationKey = "scheduling.volcano.sh/group-name"
const VolcanoGroupNameAnnotationKey = GroupName + "/group-name"
// QueueNameAnnotationKey is the annotation key of Pod to identify
// which queue it belongs to.
const QueueNameAnnotationKey = GroupName + "/queue-name"

View File

@ -90,6 +90,9 @@ func (cc *Controller) createNormalPodPGIfNotExist(pod *v1.Pod) error {
PriorityClassName: pod.Spec.PriorityClassName,
},
}
if queueName, ok := pod.Annotations[scheduling.QueueNameAnnotationKey]; ok {
pg.Spec.Queue = queueName
}
if _, err := cc.vcClient.SchedulingV1beta1().PodGroups(pod.Namespace).Create(pg); err != nil {
klog.Errorf("Failed to create normal PodGroup for Pod <%s/%s>: %v",