From b98c8a16d315c02f5400e05cd39fc53eb97bf660 Mon Sep 17 00:00:00 2001 From: arkadeepsen Date: Wed, 5 Jun 2024 12:10:15 +0530 Subject: [PATCH] Bump version of DNSNameResolver controller --- go.mod | 2 ++ go.sum | 4 ++-- .../operator/controller/dnsnameresolver/resolver.go | 11 +++++++++-- vendor/modules.txt | 3 ++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 4e49d6c1..49cde187 100644 --- a/go.mod +++ b/go.mod @@ -88,3 +88,5 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) + +replace github.com/openshift/coredns-ocp-dnsnameresolver/operator => github.com/arkadeepsen/coredns-ocp-dnsnameresolver/operator v0.0.0-20240605061127-a7e22da64aa8 diff --git a/go.sum b/go.sum index 90aa4af4..84bc981e 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/apparentlymart/go-cidr v1.0.0 h1:lGDvXx8Lv9QHjrAVP7jyzleG4F9+FkRhJcEsDFxeb8w= github.com/apparentlymart/go-cidr v1.0.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= +github.com/arkadeepsen/coredns-ocp-dnsnameresolver/operator v0.0.0-20240605061127-a7e22da64aa8 h1:WRQZjA59OsooWdFuPGYm5RtUSzQ5X4uhrUy4frsBwkI= +github.com/arkadeepsen/coredns-ocp-dnsnameresolver/operator v0.0.0-20240605061127-a7e22da64aa8/go.mod h1:xr33hQoeI2qcehK9kYPm9V86CTumVN/sdDOGdxw10Xg= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= @@ -92,8 +94,6 @@ github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d h1:RR github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE= github.com/openshift/client-go v0.0.0-20231024221206-506d798bc61c h1:xfag+wccUqc9EdrWsnprD6x5KG2WE+iKGFfFELCwwRA= github.com/openshift/client-go v0.0.0-20231024221206-506d798bc61c/go.mod h1:3BkYp+FtKD2TypMD0nTPkVsxUaY4fJPLEMFMlOLtrJM= -github.com/openshift/coredns-ocp-dnsnameresolver/operator v0.0.0-20240514135022-c41cdd134379 h1:aJcP4gqTC2vLW6c/ZktcAIjzm31unnCRTNi2VZkLDIU= -github.com/openshift/coredns-ocp-dnsnameresolver/operator v0.0.0-20240514135022-c41cdd134379/go.mod h1:k0W4ol96vtJ9XtOU1cLzHci9biisZf0CflX+Pj3F1V8= github.com/openshift/library-go v0.0.0-20231102154438-cfcf2b4fbc87 h1:GcaI98ric0Q3WbZsTh8cIE39pgw12v3s3xuiIFO5zQ0= github.com/openshift/library-go v0.0.0-20231102154438-cfcf2b4fbc87/go.mod h1:8UzmrBMCn7+GzouL8DVYkL9COBQTB1Ggd13/mHJQCUg= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/vendor/github.com/openshift/coredns-ocp-dnsnameresolver/operator/controller/dnsnameresolver/resolver.go b/vendor/github.com/openshift/coredns-ocp-dnsnameresolver/operator/controller/dnsnameresolver/resolver.go index 99eabf88..2f569be7 100644 --- a/vendor/github.com/openshift/coredns-ocp-dnsnameresolver/operator/controller/dnsnameresolver/resolver.go +++ b/vendor/github.com/openshift/coredns-ocp-dnsnameresolver/operator/controller/dnsnameresolver/resolver.go @@ -114,8 +114,9 @@ func (resolver *Resolver) Start() { // after the remaining duration. timeTillNextLookup = remainingDuration } else { - // TTL of the DNS name has already expired, so send DNS lookup request as soon as possible. - timeTillNextLookup = 1 * time.Millisecond + // A DNS lookup request has been sent upon TTL expiration of the DNS name. Reset the timer to wait until twice of default + // minimum TTL to perform the next lookup. + timeTillNextLookup = 2 * defaultMinTTL } timer.Reset(timeTillNextLookup) } @@ -304,6 +305,12 @@ func (resolver *Resolver) getNextDNSNameDetails() (string, time.Time, int, bool) dns = dnsName numIPs = resolvedName.numIPs } + // If there are no IP addresses associated with the DNS name and the next lookup + // time of the DNS name is already past the current time, then reset the next + // lookup time to the default maximum TTL. + if resolvedName.numIPs == 0 && !time.Now().Before(resolvedName.minNextLookupTime) { + resolvedName.minNextLookupTime = time.Now().Add(defaultMaxTTL) + } } return dns, minNextLookupTime, numIPs, exists } diff --git a/vendor/modules.txt b/vendor/modules.txt index 45568740..7066393b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -212,7 +212,7 @@ github.com/openshift/client-go/config/informers/externalversions/config/v1alpha1 github.com/openshift/client-go/config/informers/externalversions/internalinterfaces github.com/openshift/client-go/config/listers/config/v1 github.com/openshift/client-go/config/listers/config/v1alpha1 -# github.com/openshift/coredns-ocp-dnsnameresolver/operator v0.0.0-20240514135022-c41cdd134379 +# github.com/openshift/coredns-ocp-dnsnameresolver/operator v0.0.0-20240514135022-c41cdd134379 => github.com/arkadeepsen/coredns-ocp-dnsnameresolver/operator v0.0.0-20240605061127-a7e22da64aa8 ## explicit; go 1.21 github.com/openshift/coredns-ocp-dnsnameresolver/operator/controller/dnsnameresolver # github.com/openshift/library-go v0.0.0-20231102154438-cfcf2b4fbc87 @@ -890,3 +890,4 @@ sigs.k8s.io/structured-merge-diff/v4/value ## explicit; go 1.12 sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 +# github.com/openshift/coredns-ocp-dnsnameresolver/operator => github.com/arkadeepsen/coredns-ocp-dnsnameresolver/operator v0.0.0-20240605061127-a7e22da64aa8