mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
* Fix for #2842, instead of returning the first Pod, return the one which is Running * a more memory efficient version of the fix, string -> bool * fix with no extra fields in struct, return nil at Pod conversion if Pod is not Running * let Kuberneretes filter for Running Pods using FieldSelector * filter for Pods that are Running and Pending (implicit)
This commit is contained in:
committed by
Miek Gieben
parent
4e6c2b41db
commit
7dde3f3958
@@ -214,6 +214,10 @@ func podListFunc(c kubernetes.Interface, ns string, s labels.Selector) func(meta
|
||||
if s != nil {
|
||||
opts.LabelSelector = s.String()
|
||||
}
|
||||
if len(opts.FieldSelector) > 0 {
|
||||
opts.FieldSelector = opts.FieldSelector + ","
|
||||
}
|
||||
opts.FieldSelector = opts.FieldSelector + "status.phase!=Succeeded,status.phase!=Failed,status.phase!=Unknown"
|
||||
listV1, err := c.CoreV1().Pods(ns).List(opts)
|
||||
return listV1, err
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ func podWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(opt
|
||||
if s != nil {
|
||||
options.LabelSelector = s.String()
|
||||
}
|
||||
if len(options.FieldSelector) > 0 {
|
||||
options.FieldSelector = options.FieldSelector + ","
|
||||
}
|
||||
options.FieldSelector = options.FieldSelector + "status.phase!=Succeeded,status.phase!=Failed,status.phase!=Unknown"
|
||||
w, err := c.CoreV1().Pods(ns).Watch(options)
|
||||
return w, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user