diff --git a/provider/docker.go b/provider/docker.go index ee81e45ba..2beea6b88 100644 --- a/provider/docker.go +++ b/provider/docker.go @@ -152,12 +152,6 @@ func containerFilter(container docker.Container) bool { return false } - // labels, err := getLabels(container, []string{"traefik.frontend.rule"}) - // if len(labels) != 0 && err != nil { - // log.Debugf("Filtering bad labeled container %s", container.Name) - // return false - // } - return true } @@ -169,6 +163,15 @@ func (provider *Docker) getFrontendName(container docker.Container) string { // GetFrontendRule returns the frontend rule for the specified container, using // it's label. It returns a default one (Host) if the label is not present. func (provider *Docker) getFrontendRule(container docker.Container) string { + // ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠ + // TODO: backwards compatibility with DEPRECATED rule.Value + if value, ok := container.Config.Labels["traefik.frontend.value"]; ok { + log.Warnf("Label traefik.frontend.value=%s is DEPRECATED, please refer to the rule label: https://github.com/containous/traefik/blob/master/docs/index.md#docker", value) + rule, _ := container.Config.Labels["traefik.frontend.rule"] + return rule + ":" + value + } + // ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠ + if label, err := getLabel(container, "traefik.frontend.rule"); err == nil { return label } diff --git a/provider/marathon.go b/provider/marathon.go index 2f75e0ba1..b255bbe5f 100644 --- a/provider/marathon.go +++ b/provider/marathon.go @@ -311,6 +311,14 @@ func (provider *Marathon) getEntryPoints(application marathon.Application) []str // getFrontendRule returns the frontend rule for the specified application, using // it's label. It returns a default one (Host) if the label is not present. func (provider *Marathon) getFrontendRule(application marathon.Application) string { + // ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠ + // TODO: backwards compatibility with DEPRECATED rule.Value + if value, err := provider.getLabel(application, "traefik.frontend.value"); err == nil { + log.Warnf("Label traefik.frontend.value=%s is DEPRECATED, please refer to the rule label: https://github.com/containous/traefik/blob/master/docs/index.md#marathon", value) + rule, _ := provider.getLabel(application, "traefik.frontend.rule") + return rule + ":" + value + } + // ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠ if label, err := provider.getLabel(application, "traefik.frontend.rule"); err == nil { return label } diff --git a/server.go b/server.go index 73d82b4f5..0642e9d44 100644 --- a/server.go +++ b/server.go @@ -361,11 +361,11 @@ func (server *Server) loadConfig(configurations configs, globalConfiguration Glo } newServerRoute := &serverRoute{route: serverEntryPoints[entryPointName].httpRouter.GetHandler().NewRoute().Name(frontendName)} for routeName, route := range frontend.Routes { - log.Debugf("Creating route %s %s", routeName, route.Rule) - err := getRoute(newServerRoute, route) + err := getRoute(newServerRoute, &route) if err != nil { return nil, err } + log.Debugf("Creating route %s %s", routeName, route.Rule) } entryPoint := globalConfiguration.EntryPoints[entryPointName] if entryPoint.Redirect != nil { @@ -512,7 +512,15 @@ func (server *Server) buildDefaultHTTPRouter() *mux.Router { return router } -func getRoute(serverRoute *serverRoute, route types.Route) error { +func getRoute(serverRoute *serverRoute, route *types.Route) error { + // ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠ + // TODO: backwards compatibility with DEPRECATED rule.Value + if len(route.Value) > 0 { + route.Rule += ":" + route.Value + log.Warnf("Value %s is DEPRECATED, please refer to the new frontend notation: https://github.com/containous/traefik/blob/master/docs/index.md#-frontends", route.Value) + } + // ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠ + rules := Rules{route: serverRoute} newRoute, err := rules.Parse(route.Rule) if err != nil { diff --git a/types/types.go b/types/types.go index 51c093699..2168ac49f 100644 --- a/types/types.go +++ b/types/types.go @@ -31,6 +31,10 @@ type Server struct { // Route holds route configuration. type Route struct { Rule string `json:"rule,omitempty"` + // ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠ + // TODO: backwards compatibility with DEPRECATED rule.Value + Value string `json:"value,omitempty"` + // ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠ } // Frontend holds frontend configuration.