Skip to content

Commit

Permalink
Fix permission issue when settin the operator-condition (#70)
Browse files Browse the repository at this point in the history
The conditions moved from the `Status` field to the `Spec`, but when setting the condition, the code still uses `client.Status().Update()` to set the condition, instead of just `client.Update()`. This is wrong in two ways: first, the code is trying to update the spec, so it will fail, and also, the operator does not have permissions to update the status. As result, the `Set` function always returns error.

This PR changes the client call to use the regular client instead of the status client.

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
  • Loading branch information
nunnatsa committed Jul 28, 2021
1 parent 3986790 commit ecd9a4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion conditions/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (c *condition) Set(ctx context.Context, status metav1.ConditionStatus, opti
}
}
meta.SetStatusCondition(&operatorCond.Spec.Conditions, *newCond)
err = c.client.Status().Update(ctx, operatorCond)
err = c.client.Update(ctx, operatorCond)
if err != nil {
return err
}
Expand Down

0 comments on commit ecd9a4a

Please sign in to comment.