Skip to content

Commit 85f67f5

Browse files
committed
router: Add name and namespace templates params
Add "Name" and "Namespace" to ServiceAliasConfig, and set them in the template router's AddRoute, in order to make these route parameters available for custom configuration templates.
1 parent 7afe72b commit 85f67f5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pkg/router/template/router.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,10 @@ func (r *templateRouter) AddRoute(id string, route *routeapi.Route, host string)
418418
backendKey := r.routeKey(route)
419419

420420
config := ServiceAliasConfig{
421-
Host: host,
422-
Path: route.Spec.Path,
421+
Name: route.Name,
422+
Namespace: route.Namespace,
423+
Host: host,
424+
Path: route.Spec.Path,
423425
}
424426

425427
if route.Spec.Port != nil {

pkg/router/template/types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ type ServiceUnit struct {
1919

2020
// ServiceAliasConfig is a route for a service. Uniquely identified by host + path.
2121
type ServiceAliasConfig struct {
22+
// Name is the user-specified name of the route.
23+
Name string
24+
// Namespace is the namespace of the route.
25+
Namespace string
2226
// Host is a required host name ie. www.example.com
2327
Host string
2428
// Path is an optional path ie. www.example.com/myservice where "myservice" is the path

0 commit comments

Comments
 (0)