From 23ce2caff631bf957b89407dba07e06a87892fe6 Mon Sep 17 00:00:00 2001 From: Jacob Tanenbaum Date: Wed, 15 Feb 2017 11:38:59 -0500 Subject: [PATCH] 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 --- pkg/route/allocation/simple/plugin.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/route/allocation/simple/plugin.go b/pkg/route/allocation/simple/plugin.go index 86ffcc6701f2..2128a9aef8c1 100644 --- a/pkg/route/allocation/simple/plugin.go +++ b/pkg/route/allocation/simple/plugin.go @@ -2,6 +2,7 @@ package simple import ( "fmt" + "strings" "github.com/golang/glog" kvalidation "k8s.io/kubernetes/pkg/util/validation" @@ -50,5 +51,5 @@ func (p *SimpleAllocationPlugin) GenerateHostname(route *routeapi.Route, shard * if len(route.Name) == 0 || len(route.Namespace) == 0 { return "" } - return fmt.Sprintf("%s-%s.%s", route.Name, route.Namespace, shard.DNSSuffix) + return fmt.Sprintf("%s-%s.%s", strings.Replace(route.Name, ".", "-", -1), route.Namespace, shard.DNSSuffix) }