@@ -483,12 +483,12 @@ func createIngressLinkHandlers(lbc *LoadBalancerController) cache.ResourceEventH
483
483
UpdateFunc : func (old , cur interface {}) {
484
484
oldLink := old .(* unstructured.Unstructured )
485
485
curLink := cur .(* unstructured.Unstructured )
486
- updated , err := compareSpecs (oldLink , curLink )
486
+ different , err := areResourcesDifferent (oldLink , curLink )
487
487
if err != nil {
488
488
glog .V (3 ).Infof ("Error when comparing IngressLinks: %v" , err )
489
489
lbc .AddSyncQueue (curLink )
490
490
}
491
- if updated {
491
+ if different {
492
492
glog .V (3 ).Infof ("IngressLink %v changed, syncing" , oldLink .GetName ())
493
493
lbc .AddSyncQueue (curLink )
494
494
}
@@ -506,12 +506,12 @@ func createAppProtectPolicyHandlers(lbc *LoadBalancerController) cache.ResourceE
506
506
UpdateFunc : func (oldObj , obj interface {}) {
507
507
oldPol := oldObj .(* unstructured.Unstructured )
508
508
newPol := obj .(* unstructured.Unstructured )
509
- updated , err := compareSpecs (oldPol , newPol )
509
+ different , err := areResourcesDifferent (oldPol , newPol )
510
510
if err != nil {
511
511
glog .V (3 ).Infof ("Error when comparing policy %v" , err )
512
512
lbc .AddSyncQueue (newPol )
513
513
}
514
- if updated {
514
+ if different {
515
515
glog .V (3 ).Infof ("ApPolicy %v changed, syncing" , oldPol .GetName ())
516
516
lbc .AddSyncQueue (newPol )
517
517
}
@@ -523,8 +523,8 @@ func createAppProtectPolicyHandlers(lbc *LoadBalancerController) cache.ResourceE
523
523
return handlers
524
524
}
525
525
526
- // compareSpecs returns true if the resources are different.
527
- func compareSpecs (oldresource , resource * unstructured.Unstructured ) (bool , error ) {
526
+ // areResourcesDifferent returns true if the resources are different based on their spec .
527
+ func areResourcesDifferent (oldresource , resource * unstructured.Unstructured ) (bool , error ) {
528
528
oldSpec , found , err := unstructured .NestedMap (oldresource .Object , "spec" )
529
529
if ! found {
530
530
glog .V (3 ).Infof ("Warning, oldspec has unexpected format" )
@@ -556,12 +556,12 @@ func createAppProtectLogConfHandlers(lbc *LoadBalancerController) cache.Resource
556
556
UpdateFunc : func (oldObj , obj interface {}) {
557
557
oldConf := oldObj .(* unstructured.Unstructured )
558
558
newConf := obj .(* unstructured.Unstructured )
559
- updated , err := compareSpecs (oldConf , newConf )
559
+ different , err := areResourcesDifferent (oldConf , newConf )
560
560
if err != nil {
561
561
glog .V (3 ).Infof ("Error when comparing LogConfs %v" , err )
562
562
lbc .AddSyncQueue (newConf )
563
563
}
564
- if updated {
564
+ if different {
565
565
glog .V (3 ).Infof ("ApLogConf %v changed, syncing" , oldConf .GetName ())
566
566
lbc .AddSyncQueue (newConf )
567
567
}
@@ -583,12 +583,12 @@ func createAppProtectUserSigHandlers(lbc *LoadBalancerController) cache.Resource
583
583
UpdateFunc : func (oldObj , obj interface {}) {
584
584
oldSig := oldObj .(* unstructured.Unstructured )
585
585
newSig := obj .(* unstructured.Unstructured )
586
- updated , err := compareSpecs (oldSig , newSig )
586
+ different , err := areResourcesDifferent (oldSig , newSig )
587
587
if err != nil {
588
588
glog .V (3 ).Infof ("Error when comparing UserSigs %v" , err )
589
589
lbc .AddSyncQueue (newSig )
590
590
}
591
- if updated {
591
+ if different {
592
592
glog .V (3 ).Infof ("ApUserSig %v changed, syncing" , oldSig .GetName ())
593
593
lbc .AddSyncQueue (newSig )
594
594
}
0 commit comments