Skip to content

Commit

Permalink
Allow for wildcards in k8s ingress host, fixes #792 (#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun authored and emilevauge committed Jan 20, 2017
1 parent fa1090b commit d15a17b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion provider/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,15 @@ func (provider *Kubernetes) loadIngresses(k8sClient k8s.Client) (*types.Configur
}
}
if len(r.Host) > 0 {
rule := "Host:" + r.Host

if strings.Contains(r.Host, "*") {
rule = "HostRegexp:" + strings.Replace(r.Host, "*", "{subdomain:[A-Za-z0-9-_]+}", 1)
}

if _, exists := templateObjects.Frontends[r.Host+pa.Path].Routes[r.Host]; !exists {
templateObjects.Frontends[r.Host+pa.Path].Routes[r.Host] = types.Route{
Rule: "Host:" + r.Host,
Rule: rule,
}
}
}
Expand Down

0 comments on commit d15a17b

Please sign in to comment.