Skip to content
Snippets Groups Projects
Commit bc14dda3 authored by Rodrigo Chacon's avatar Rodrigo Chacon Committed by Lars Seipel
Browse files

wip DNS-1123 compatibility

parent 2262a93c
No related tags found
No related merge requests found
Pipeline #5427 failed
...@@ -440,6 +440,10 @@ func (s *executor) setupBuildPod() error { ...@@ -440,6 +440,10 @@ func (s *executor) setupBuildPod() error {
_, _, _, aliases := common.SplitServiceAndVersion(service.Name) _, _, _, aliases := common.SplitServiceAndVersion(service.Name)
for _, a := range aliases { for _, a := range aliases {
// skip Docker-like host aliases, respecting DNS-1123
if strings.Contains(a, "__") {
continue
}
servicesHostAlias.Hostnames = append(servicesHostAlias.Hostnames, a) servicesHostAlias.Hostnames = append(servicesHostAlias.Hostnames, a)
} }
if service.Alias != "" { if service.Alias != "" {
......
...@@ -1266,15 +1266,19 @@ func TestSetupBuildPod(t *testing.T) { ...@@ -1266,15 +1266,19 @@ func TestSetupBuildPod(t *testing.T) {
{ {
Name: "docker:dind", Name: "docker:dind",
}, },
{
Name: "selenium/standalone-chrome",
},
}, },
}, },
VerifyFn: func(t *testing.T, test setupBuildPodTestDef, pod *api.Pod) { VerifyFn: func(t *testing.T, test setupBuildPodTestDef, pod *api.Pod) {
require.Len(t, pod.Spec.Containers, 4) require.Len(t, pod.Spec.Containers, 5)
expectedHostnames := []string{ expectedHostnames := []string{
"test-service", "test-service",
"svc-alias", "svc-alias",
"docker", "docker",
"selenium-standalone-chrome",
} }
assert.Equal(t, "127.0.0.1", pod.Spec.HostAliases[0].IP) assert.Equal(t, "127.0.0.1", pod.Spec.HostAliases[0].IP)
assert.Equal(t, expectedHostnames, pod.Spec.HostAliases[0].Hostnames) assert.Equal(t, expectedHostnames, pod.Spec.HostAliases[0].Hostnames)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment