PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: coredns/coredns (go)

Issue:
plugin/k8s_external
<!-- 
When reporting bugs and requesting assistance, please include:
* the version of CoreDNS you are using
* your Corefile
* logs, if applicable

Thanks for using CoreDNS!
-->
using coredns 1.3.1 and the k8s_external plugin i miss some A records in the dns subzone

<pre>
.:53 {
    errors
    health
    kubernetes k8s.cluster.local in-addr.arpa ip6.arpa {
       pods insecure
       upstream
       fallthrough in-addr.arpa ip6.arpa
       ttl 30
    }
    k8s_external k9s.cluster.local in-addr.arpa ip6.arpa {
       ttl 30
    }
    prometheus :9153
    forward . /etc/resolv.conf
    cache 30
    loop
    reload
    loadbalance
}
</pre>

the documentation notes that there is a stub/apex zone. But i'm missing an NS record and an A record
<pre>
dig NS k9s.cluster.local => invalid dns package
dig NS dns.k9s.cluster.local =>  no entry
dig A ns1.dns.k9s.cluster.local => no entry
</pre>

The kubernetes plugin handles them like
<pre>
dig NS k8s.cluster.local => ns.dns.k8s.cluster.local.
dig NS dns.k8s.cluster.local => no entry
dig A ns.dns.k8s.cluster.local => 10.96.x.y
</pre>

Pull request:
plugin/k8s_external: Correct test case and code
### 1. Why is this pull request needed and what does it do?

The NS test case was expecting the wrong A record name (expecting `example.com` instead of `ns1.dns.example.com`). This fixes the test case, and the code that was passing the bad test case.

### 2. Which issues (if any) are related?
Further fixes #3064

### 3. Which documentation changes (if any) need to be made?
none

### 4. Does this introduce a backward incompatible change or deprecation?
no


Patch:
diff --git a/plugin/k8s_external/apex.go b/plugin/k8s_external/apex.go
index f58894817..85edbea6c 100644
--- a/plugin/k8s_external/apex.go
+++ b/plugin/k8s_external/apex.go
@@ -20,7 +20,7 @@ func (e *External) serveApex(state request.Request) (int, error) {
 		addr := e.externalAddrFunc(state)
 		for _, rr := range addr {
 			rr.Header().Ttl = e.ttl
-			rr.Header().Name = state.QName()
+			rr.Header().Name = dnsutil.Join("ns1", e.apex, state.QName())
 			m.Extra = append(m.Extra, rr)
 		}
 	default:


Test patch:
diff --git a/plugin/k8s_external/apex_test.go b/plugin/k8s_external/apex_test.go
index 14aaf64bc..2f6923f56 100644
--- a/plugin/k8s_external/apex_test.go
+++ b/plugin/k8s_external/apex_test.go
@@ -59,7 +59,7 @@ var testsApex = []test.Case{
 			test.NS("example.com.	5	IN	NS	ns1.dns.example.com."),
 		},
 		Extra: []dns.RR{
-			test.A("example.com.	5	IN	A	127.0.0.1"),
+			test.A("ns1.dns.example.com.	5	IN	A	127.0.0.1"),
 		},
 	},
 	{