Skip to content

Commit

Permalink
feat: enforce recreation (force updating) objects when operator versi…
Browse files Browse the repository at this point in the history
…on changes (#736)

Signed-off-by: arkbriar <[email protected]>
  • Loading branch information
arkbriar authored Oct 18, 2024
1 parent df47bd0 commit 6e0081d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/manager/risingwave_controller_manager_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,11 @@ func (mgr *risingWaveControllerManagerImpl) syncObject(ctx context.Context, obj
if !apierrors.IsInvalid(err) {
return err
}
if !mgr.forceUpdateEnabled ||
obj.GetLabels()[consts.LabelRisingWaveOperatorVersion] == newObj.GetLabels()[consts.LabelRisingWaveOperatorVersion] {

operatorVersionUnchanged := obj.GetLabels()[consts.LabelRisingWaveOperatorVersion] == newObj.GetLabels()[consts.LabelRisingWaveOperatorVersion]
// When operator isn't upgraded and force update isn't enabled, return the error. Otherwise, delete and create
// to avoid inconsistent state.
if !mgr.forceUpdateEnabled && operatorVersionUnchanged {
return err
}
if err := mgr.client.Delete(ctx, obj); err != nil {
Expand Down

0 comments on commit 6e0081d

Please sign in to comment.