feat(docker): add passTLSCert label.
This commit is contained in:
parent
6e5f7650a5
commit
423385bca0
4 changed files with 21 additions and 0 deletions
|
@ -20,6 +20,7 @@ func (p *Provider) buildConfiguration(containersInspected []dockerData) *types.C
|
||||||
"getDomain": getFuncStringLabel(label.TraefikDomain, p.Domain),
|
"getDomain": getFuncStringLabel(label.TraefikDomain, p.Domain),
|
||||||
"getProtocol": getFuncStringLabel(label.TraefikProtocol, label.DefaultProtocol),
|
"getProtocol": getFuncStringLabel(label.TraefikProtocol, label.DefaultProtocol),
|
||||||
"getPassHostHeader": getFuncStringLabel(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
|
"getPassHostHeader": getFuncStringLabel(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||||
|
"getPassTLSCert": getFuncBoolLabel(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
|
||||||
"getPriority": getFuncStringLabel(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
|
"getPriority": getFuncStringLabel(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
|
||||||
"getEntryPoints": getFuncSliceStringLabel(label.TraefikFrontendEntryPoints),
|
"getEntryPoints": getFuncSliceStringLabel(label.TraefikFrontendEntryPoints),
|
||||||
"getBasicAuth": getFuncSliceStringLabel(label.TraefikFrontendAuthBasic),
|
"getBasicAuth": getFuncSliceStringLabel(label.TraefikFrontendAuthBasic),
|
||||||
|
@ -97,6 +98,7 @@ func (p *Provider) buildConfiguration(containersInspected []dockerData) *types.C
|
||||||
"getServiceBasicAuth": getFuncServiceSliceStringLabel(label.SuffixFrontendAuthBasic),
|
"getServiceBasicAuth": getFuncServiceSliceStringLabel(label.SuffixFrontendAuthBasic),
|
||||||
"getServiceFrontendRule": p.getServiceFrontendRule,
|
"getServiceFrontendRule": p.getServiceFrontendRule,
|
||||||
"getServicePassHostHeader": getFuncServiceStringLabel(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeader),
|
"getServicePassHostHeader": getFuncServiceStringLabel(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||||
|
"getServicePassTLSCert": getFuncServiceBoolLabel(label.SuffixFrontendPassTLSCert, label.DefaultPassTLSCert),
|
||||||
"getServicePriority": getFuncServiceStringLabel(label.SuffixFrontendPriority, label.DefaultFrontendPriority),
|
"getServicePriority": getFuncServiceStringLabel(label.SuffixFrontendPriority, label.DefaultFrontendPriority),
|
||||||
"hasServiceRedirect": hasServiceRedirect,
|
"hasServiceRedirect": hasServiceRedirect,
|
||||||
"getServiceRedirectEntryPoint": getFuncServiceStringLabel(label.SuffixFrontendRedirectEntryPoint, label.DefaultFrontendRedirectEntryPoint),
|
"getServiceRedirectEntryPoint": getFuncServiceStringLabel(label.SuffixFrontendRedirectEntryPoint, label.DefaultFrontendRedirectEntryPoint),
|
||||||
|
|
|
@ -116,6 +116,12 @@ func getFuncServiceStringLabel(labelSuffix string, defaultValue string) func(con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getFuncServiceBoolLabel(labelSuffix string, defaultValue bool) func(container dockerData, serviceName string) bool {
|
||||||
|
return func(container dockerData, serviceName string) bool {
|
||||||
|
return getServiceBoolLabel(container, serviceName, labelSuffix, defaultValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func hasFuncServiceLabel(labelSuffix string) func(container dockerData, serviceName string) bool {
|
func hasFuncServiceLabel(labelSuffix string) func(container dockerData, serviceName string) bool {
|
||||||
return func(container dockerData, serviceName string) bool {
|
return func(container dockerData, serviceName string) bool {
|
||||||
return hasServiceLabel(container, serviceName, labelSuffix)
|
return hasServiceLabel(container, serviceName, labelSuffix)
|
||||||
|
@ -152,6 +158,16 @@ func getServiceStringLabel(container dockerData, serviceName string, labelSuffix
|
||||||
return label.GetStringValue(container.Labels, label.Prefix+labelSuffix, defaultValue)
|
return label.GetStringValue(container.Labels, label.Prefix+labelSuffix, defaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getServiceBoolLabel(container dockerData, serviceName string, labelSuffix string, defaultValue bool) bool {
|
||||||
|
if rawValue, ok := getServiceLabels(container, serviceName)[labelSuffix]; ok {
|
||||||
|
value, err := strconv.ParseBool(rawValue)
|
||||||
|
if err == nil {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return label.GetBoolValue(container.Labels, label.Prefix+labelSuffix, defaultValue)
|
||||||
|
}
|
||||||
|
|
||||||
func getServiceLabels(container dockerData, serviceName string) label.ServicePropertyValues {
|
func getServiceLabels(container dockerData, serviceName string) label.ServicePropertyValues {
|
||||||
return label.ExtractServiceProperties(container.Labels)[serviceName]
|
return label.ExtractServiceProperties(container.Labels)[serviceName]
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ const (
|
||||||
DefaultWeight = "0"
|
DefaultWeight = "0"
|
||||||
DefaultProtocol = "http"
|
DefaultProtocol = "http"
|
||||||
DefaultPassHostHeader = "true"
|
DefaultPassHostHeader = "true"
|
||||||
|
DefaultPassTLSCert = false
|
||||||
DefaultFrontendPriority = "0"
|
DefaultFrontendPriority = "0"
|
||||||
DefaultCircuitBreakerExpression = "NetworkErrorRatio() > 1"
|
DefaultCircuitBreakerExpression = "NetworkErrorRatio() > 1"
|
||||||
DefaultFrontendRedirectEntryPoint = ""
|
DefaultFrontendRedirectEntryPoint = ""
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
backend = "backend-{{getServiceBackend $container $serviceName}}"
|
backend = "backend-{{getServiceBackend $container $serviceName}}"
|
||||||
priority = {{getServicePriority $container $serviceName}}
|
priority = {{getServicePriority $container $serviceName}}
|
||||||
passHostHeader = {{getServicePassHostHeader $container $serviceName}}
|
passHostHeader = {{getServicePassHostHeader $container $serviceName}}
|
||||||
|
passTLSCert = {{getServicePassTLSCert $container $serviceName}}
|
||||||
|
|
||||||
entryPoints = [{{range getServiceEntryPoints $container $serviceName}}
|
entryPoints = [{{range getServiceEntryPoints $container $serviceName}}
|
||||||
"{{.}}",
|
"{{.}}",
|
||||||
|
@ -100,6 +101,7 @@
|
||||||
backend = "backend-{{getBackend $container}}"
|
backend = "backend-{{getBackend $container}}"
|
||||||
priority = {{getPriority $container}}
|
priority = {{getPriority $container}}
|
||||||
passHostHeader = {{getPassHostHeader $container}}
|
passHostHeader = {{getPassHostHeader $container}}
|
||||||
|
passTLSCert = {{getPassTLSCert $container}}
|
||||||
|
|
||||||
entryPoints = [{{range getEntryPoints $container}}
|
entryPoints = [{{range getEntryPoints $container}}
|
||||||
"{{.}}",
|
"{{.}}",
|
||||||
|
|
Loading…
Reference in a new issue