diff --git a/pkg/dns/provider/entry.go b/pkg/dns/provider/entry.go index 2c669a58..b4fd7910 100644 --- a/pkg/dns/provider/entry.go +++ b/pkg/dns/provider/entry.go @@ -476,10 +476,6 @@ func (this *EntryVersion) Setup(logger logger.LogContext, state *state, p *Entry } spec, targets, warnings, verr := validate(logger, state, this, p) - if p.provider != nil && spec.TTL != nil { - this.status.TTL = spec.TTL - } - if verr != nil { hello.Infof(logger, "validation failed: %s", verr) @@ -491,6 +487,10 @@ func (this *EntryVersion) Setup(logger logger.LogContext, state *state, p *Entry hello.Infof(logger, "validation ok") + if p.provider != nil && spec.TTL != nil { + this.status.TTL = spec.TTL + } + if this.IsDeleting() { logger.Infof("update state to %s", api.STATE_DELETING) this.status.State = api.STATE_DELETING diff --git a/test/integration/entryLivecycle_test.go b/test/integration/entryLivecycle_test.go index d7d7201d..ef8a4a92 100644 --- a/test/integration/entryLivecycle_test.go +++ b/test/integration/entryLivecycle_test.go @@ -312,4 +312,28 @@ var _ = Describe("EntryLivecycle", func() { err = testEnv.DeleteProviderAndSecret(pr) Ω(err).ShouldNot(HaveOccurred()) }) + + It("handles entry with invalid domain name correctly", func() { + pr, domain, _, err := testEnv.CreateSecretAndProvider("inmemory.mock", 0) + Ω(err).ShouldNot(HaveOccurred()) + + defer testEnv.DeleteProviderAndSecret(pr) + + setSpec := func(e *v1alpha1.DNSEntry) { + e.Spec.DNSName = fmt.Sprintf("invalid-*.%s", domain) + e.Spec.Targets = []string{"1.2.3.4"} + } + e0, err := testEnv.CreateEntryGeneric(0, setSpec) + Ω(err).ShouldNot(HaveOccurred()) + + checkProvider(pr) + + Ω(testEnv.AwaitEntryInvalid(e0.GetName())).ShouldNot(HaveOccurred()) + + err = testEnv.DeleteEntryAndWait(e0) + Ω(err).ShouldNot(HaveOccurred()) + + err = testEnv.DeleteProviderAndSecret(pr) + Ω(err).ShouldNot(HaveOccurred()) + }) })