Skip to content

Commit

Permalink
add more infomation in the remedy-controller
Browse files Browse the repository at this point in the history
Signed-off-by: changzhen <[email protected]>
  • Loading branch information
XiShanYongYe-Chang committed Jun 11, 2024
1 parent 049ddc6 commit 431b8d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/controllers/remediation/remedy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ func (c *RemedyController) Reconcile(ctx context.Context, req controllerruntime.
actions := calculateActions(clusterRelatedRemedies, cluster)
err = retry.RetryOnConflict(retry.DefaultRetry, func() error {
if reflect.DeepEqual(actions, cluster.Status.RemedyActions) {
klog.V(4).Infof("Ignore to sync cluster(%s) with remedy actions as it has been latest.", cluster.Name)
return nil
}
cluster.Status.RemedyActions = actions
updateErr := c.Client.Status().Update(ctx, cluster)
if updateErr == nil {
klog.V(4).Infof("Success to sync cluster(%s) with remedy actions: %v", cluster.Name, actions)
return nil
}

Expand All @@ -93,7 +95,6 @@ func (c *RemedyController) Reconcile(ctx context.Context, req controllerruntime.
klog.Errorf("Failed to sync cluster(%s) remedy actions: %v", cluster.Name, err)
return controllerruntime.Result{}, err
}
klog.V(4).Infof("Success to sync cluster(%s) remedy actions", cluster.Name)
return controllerruntime.Result{}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/remedy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var _ = framework.SerialDescribe("remedy testing", func() {
var remedy *remedyv1alpha1.Remedy
var targetCluster string

ginkgo.Context("remedy.spec.decisionMatches is not empty", func() {
framework.SerialContext("remedy.spec.decisionMatches is not empty", func() {
ginkgo.BeforeEach(func() {
targetCluster = framework.ClusterNames()[0]
remedyName = remedyNamePrefix + rand.String(RandomStrLength)
Expand Down Expand Up @@ -150,7 +150,7 @@ var _ = framework.SerialDescribe("remedy testing", func() {
})
})

ginkgo.Context("test with nil decision matches remedy", func() {
framework.SerialContext("test with nil decision matches remedy", func() {
ginkgo.BeforeEach(func() {
targetCluster = framework.ClusterNames()[0]
remedyName = remedyNamePrefix + rand.String(RandomStrLength)
Expand Down

0 comments on commit 431b8d9

Please sign in to comment.