feat(marathon): add PassTLSCert label.

This commit is contained in:
Fernandez Ludovic 2017-12-16 14:58:36 +01:00 committed by Traefiker
parent 81e3b2dd4c
commit 38a3fe4316
2 changed files with 10 additions and 0 deletions

View file

@ -27,6 +27,7 @@ func (p *Provider) buildConfiguration() *types.Configuration {
"getSubDomain": p.getSubDomain, // FIXME DEAD ? "getSubDomain": p.getSubDomain, // FIXME DEAD ?
"getProtocol": getFuncStringService(label.TraefikProtocol, label.DefaultProtocol), "getProtocol": getFuncStringService(label.TraefikProtocol, label.DefaultProtocol),
"getPassHostHeader": getFuncStringService(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader), "getPassHostHeader": getFuncStringService(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": getFuncBoolService(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
"getPriority": getFuncStringService(label.TraefikFrontendPriority, label.DefaultFrontendPriority), "getPriority": getFuncStringService(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
"getEntryPoints": getFuncSliceStringService(label.TraefikFrontendEntryPoints), "getEntryPoints": getFuncSliceStringService(label.TraefikFrontendEntryPoints),
"getFrontendRule": p.getFrontendRule, "getFrontendRule": p.getFrontendRule,
@ -397,6 +398,14 @@ func getFuncStringService(labelName string, defaultValue string) func(applicatio
} }
} }
func getFuncBoolService(labelName string, defaultValue bool) func(application marathon.Application, serviceName string) bool {
return func(application marathon.Application, serviceName string) bool {
labels := getLabels(application, serviceName)
lbName := getLabelName(serviceName, labelName)
return label.GetBoolValue(labels, lbName, defaultValue)
}
}
func getFuncSliceStringService(labelName string) func(application marathon.Application, serviceName string) []string { func getFuncSliceStringService(labelName string) func(application marathon.Application, serviceName string) []string {
return func(application marathon.Application, serviceName string) []string { return func(application marathon.Application, serviceName string) []string {
labels := getLabels(application, serviceName) labels := getLabels(application, serviceName)

View file

@ -56,6 +56,7 @@
backend = "{{getBackend $app $serviceName}}" backend = "{{getBackend $app $serviceName}}"
priority = {{getPriority $app $serviceName}} priority = {{getPriority $app $serviceName}}
passHostHeader = {{getPassHostHeader $app $serviceName}} passHostHeader = {{getPassHostHeader $app $serviceName}}
passTLSCert = {{getPassTLSCert $app $serviceName}}
entryPoints = [{{range getEntryPoints $app $serviceName}} entryPoints = [{{range getEntryPoints $app $serviceName}}
"{{.}}", "{{.}}",