Skip to content

Commit

Permalink
Make vrs controller filter out terminating pods (#495)
Browse files Browse the repository at this point in the history
Signed-off-by: Xudong Sun <[email protected]>
  • Loading branch information
marshtompsxd authored Jun 7, 2024
1 parent de3eaed commit 0f03d84
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,13 @@ fn filter_pods(pods: Vec<Pod>, v_replica_set: &VReplicaSet) -> (filtered_pods: V
let mut idx = 0;
while idx < pods.len() {
let pod = &pods[idx];
// TODO: check other conditions such as pod status and deletion timestamp
// TODO: check other conditions such as pod status
// Check the following conditions:
// (1) the pod's label should match the replica set's selector
if pod.metadata().owner_references_contains(v_replica_set.controller_owner_ref())
&& v_replica_set.spec().selector().matches(pod.metadata().labels().unwrap_or(StringMap::new())) {
&& v_replica_set.spec().selector().matches(pod.metadata().labels().unwrap_or(StringMap::new()))
// (2) the pod should not be terminating (its deletion timestamp is nil)
&& !pod.metadata().has_deletion_timestamp() {
filtered_pods.push(pod.clone());
}
idx = idx + 1;
Expand Down

0 comments on commit 0f03d84

Please sign in to comment.