Update Service Fabric backend.
This commit is contained in:
parent
1b410980ca
commit
0fa0c2256a
10 changed files with 677 additions and 352 deletions
63
vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_labelfuncs.go
generated
vendored
Normal file
63
vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_labelfuncs.go
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
package servicefabric
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/containous/traefik/provider/label"
|
||||
)
|
||||
|
||||
// SF Specific Traefik Labels
|
||||
const (
|
||||
traefikSFGroupName = "traefik.servicefabric.groupname"
|
||||
traefikSFGroupWeight = "traefik.servicefabric.groupweight"
|
||||
traefikSFEnableLabelOverrides = "traefik.servicefabric.enablelabeloverrides"
|
||||
traefikSFEnableLabelOverridesDefault = true
|
||||
)
|
||||
|
||||
func getFuncBoolLabel(labelName string, defaultValue bool) func(service ServiceItemExtended) bool {
|
||||
return func(service ServiceItemExtended) bool {
|
||||
return label.GetBoolValue(service.Labels, labelName, defaultValue)
|
||||
}
|
||||
}
|
||||
|
||||
func getServiceStringLabel(service ServiceItemExtended, labelName string, defaultValue string) string {
|
||||
return label.GetStringValue(service.Labels, labelName, defaultValue)
|
||||
}
|
||||
|
||||
func getFuncServiceStringLabel(labelName string, defaultValue string) func(service ServiceItemExtended) string {
|
||||
return func(service ServiceItemExtended) string {
|
||||
return label.GetStringValue(service.Labels, labelName, defaultValue)
|
||||
}
|
||||
}
|
||||
|
||||
func getFuncServiceSliceStringLabel(labelName string) func(service ServiceItemExtended) []string {
|
||||
return func(service ServiceItemExtended) []string {
|
||||
return label.GetSliceStringValue(service.Labels, labelName)
|
||||
}
|
||||
}
|
||||
|
||||
func hasService(service ServiceItemExtended, labelName string) bool {
|
||||
return label.Has(service.Labels, labelName)
|
||||
}
|
||||
|
||||
func getFuncServiceLabelWithPrefix(labelName string) func(service ServiceItemExtended) map[string]string {
|
||||
return func(service ServiceItemExtended) map[string]string {
|
||||
return getServiceLabelsWithPrefix(service, labelName)
|
||||
}
|
||||
}
|
||||
|
||||
func getFuncServicesGroupedByLabel(labelName string) func(services []ServiceItemExtended) map[string][]ServiceItemExtended {
|
||||
return func(services []ServiceItemExtended) map[string][]ServiceItemExtended {
|
||||
return getServices(services, labelName)
|
||||
}
|
||||
}
|
||||
|
||||
func getServiceLabelsWithPrefix(service ServiceItemExtended, prefix string) map[string]string {
|
||||
results := make(map[string]string)
|
||||
for k, v := range service.Labels {
|
||||
if strings.HasPrefix(k, prefix) {
|
||||
results[k] = v
|
||||
}
|
||||
}
|
||||
return results
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue