File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-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,27 @@ 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+ }
599+
600+ if s .currentConfigHash == hash {
601+ log .Infof ("not applying host config as there are no changes" )
602+ return
603+ }
604+
589605 if err := s .hostManager .applyDNSConfig (config , s .stateManager ); err != nil {
590606 log .Errorf ("failed to apply DNS host manager update: %v" , err )
591607 }
592608
609+ s .currentConfigHash = hash
610+
593611 s .registerFallback (config )
594612}
595613
You can’t perform that action at this time.
0 commit comments