zhuqi-lucas commented on code in PR #579:
URL: https://github.com/apache/yunikorn-k8shim/pull/579#discussion_r1177902309
##########
pkg/common/utils/utils.go:
##########
@@ -109,6 +109,16 @@ func GetQueueNameFromPod(pod *v1.Pod) string {
}
func GetApplicationIDFromPod(pod *v1.Pod) (string, error) {
+ // if pod was tagged with ignore-application, return
+ if value := GetPodAnnotationValue(pod,
constants.AnnotationIgnoreApplication); value != "" {
+ ignore, err := strconv.ParseBool(value)
+ if err != nil {
+ log.Logger().Warn("Failed to parse annotation
"+constants.AnnotationIgnoreApplication, zap.Error(err))
+ } else if ignore {
+ return "", nil
+ }
+ }
+
Review Comment:
Good suggestion, the other cases use this way.
```
// filter pods by scheduler name and state
func (os *Manager) filterPods(obj interface{}) bool {
switch obj.(type) {
case *v1.Pod:
pod := obj.(*v1.Pod)
if utils.GeneralPodFilter(pod) {
// only application ID is required
if _, err := utils.GetApplicationIDFromPod(pod); err ==
nil {
return true
}
}
return false
default:
return false
}
}
```
```
// filter pods by scheduler name and state
func (ctx *Context) filterPods(obj interface{}) bool {
switch obj := obj.(type) {
case *v1.Pod:
if utils.GeneralPodFilter(obj) {
_, err := utils.GetApplicationIDFromPod(obj)
return err == nil
}
return false
default:
return false
}
}
```
--
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]