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),
|
||||
"getProtocol": getFuncStringLabel(label.TraefikProtocol, label.DefaultProtocol),
|
||||
"getPassHostHeader": getFuncStringLabel(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||
"getPassTLSCert": getFuncBoolLabel(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
|
||||
"getPriority": getFuncStringLabel(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
|
||||
"getEntryPoints": getFuncSliceStringLabel(label.TraefikFrontendEntryPoints),
|
||||
"getBasicAuth": getFuncSliceStringLabel(label.TraefikFrontendAuthBasic),
|
||||
|
@ -97,6 +98,7 @@ func (p *Provider) buildConfiguration(containersInspected []dockerData) *types.C
|
|||
"getServiceBasicAuth": getFuncServiceSliceStringLabel(label.SuffixFrontendAuthBasic),
|
||||
"getServiceFrontendRule": p.getServiceFrontendRule,
|
||||
"getServicePassHostHeader": getFuncServiceStringLabel(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||
"getServicePassTLSCert": getFuncServiceBoolLabel(label.SuffixFrontendPassTLSCert, label.DefaultPassTLSCert),
|
||||
"getServicePriority": getFuncServiceStringLabel(label.SuffixFrontendPriority, label.DefaultFrontendPriority),
|
||||
"hasServiceRedirect": hasServiceRedirect,
|
||||
"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 {
|
||||
return func(container dockerData, serviceName string) bool {
|
||||
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)
|
||||
}
|
||||
|
||||
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 {
|
||||
return label.ExtractServiceProperties(container.Labels)[serviceName]
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ const (
|
|||
DefaultWeight = "0"
|
||||
DefaultProtocol = "http"
|
||||
DefaultPassHostHeader = "true"
|
||||
DefaultPassTLSCert = false
|
||||
DefaultFrontendPriority = "0"
|
||||
DefaultCircuitBreakerExpression = "NetworkErrorRatio() > 1"
|
||||
DefaultFrontendRedirectEntryPoint = ""
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
backend = "backend-{{getServiceBackend $container $serviceName}}"
|
||||
priority = {{getServicePriority $container $serviceName}}
|
||||
passHostHeader = {{getServicePassHostHeader $container $serviceName}}
|
||||
passTLSCert = {{getServicePassTLSCert $container $serviceName}}
|
||||
|
||||
entryPoints = [{{range getServiceEntryPoints $container $serviceName}}
|
||||
"{{.}}",
|
||||
|
@ -100,6 +101,7 @@
|
|||
backend = "backend-{{getBackend $container}}"
|
||||
priority = {{getPriority $container}}
|
||||
passHostHeader = {{getPassHostHeader $container}}
|
||||
passTLSCert = {{getPassTLSCert $container}}
|
||||
|
||||
entryPoints = [{{range getEntryPoints $container}}
|
||||
"{{.}}",
|
||||
|
|
Loading…
Reference in a new issue