Skip to content

Commit 186f7e0

Browse files
committed
wip
1 parent 8b71781 commit 186f7e0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

api/v1alpha1/storage_webhook.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"math/rand"
7-
"reflect"
87

98
"github.com/golang-jwt/jwt/v4"
109
"github.com/google/go-cmp/cmp"
@@ -117,6 +116,10 @@ func (r *StorageDefaulter) Default(ctx context.Context, obj runtime.Object) erro
117116
storage := obj.(*Storage)
118117
storagelog.Info("default", "name", storage.Name)
119118

119+
if !storage.Spec.OperatorSync {
120+
return nil
121+
}
122+
120123
if storage.Spec.OperatorConnection != nil {
121124
if storage.Spec.OperatorConnection.Oauth2TokenExchange != nil {
122125
if storage.Spec.OperatorConnection.Oauth2TokenExchange.SignAlg == "" {
@@ -329,7 +332,12 @@ func hasUpdatesBesidesFrozen(oldStorage, newStorage *Storage) (bool, string) {
329332
return false
330333
}
331334

332-
return reflect.DeepEqual(o1, o2)
335+
diff := cmp.Diff(o1, o2)
336+
if diff != "" {
337+
storagelog.Info(fmt.Sprintf("Configurations are different:\n%v\n%v", o1, o2))
338+
}
339+
340+
return diff == ""
333341
}),
334342
)
335343

0 commit comments

Comments
 (0)