From 9773d4e40983849d9d49e62dfa637fd795f05e7c Mon Sep 17 00:00:00 2001 From: AlmogBaku Date: Sun, 15 May 2016 12:00:20 +0300 Subject: [PATCH] K8s: add an option to configure "PathPrefixStrip" for the ingress-resource using annotation --- provider/kubernetes.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/provider/kubernetes.go b/provider/kubernetes.go index 01fac2317..a355addbd 100644 --- a/provider/kubernetes.go +++ b/provider/kubernetes.go @@ -165,8 +165,14 @@ func (provider *Kubernetes) loadIngresses(k8sClient k8s.Client) (*types.Configur } } if len(pa.Path) > 0 { - templateObjects.Frontends[r.Host+pa.Path].Routes[pa.Path] = types.Route{ - Rule: "PathPrefix:" + pa.Path, + if _, ok := i.Annotations["PathPrefixStrip"]; ok { + templateObjects.Frontends[r.Host+pa.Path].Routes[pa.Path] = types.Route{ + Rule: "PathPrefixStrip:" + pa.Path, + } + } else { + templateObjects.Frontends[r.Host+pa.Path].Routes[pa.Path] = types.Route{ + Rule: "PathPrefix:" + pa.Path, + } } } services, err := k8sClient.GetServices(func(service k8s.Service) bool {