Skip to content

Commit

Permalink
we always generate patch because we are comparing against emtpy obj
Browse files Browse the repository at this point in the history
Signed-off-by: Zach Aller <[email protected]>
  • Loading branch information
zachaller committed Jun 7, 2024
1 parent e52400d commit ec9d9b0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions rollout/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1009,17 +1009,15 @@ func (c *rolloutContext) updateReplicaSetFallbackToPatch(ctx context.Context, rs
}
}

patch, changed, err := diff.CreateTwoWayMergePatch(appsv1.ReplicaSet{}, patchRS, appsv1.ReplicaSet{})
patch, _, err := diff.CreateTwoWayMergePatch(appsv1.ReplicaSet{}, patchRS, appsv1.ReplicaSet{})
if err != nil {
return nil, fmt.Errorf("error creating patch for conflict log in updateReplicaSetFallbackToPatch %s: %w", rs.Name, err)
}

if changed {
c.log.Infof("Patching replicaset with patch: %s", string(patch))
updatedRS, err = c.kubeclientset.AppsV1().ReplicaSets(rs.Namespace).Patch(ctx, rs.Name, patchtypes.StrategicMergePatchType, patch, metav1.PatchOptions{})
if err != nil {
return nil, fmt.Errorf("error patching replicaset in updateReplicaSetFallbackToPatch %s: %w", rs.Name, err)
}
c.log.Infof("Patching replicaset with patch: %s", string(patch))
updatedRS, err = c.kubeclientset.AppsV1().ReplicaSets(rs.Namespace).Patch(ctx, rs.Name, patchtypes.StrategicMergePatchType, patch, metav1.PatchOptions{})
if err != nil {
return nil, fmt.Errorf("error patching replicaset in updateReplicaSetFallbackToPatch %s: %w", rs.Name, err)
}

err = c.replicaSetInformer.GetIndexer().Update(updatedRS)
Expand Down

0 comments on commit ec9d9b0

Please sign in to comment.