mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 11:18:16 +00:00
ReplicaSet controller should count terminating pods in the status
This commit is contained in:
@@ -973,6 +973,21 @@ func compareMaxContainerRestarts(pi *v1.Pod, pj *v1.Pod) *bool {
|
||||
return nil
|
||||
}
|
||||
|
||||
// FilterClaimedPods returns pods that are controlled by the controller and match the selector.
|
||||
func FilterClaimedPods(controller metav1.Object, selector labels.Selector, pods []*v1.Pod) []*v1.Pod {
|
||||
var result []*v1.Pod
|
||||
for _, pod := range pods {
|
||||
if !metav1.IsControlledBy(pod, controller) {
|
||||
// It's an orphan or owned by someone else.
|
||||
continue
|
||||
}
|
||||
if selector.Matches(labels.Set(pod.Labels)) {
|
||||
result = append(result, pod)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// FilterActivePods returns pods that have not terminated.
|
||||
func FilterActivePods(logger klog.Logger, pods []*v1.Pod) []*v1.Pod {
|
||||
var result []*v1.Pod
|
||||
|
||||
Reference in New Issue
Block a user