Skip to content

Commit

Permalink
Ignore ScheduleSkipRemoveHistory events (chaos-mesh#3767)
Browse files Browse the repository at this point in the history
* Set default time period to clean finished chaos to 10 minutes

Signed-off-by: cwen0 <[email protected]>

* ignore schedule skil event

Signed-off-by: cwen0 <[email protected]>

* update CHANGELOG

Signed-off-by: cwen0 <[email protected]>

* address comments

Signed-off-by: cwen0 <[email protected]>

Signed-off-by: cwen0 <[email protected]>
Co-authored-by: Ti Chi Robot <[email protected]>
  • Loading branch information
cwen0 and ti-chi-bot authored Nov 15, 2022
1 parent 8dc83ab commit fc1349d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ For more information and how-to, see [RFC: Keep A Changelog](https://github.com/
- Fix typo in controller error message [#3704](https://github.com/chaos-mesh/chaos-mesh/pull/3704)
- Fix panic when logging, log kvs as pair [#3716](https://github.com/chaos-mesh/chaos-mesh/pull/3716)
- Fix timechaos not injected into the child process [#3725](https://github.com/chaos-mesh/chaos-mesh/pull/3725)
- Ignore `ScheduleSkipRemoveHistory` events to fix the memory of controller-manager keep increasing [#3761](https://github.com/chaos-mesh/chaos-mesh/issues/3761)
- Update `is mandatory` to true in a swagger comment [#3743](https://github.com/chaos-mesh/chaos-mesh/pull/3743)

### Security
Expand Down Expand Up @@ -124,7 +125,7 @@ For more information and how-to, see [RFC: Keep A Changelog](https://github.com/

### Fixed

- fix NetworkChaos fail with @ifXX in the device [#3605](https://github.com/chaos-mesh/chaos-mesh/pull/3605)
- Fix NetworkChaos fail with @ifXX in the device [#3605](https://github.com/chaos-mesh/chaos-mesh/pull/3605)
- Fix BlockChaos can't show Chinese name. [#3536](https://github.com/chaos-mesh/chaos-mesh/pull/3536)
- Add `omitempty` JSON tag to optional fields of the CRD objects. [#3531](https://github.com/chaos-mesh/chaos-mesh/pull/3531)
- Fix "sidecar config" e2e test cases run failed in some scenario.[#3564](https://github.com/chaos-mesh/chaos-mesh/pull/3564)
Expand Down
1 change: 0 additions & 1 deletion controllers/schedule/cron/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type Reconciler struct {
var t = true

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {

schedule := &v1alpha1.Schedule{}
err := r.Get(ctx, req.NamespacedName, schedule)
if err != nil {
Expand Down
10 changes: 2 additions & 8 deletions controllers/schedule/gc/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
err := r.Get(ctx, req.NamespacedName, schedule)
if err != nil {
if !k8sError.IsNotFound(err) {
r.Log.Error(err, "unable to get chaos")
r.Log.Error(err, "unable to get schedule chaos")
}
return ctrl.Result{}, nil
}
Expand All @@ -81,6 +81,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
})

exceededHistory := len(metaItems) - schedule.Spec.HistoryLimit

requeuAfter := time.Duration(0)
if exceededHistory > 0 {
for _, obj := range metaItems[0:exceededHistory] {
Expand All @@ -93,10 +94,6 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
if requeuAfter == 0 || requeuAfter > untilStop {
requeuAfter = untilStop
}

r.Recorder.Event(schedule, recorder.ScheduleSkipRemoveHistory{
RunningName: innerObj.GetName(),
})
continue
}

Expand All @@ -110,9 +107,6 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
finished := controllers.WorkflowConditionEqualsTo(workflow.Status, v1alpha1.WorkflowConditionAccomplished, corev1.ConditionTrue)

if !finished {
r.Recorder.Event(schedule, recorder.ScheduleSkipRemoveHistory{
RunningName: workflow.Name,
})
continue
}
}
Expand Down

0 comments on commit fc1349d

Please sign in to comment.