Skip to content

Commit

Permalink
check for old value and only update if new values differ
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichSchreiner committed Jan 24, 2024
1 parent ac01058 commit 3bc65fc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/clusterwidenetworkpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ func (r *ClusterwideNetworkPolicyReconciler) allowedCWNPs(ctx context.Context, c
}

func (r *ClusterwideNetworkPolicyReconciler) updateCWNPState(ctx context.Context, cwnp firewallv1.ClusterwideNetworkPolicy, state firewallv1.PolicyDeploymentState, msg string) error {
// do nothing if message and state already have the desired values
if cwnp.Status.Message == msg && cwnp.Status.State == state {
return nil
}

cwnp.Status.Message = msg
cwnp.Status.State = state

Expand Down

0 comments on commit 3bc65fc

Please sign in to comment.