File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ type DefaultServer struct {
8080 updateSerial uint64
8181 previousConfigHash uint64
8282 currentConfig HostDNSConfig
83+ currentConfigHash uint64
8384 handlerChain * HandlerChain
8485 extraDomains map [domain.Domain ]int
8586
@@ -586,10 +587,28 @@ func (s *DefaultServer) applyHostConfig() {
586587
587588 log .Debugf ("extra match domains: %v" , maps .Keys (s .extraDomains ))
588589
590+ hash , err := hashstructure .Hash (config , hashstructure .FormatV2 , & hashstructure.HashOptions {
591+ ZeroNil : true ,
592+ IgnoreZeroValue : true ,
593+ SlicesAsSets : true ,
594+ UseStringer : true ,
595+ })
596+ if err != nil {
597+ log .Errorf ("unable to hash the host dns configuration, got error: %s" , err )
598+ return
599+ }
600+
601+ if s .currentConfigHash == hash {
602+ log .Debugf ("not applying host config as there are no changes" )
603+ return
604+ }
605+
589606 if err := s .hostManager .applyDNSConfig (config , s .stateManager ); err != nil {
590607 log .Errorf ("failed to apply DNS host manager update: %v" , err )
591608 }
592609
610+ s .currentConfigHash = hash
611+
593612 s .registerFallback (config )
594613}
595614
You can’t perform that action at this time.
0 commit comments