Skip to content

Commit

Permalink
Fix podgroup not creating Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyuanchun11 committed Jul 8, 2024
1 parent fea0ae3 commit cc4c00f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/controllers/podgroup/pg_controller_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ func (pg *pgcontroller) addReplicaSet(obj interface{}) {
if err != nil && !apierrors.IsNotFound(err) {
klog.Errorf("Failed to delete PodGroup <%s/%s>: %v", rs.Namespace, pgName, err)
}
} else if *rs.Spec.Replicas > 0 {
}

// In the rolling upgrade scenario, the addReplicasSet(replicas=0) event may be received before
// the updateReplicaSet(replicas=1) event. In this event, need to create PodGroup for the pod.
if *rs.Spec.Replicas > 0 {
selector := metav1.LabelSelector{MatchLabels: rs.Spec.Selector.MatchLabels}
podList, err := pg.kubeClient.CoreV1().Pods(rs.Namespace).List(context.TODO(),
metav1.ListOptions{LabelSelector: metav1.FormatLabelSelector(&selector)})
Expand Down

0 comments on commit cc4c00f

Please sign in to comment.