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 @@ -79,6 +79,7 @@ type DefaultServer struct {
7979 updateSerial uint64
8080 previousConfigHash uint64
8181 currentConfig HostDNSConfig
82+ currentConfigHash uint64
8283 handlerChain * HandlerChain
8384 extraDomains map [domain.Domain ]int
8485
@@ -583,10 +584,27 @@ func (s *DefaultServer) applyHostConfig() {
583584
584585 log .Debugf ("extra match domains: %v" , maps .Keys (s .extraDomains ))
585586
587+ hash , err := hashstructure .Hash (config , hashstructure .FormatV2 , & hashstructure.HashOptions {
588+ ZeroNil : true ,
589+ IgnoreZeroValue : true ,
590+ SlicesAsSets : true ,
591+ UseStringer : true ,
592+ })
593+ if err != nil {
594+ log .Errorf ("unable to hash the host dns configuration, got error: %s" , err )
595+ }
596+
597+ if s .currentConfigHash == hash {
598+ log .Infof ("not applying host config as there are no changes" )
599+ return
600+ }
601+
586602 if err := s .hostManager .applyDNSConfig (config , s .stateManager ); err != nil {
587603 log .Errorf ("failed to apply DNS host manager update: %v" , err )
588604 }
589605
606+ s .currentConfigHash = hash
607+
590608 s .registerFallback (config )
591609}
592610
You can’t perform that action at this time.
0 commit comments