1
0
Fork 0

Add segment support for ECS

This commit is contained in:
Michael 2018-08-27 16:32:05 +02:00 committed by Traefiker Bot
parent ef753838e7
commit a302731cd1
9 changed files with 1559 additions and 438 deletions

View file

@ -45,7 +45,7 @@ func (p *Provider) buildConfigurationV1(instances []ecsInstance) (*types.Configu
// Frontend functions
"filterFrontends": filterFrontendsV1,
"getFrontendRule": p.getFrontendRule,
"getFrontendRule": p.getFrontendRuleV1,
"getPassHostHeader": getFuncBoolValueV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": getFuncBoolValueV1(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
"getPriority": getFuncIntValueV1(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
@ -70,7 +70,7 @@ func filterFrontendsV1(instances []ecsInstance) []ecsInstance {
byName := make(map[string]struct{})
return fun.Filter(func(i ecsInstance) bool {
backendName := getBackendName(i)
backendName := getBackendNameV1(i)
_, found := byName[backendName]
if !found {
byName[backendName] = struct{}{}
@ -79,6 +79,14 @@ func filterFrontendsV1(instances []ecsInstance) []ecsInstance {
}, instances).([]ecsInstance)
}
// Deprecated
func (p *Provider) getFrontendRuleV1(i ecsInstance) string {
domain := label.GetStringValue(i.TraefikLabels, label.TraefikDomain, p.Domain)
defaultRule := "Host:" + strings.ToLower(strings.Replace(i.Name, "_", "-", -1)) + "." + domain
return label.GetStringValue(i.TraefikLabels, label.TraefikFrontendRule, defaultRule)
}
// Deprecated
func (p *Provider) filterInstanceV1(i ecsInstance) bool {
if i.machine == nil {