chenyulin0719 commented on code in PR #871:
URL: https://github.com/apache/yunikorn-k8shim/pull/871#discussion_r1698796924
##########
pkg/common/utils/utils.go:
##########
@@ -104,12 +104,20 @@ func IsAssignedPod(pod *v1.Pod) bool {
}
func GetQueueNameFromPod(pod *v1.Pod) string {
+ // Queue name can be defined in multiple places
+ // The queue name is determined by the following order
+ // 1. Label: constants.CanonicalLabelQueueName
+ // 2. Annotation: constants.AnnotationQueueName
+ // 3. Label: constants.LabelQueueName
queueName := ""
- if an := GetPodLabelValue(pod, constants.LabelQueueName); an != "" {
- queueName = an
- } else if qu := GetPodAnnotationValue(pod,
constants.AnnotationQueueName); qu != "" {
- queueName = qu
+ if canonicalLabelQueueName := GetPodLabelValue(pod,
constants.CanonicalLabelQueueName); canonicalLabelQueueName != "" {
+ queueName = canonicalLabelQueueName
+ } else if annotationQueueName := GetPodAnnotationValue(pod,
constants.AnnotationQueueName); annotationQueueName != "" {
+ queueName = annotationQueueName
+ } else if labelQueueName := GetPodLabelValue(pod,
constants.LabelQueueName); labelQueueName != "" {
+ queueName = labelQueueName
}
+
return queueName
Review Comment:
Same as my reply for the appID question. I think validation for
"differenent values for the annotation/label" is checked in the unit test.
https://github.com/chenyulin0719/yunikorn-k8shim/blob/7f8b8652953cda033a51da17fa1b0a222f24eb8c/pkg/common/utils/utils_test.go#L1001-L1020
CanonicalLabelQueueName vs AnnotationQueueName, **CanonicalLabelQueueName**
win.
AnnotationQueueName vs LabelQueueName, **AnnotationQueueName** win.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]