diff --git a/Gopkg.lock b/Gopkg.lock index ecd46086e..43b5adf6a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -189,7 +189,7 @@ [[projects]] branch = "master" - digest = "1:e5098da22926b33a5a475ed373026b56073701e9b2b2a5faca63aae1c5cb0ebb" + digest = "1:76fc55fc324ba9b17a248f0572bb56a1ce079dae1fe61656a8fece8fb15e0411" name = "github.com/gardener/controller-manager-library" packages = [ "pkg/controllermanager", @@ -213,7 +213,7 @@ "pkg/utils", ] pruneopts = "NUT" - revision = "315e86b01963531ea94ab4eea8be1c3dd38217d9" + revision = "ac3f146d19fc2c0eb9d502ab031a2fd4590148c7" [[projects]] digest = "1:260f7ebefc63024c8dfe2c9f1a2935a89fa4213637a1f522f592f80c001cc441" diff --git a/pkg/dns/provider/provider.go b/pkg/dns/provider/provider.go index 9daa6b5e7..4be7af688 100644 --- a/pkg/dns/provider/provider.go +++ b/pkg/dns/provider/provider.go @@ -350,7 +350,7 @@ func updateDNSProvider(logger logger.LogContext, state *state, provider *dnsutil } if len(zones) > 0 && len(this.zones) == 0 { - return this, this.failed(logger, false, fmt.Errorf("no zone available in account matches zone filter"), false) + return this, this.failedButRecheck(logger, fmt.Errorf("no zone available in account matches zone filter")) } included, err := filterByZones(this.def_include, this.zones) @@ -364,14 +364,14 @@ func updateDNSProvider(logger logger.LogContext, state *state, provider *dnsutil if len(this.def_include) == 0 { if len(this.zones) == 0 { - return this, this.failed(logger, false, fmt.Errorf("no hosted zones found"), false) + return this, this.failedButRecheck(logger, fmt.Errorf("no hosted zones found")) } for _, z := range this.zones { included.Add(z.Domain()) } } else { if len(included) == 0 { - return this, this.failed(logger, false, fmt.Errorf("no domain matching hosting zones"), false) + return this, this.failedButRecheck(logger, fmt.Errorf("no domain matching hosting zones")) } } for _, zone := range this.zones { @@ -470,6 +470,24 @@ func (this *dnsProviderVersion) failed(logger logger.LogContext, modified bool, return reconcile.Delay(logger, err) } +func maxDuration(x, y time.Duration) time.Duration { + if x < y { + return y + } + return x +} + +func (this *dnsProviderVersion) failedButRecheck(logger logger.LogContext, err error) reconcile.Status { + uerr := this.setError(false, err) + if uerr != nil { + logger.Error(err) + if errors.IsConflict(uerr) { + return reconcile.Repeat(logger, fmt.Errorf("cannot update provider %q: %s", this.ObjectName(), uerr)) + } + } + return reconcile.Recheck(logger, err, maxDuration(this.state.config.CacheTTL, 30*time.Minute)) +} + func (this *dnsProviderVersion) succeeded(logger logger.LogContext, modified bool) reconcile.Status { status := &this.object.DNSProvider().Status mod := resources.NewModificationState(this.object, modified) diff --git a/vendor/github.com/gardener/controller-manager-library/pkg/controllermanager/controller/reconcile/utils.go b/vendor/github.com/gardener/controller-manager-library/pkg/controllermanager/controller/reconcile/utils.go index fa080f152..7a995bdbf 100644 --- a/vendor/github.com/gardener/controller-manager-library/pkg/controllermanager/controller/reconcile/utils.go +++ b/vendor/github.com/gardener/controller-manager-library/pkg/controllermanager/controller/reconcile/utils.go @@ -18,6 +18,7 @@ package reconcile import ( "fmt" + "time" "github.com/gardener/controller-manager-library/pkg/logger" "github.com/gardener/controller-manager-library/pkg/resources" @@ -66,6 +67,15 @@ func Failed(logger logger.LogContext, err error) Status { return Status{false, err, -1} } +func Recheck(logger logger.LogContext, err error, interval ...time.Duration) Status { + logger.Error(err) + i := 30 * time.Minute + if len(interval) > 0 { + i = interval[0] + } + return Status{err == nil, err, i} +} + func FailedOnError(logger logger.LogContext, err error) Status { if err == nil { return Succeeded(logger)