Skip to content

Commit 374536a

Browse files
authored
sync remote chaos experiements status (chaos-mesh#4188)
* sync remote chaos experiements status Signed-off-by: nio <[email protected]> * update changlog Signed-off-by: nio <[email protected]> --------- Signed-off-by: nio <[email protected]>
1 parent 7a55558 commit 374536a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ For more information and how-to, see [RFC: Keep A Changelog](https://github.com/
1818
- Add [`GreptimeDB`](https://greptime.com) to ADOPTERS.md [#4245](https://github.com/chaos-mesh/chaos-mesh/pull/4245)
1919
- Support configurable chaos-dns-server pod affinities[#4260](https://github.com/chaos-mesh/chaos-mesh/pull/4260)
2020
- Add experiment `name`, `namespace` and `kind` to "apply chaos" and "recover chaos" log messages [4278](https://github.com/chaos-mesh/chaos-mesh/pull/4278)
21+
- Support for watch remote chaos experiments to locally chaos [#4188](https://github.com/chaos-mesh/chaos-mesh/pull/4188)
2122

2223
### Changed
2324

controllers/multicluster/remotechaosmonitor/controller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
117117

118118
shouldUpdate = true
119119
}
120+
120121
// TODO: set the status
122+
if !reflect.DeepEqual(localObj.GetStatus(), remoteObj.GetStatus()) {
123+
r.logger.Info("setting new status", "local:", localObj.GetStatus(), "remote:", remoteObj.GetStatus())
124+
shouldUpdate = true
125+
}
121126

122127
if shouldUpdate {
123128
retry.RetryOnConflict(retry.DefaultRetry, func() error {
@@ -129,7 +134,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
129134

130135
// TODO: also refresh the remote chaos object
131136
localObj.SetFinalizers(remoteObj.GetFinalizers())
132-
137+
remoteObj.GetStatus().DeepCopyInto(localObj.GetStatus())
133138
return r.localClient.Update(ctx, localObj)
134139
})
135140
}

0 commit comments

Comments
 (0)