mirror of
https://github.com/containous/traefik.git
synced 2025-10-22 19:33:20 +03:00
feat(k8s): add max conn annotations.
This commit is contained in:
committed by
Traefiker
parent
1c495d7ea4
commit
53388a3570
@@ -273,6 +273,10 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
|
||||
templateObjects.Backends[r.Host+pa.Path].LoadBalancer = getLoadBalancer(service)
|
||||
templateObjects.Backends[r.Host+pa.Path].Buffering = getBuffering(service)
|
||||
|
||||
if maxConn := getMaxConn(service); maxConn != nil {
|
||||
templateObjects.Backends[r.Host+pa.Path].MaxConn = maxConn
|
||||
}
|
||||
|
||||
protocol := label.DefaultProtocol
|
||||
for _, port := range service.Spec.Ports {
|
||||
if equalPorts(port, pa.Backend.ServicePort) {
|
||||
@@ -587,3 +591,15 @@ func getRateLimit(i *v1beta1.Ingress) *types.RateLimit {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getMaxConn(service *v1.Service) *types.MaxConn {
|
||||
amount := label.GetInt64Value(service.Annotations, label.TraefikBackendMaxConnAmount, -1)
|
||||
extractorFunc := service.Annotations[label.TraefikBackendMaxConnExtractorFunc]
|
||||
if amount >= 0 && len(extractorFunc) > 0 {
|
||||
return &types.MaxConn{
|
||||
ExtractorFunc: extractorFunc,
|
||||
Amount: amount,
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user