Skip to content

Commit 063382e

Browse files
committed
gwapi e2e: Add more logs to detect DNSRecord absence problem
1 parent 6fe4db1 commit 063382e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pkg/resources/dnsrecord/dns.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ func EnsureDNSRecord(client client.Client, name types.NamespacedName, dnsRecordL
8383
if updated, err := updateDNSRecord(client, current, desired); err != nil {
8484
return true, current, fmt.Errorf("failed to update dnsrecord %s/%s: %v", desired.Namespace, desired.Name, err)
8585
} else if updated {
86+
log.Info("updated dnsrecord", "dnsrecord", desired)
8687
return CurrentDNSRecord(client, name)
8788
}
8889
}
90+
log.Info("dnsrecord is not wanted", "dnsrecord", desired)
8991

9092
return haveWC, current, nil
9193
}
@@ -130,6 +132,7 @@ func desiredWildcardDNSRecord(name types.NamespacedName, dnsRecordLabels map[str
130132
func desiredDNSRecord(name types.NamespacedName, dnsRecordLabels map[string]string, ownerRef metav1.OwnerReference, domain string, dnsPolicy iov1.DNSManagementPolicy, service *corev1.Service) (bool, *iov1.DNSRecord) {
131133
// No LB target exists for the domain record to point at.
132134
if len(service.Status.LoadBalancer.Ingress) == 0 {
135+
log.Info("no load balancer target for dns record", "dnsrecord", name, "service", service.Name)
133136
return false, nil
134137
}
135138

@@ -138,6 +141,7 @@ func desiredDNSRecord(name types.NamespacedName, dnsRecordLabels map[string]stri
138141
// Quick sanity check since we don't know how to handle both being set (is
139142
// that even a valid state?)
140143
if len(ingress.Hostname) > 0 && len(ingress.IP) > 0 {
144+
log.Info("no load balancer hostname or IP for dns record", "dnsrecord", name, "service", service.Name)
141145
return false, nil
142146
}
143147

test/e2e/util_gatewayapi_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,21 +851,21 @@ func assertDNSRecord(t *testing.T, recordName types.NamespacedName) error {
851851

852852
err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 1*time.Minute, false, func(context context.Context) (bool, error) {
853853
if err := kclient.Get(context, recordName, dnsRecord); err != nil {
854-
t.Logf("Failed to get DNSRecord %v: %v; retrying...", recordName, err)
854+
t.Logf("[%s] Failed to get DNSRecord %v: %v; retrying...", time.Now().Format(time.DateTime), recordName, err)
855855
return false, nil
856856
}
857857
// Determine the current state of the DNSRecord.
858858
if len(dnsRecord.Status.Zones) > 0 {
859859
for _, zone := range dnsRecord.Status.Zones {
860860
for _, condition := range zone.Conditions {
861861
if condition.Type == v1.DNSRecordPublishedConditionType && condition.Status == string(metav1.ConditionTrue) {
862-
t.Logf("Found DNSRecord %v %s=%s", recordName, condition.Type, condition.Status)
862+
t.Logf("[%s] Found DNSRecord %v %s=%s", time.Now().Format(time.DateTime), recordName, condition.Type, condition.Status)
863863
return true, nil
864864
}
865865
}
866866
}
867867
}
868-
t.Logf("Found DNSRecord %v but could not determine its readiness; retrying...", recordName)
868+
t.Logf("[%s] Found DNSRecord %v but could not determine its readiness; retrying...", time.Now().Format(time.DateTime), recordName)
869869
return false, nil
870870
})
871871
return err

0 commit comments

Comments
 (0)