Initial support for sticky config in annotations

This commit is contained in:
Ricardo Pchevuzinske Katz 2017-02-10 01:00:17 -02:00
parent d0c4e0d713
commit 1dbe65ecb6
6 changed files with 239 additions and 0 deletions

View file

@ -700,6 +700,7 @@ func (ic *GenericController) createUpstreams(data []interface{}) map[string]*ing
secUpstream := ic.annotations.SecureUpstream(ing)
hz := ic.annotations.HealthCheck(ing)
sticky := ic.annotations.StickySession(ing)
var defBackend string
if ing.Spec.Backend != nil {
@ -739,6 +740,12 @@ func (ic *GenericController) createUpstreams(data []interface{}) map[string]*ing
if !upstreams[name].Secure {
upstreams[name].Secure = secUpstream
}
if !upstreams[name].StickySession.Enabled || upstreams[name].StickySession.Name == "" || upstreams[name].StickySession.Hash == "" {
upstreams[name].StickySession.Enabled = sticky.Enabled
upstreams[name].StickySession.Name = sticky.Name
upstreams[name].StickySession.Hash = sticky.Hash
}
svcKey := fmt.Sprintf("%v/%v", ing.GetNamespace(), path.Backend.ServiceName)
endp, err := ic.serviceEndpoints(svcKey, path.Backend.ServicePort.String(), hz)
if err != nil {