Skip to content

Commit 23ce2ca

Browse files
Change "." to "-" in generated hostnames for routes
if a route is named example.test the default generated hostname is example.test-default.router.default.svc.cluster.local This changes the default generated hostname to example-test-default.router.default.svc.cluster.local Bug 1414956
1 parent 05377d4 commit 23ce2ca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/route/allocation/simple/plugin.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package simple
22

33
import (
44
"fmt"
5+
"strings"
56

67
"github.com/golang/glog"
78
kvalidation "k8s.io/kubernetes/pkg/util/validation"
@@ -50,5 +51,5 @@ func (p *SimpleAllocationPlugin) GenerateHostname(route *routeapi.Route, shard *
5051
if len(route.Name) == 0 || len(route.Namespace) == 0 {
5152
return ""
5253
}
53-
return fmt.Sprintf("%s-%s.%s", route.Name, route.Namespace, shard.DNSSuffix)
54+
return fmt.Sprintf("%s-%s.%s", strings.Replace(route.Name, ".", "-", -1), route.Namespace, shard.DNSSuffix)
5455
}

0 commit comments

Comments
 (0)