mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-06-09 08:55:55 -04:00
Add DNS e2e test of NameIsDNSLabel validated Service names
This commit is contained in:
parent
97c1974e9c
commit
22138ef552
1 changed files with 30 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ import (
|
|||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||
|
|
@ -654,6 +655,35 @@ var _ = common.SIGDescribe("DNS", func() {
|
|||
}
|
||||
validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...))
|
||||
})
|
||||
|
||||
framework.It("should work with a service name that starts with a digit", framework.WithFeatureGate(features.RelaxedServiceNameValidation), func(ctx context.Context) {
|
||||
svcName := "1kubernetes"
|
||||
svc := v1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: svcName,
|
||||
},
|
||||
Spec: v1.ServiceSpec{
|
||||
Ports: []v1.ServicePort{{Port: 443}},
|
||||
},
|
||||
}
|
||||
|
||||
createServiceReportErr(ctx, f.ClientSet, f.Namespace.Name, &svc)
|
||||
namesToResolve := []string{
|
||||
fmt.Sprintf("%s.%s.svc.%s", svcName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain),
|
||||
}
|
||||
|
||||
agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, nil, "", "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6())
|
||||
agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd}
|
||||
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6())
|
||||
jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd}
|
||||
ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n")
|
||||
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||
|
||||
// Run a pod which probes DNS and exposes the results by HTTP.
|
||||
ginkgo.By("creating a pod to probe DNS")
|
||||
pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName)
|
||||
validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...))
|
||||
})
|
||||
})
|
||||
|
||||
var _ = common.SIGDescribe("DNS HostNetwork", func() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue