in pkg/common/utils/utils.go [109:136]
func GetApplicationIDFromPod(pod *v1.Pod) string {
// SchedulerName needs to match
if strings.Compare(pod.Spec.SchedulerName, constants.SchedulerName) != 0 {
return ""
}
// if pod was tagged with ignore-application, return
if value := GetPodAnnotationValue(pod, constants.AnnotationIgnoreApplication); value != "" {
ignore, err := strconv.ParseBool(value)
if err != nil {
log.Log(log.ShimUtils).Warn("Failed to parse annotation "+constants.AnnotationIgnoreApplication, zap.Error(err))
} else if ignore {
return ""
}
}
// application ID can be defined in annotations
if value := GetPodAnnotationValue(pod, constants.AnnotationApplicationID); value != "" {
return value
}
if value := GetPodLabelValue(pod, constants.LabelApplicationID); value != "" {
return value
}
// application ID can be defined in labels
if value := GetPodLabelValue(pod, constants.SparkLabelAppID); value != "" {
return value
}
// no application ID found, this is not a YuniKorn-managed Pod
return ""
}