@@ -116,10 +116,6 @@ func (r *StorageDefaulter) Default(ctx context.Context, obj runtime.Object) erro
116116 storage := obj .(* Storage )
117117 storagelog .Info ("default" , "name" , storage .Name )
118118
119- if ! storage .Spec .OperatorSync {
120- return nil
121- }
122-
123119 if storage .Spec .OperatorConnection != nil {
124120 if storage .Spec .OperatorConnection .Oauth2TokenExchange != nil {
125121 if storage .Spec .OperatorConnection .Oauth2TokenExchange .SignAlg == "" {
@@ -311,9 +307,43 @@ func hasUpdatesBesidesFrozen(oldStorage, newStorage *Storage) (bool, string) {
311307 oldStorageCopy .Spec .OperatorSync = false
312308 newStorageCopy .Spec .OperatorSync = false
313309
314- ignoreNonSpecFields := cmpopts .IgnoreFields (Storage {}, "Status" , "ObjectMeta" , "TypeMeta" )
310+ // We will allow configuration diffs if they are limited to
311+ // formatting, order of keys in the map etc. If two maps are
312+ // meaningfully different (not deep-equal), we still disallow
313+ // the diff of course.
314+ configurationCompareOpt := cmp .FilterPath (
315+ func (path cmp.Path ) bool {
316+ if sf , ok := path .Last ().(cmp.StructField ); ok {
317+ return sf .Name () == "Configuration"
318+ }
319+ return false
320+ },
321+ cmp .Comparer (func (a , b string ) bool {
322+ var o1 , o2 any
323+
324+ if err := yaml .Unmarshal ([]byte (a ), & o1 ); err != nil {
325+ return false
326+ }
327+ if err := yaml .Unmarshal ([]byte (b ), & o2 ); err != nil {
328+ return false
329+ }
330+
331+ diff := cmp .Diff (o1 , o2 )
332+ if diff != "" {
333+ storagelog .Info (fmt .Sprintf ("Configurations are different:\n %v\n %v" , o1 , o2 ))
334+ }
335+
336+ return diff == ""
337+ }),
338+ )
315339
316- diff := cmp .Diff (oldStorageCopy , newStorageCopy , ignoreNonSpecFields )
340+ ignoreNonSpecFields := cmpopts .IgnoreFields (Storage {}, "Status" , "ObjectMeta" , "TypeMeta" )
341+ diff := cmp .Diff (
342+ oldStorageCopy ,
343+ newStorageCopy ,
344+ ignoreNonSpecFields ,
345+ configurationCompareOpt ,
346+ )
317347 return diff != "" , diff
318348}
319349
0 commit comments