chia7712 commented on code in PR #848:
URL: https://github.com/apache/yunikorn-k8shim/pull/848#discussion_r1611455161


##########
pkg/admission/util.go:
##########
@@ -49,8 +50,10 @@ func updatePodLabel(pod *v1.Pod, namespace string, 
generateUniqueAppIds bool, de
                result[constants.LabelApplicationID] = generatedID
        }
 
-       // if existing label exist, it takes priority over everything else
-       if _, ok := existingLabels[constants.LabelQueueName]; !ok {
+       labelQueueName := utils.GetPodLabelValue(pod, constants.LabelQueueName)

Review Comment:
   Could we align the behavior of this and `Utils.GetQueueNameFromPod`?
   
   
https://github.com/apache/yunikorn-k8shim/blob/08a9b93dcc308f1e70bbf9a6596664877977e1bd/pkg/common/utils/utils.go#L106
   
   For example:
   
   utils
   ```go
   func GetQueueNameFromPodWithDefault(pod *v1.Pod, defaultName string) string {
        queueName := defaultName
        if an := GetPodLabelValue(pod, constants.LabelQueueName); an != "" {
                queueName = an
        } else if qu := GetPodAnnotationValue(pod, 
constants.AnnotationQueueName); qu != "" {
                queueName = qu
        }
        return queueName
   }
   
   func GetQueueNameFromPod(pod *v1.Pod) string {
        return GetQueueNameFromPodWithDefault(pod, 
constants.ApplicationDefaultQueue)
   }
   
   ```
   
   util
   ```go
        name := utils.GetQueueNameFromPodWithDefault(pod, "")
        if name == "" {
                // if queueName not exist, generate one
                // if defaultQueueName is "", skip adding default queue name to 
the pod labels
                if defaultQueueName != "" {
                        // for undefined configuration, am_conf will add 
'root.default' to retain existing behavior
                        // if a custom name is configured for default queue, it 
will be used instead of root.default
                        result[constants.LabelQueueName] = defaultQueueName
                }
        }
   ```
   



-- 
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]

Reply via email to