Skip to content

Commit 08ed4c0

Browse files
authored
PWX-27015: Remove unwanted events during volume update retries. (#1272)
Signed-off-by: Priyanshu Pandey <ppandey@purestorage.com>
1 parent 03d690a commit 08ed4c0

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

pkg/migration/controllers/migration.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,22 @@ package controllers
33
import (
44
"context"
55
"fmt"
6-
storkcache "github.com/libopenstorage/stork/pkg/cache"
76
"math/rand"
87
"reflect"
98
"strconv"
109
"strings"
1110
"time"
1211

13-
"github.com/libopenstorage/stork/pkg/utils"
14-
1512
"github.com/go-openapi/inflect"
1613
"github.com/libopenstorage/stork/drivers/volume"
1714
stork_api "github.com/libopenstorage/stork/pkg/apis/stork/v1alpha1"
15+
storkcache "github.com/libopenstorage/stork/pkg/cache"
1816
"github.com/libopenstorage/stork/pkg/controllers"
1917
"github.com/libopenstorage/stork/pkg/k8sutils"
2018
"github.com/libopenstorage/stork/pkg/log"
2119
"github.com/libopenstorage/stork/pkg/resourcecollector"
2220
"github.com/libopenstorage/stork/pkg/rule"
21+
"github.com/libopenstorage/stork/pkg/utils"
2322
"github.com/libopenstorage/stork/pkg/version"
2423
"github.com/mitchellh/hashstructure"
2524
"github.com/portworx/sched-ops/k8s/apiextensions"
@@ -472,11 +471,14 @@ func (m *MigrationController) handle(ctx context.Context, migration *stork_api.M
472471
if err != nil {
473472
message := fmt.Sprintf("Error migrating volumes: %v", err)
474473
log.MigrationLog(migration).Errorf(message)
475-
m.recorder.Event(migration,
476-
v1.EventTypeWarning,
477-
string(stork_api.MigrationStatusFailed),
478-
message)
479-
return nil
474+
// Don't need to log this event as Stork retries if it fails to update
475+
if !strings.Contains(message, "please apply your changes to the latest version and try again") {
476+
m.recorder.Event(migration,
477+
v1.EventTypeWarning,
478+
string(stork_api.MigrationStatusFailed),
479+
message)
480+
return nil
481+
}
480482
}
481483
} else {
482484
migration.Status.Stage = stork_api.MigrationStageApplications

0 commit comments

Comments
 (0)