From 8090a3fab490f1876b076d9af7110107861b6748 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Tue, 18 Feb 2020 10:55:47 +0800 Subject: [PATCH 1/2] region: lbagent: deploy: use 'public' endpoint type --- pkg/compute/models/loadbalanceragents_deploy.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/compute/models/loadbalanceragents_deploy.go b/pkg/compute/models/loadbalanceragents_deploy.go index 3083bc117c..b5b0180256 100644 --- a/pkg/compute/models/loadbalanceragents_deploy.go +++ b/pkg/compute/models/loadbalanceragents_deploy.go @@ -436,6 +436,7 @@ auth_uri = '{{ auth_uri }}' admin_user = '{{ user }}' admin_password = '{{ pass }}' admin_tenant_name = '{{ proj }}' +session_endpoint_type = 'public' data_preserve_n = 10 base_data_dir = "/opt/cloud/workspace/lbagent" From 65a99551c21e96e0d2827750933b36dea2e5140d Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Tue, 18 Feb 2020 20:53:10 +0800 Subject: [PATCH 2/2] lbagent: fix config for sticky session cookie - account for user specific cookie name for insert mode - dont tamper cache instructions from backend server for server mode --- pkg/lbagent/models/haproxy.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/lbagent/models/haproxy.go b/pkg/lbagent/models/haproxy.go index 1227eaf8d2..492ddac11c 100644 --- a/pkg/lbagent/models/haproxy.go +++ b/pkg/lbagent/models/haproxy.go @@ -285,14 +285,18 @@ func (b *LoadbalancerCorpus) genHaproxyConfigBackend(data map[string]interface{} stickyCookie := "" switch listener.StickySessionType { case "insert": - stickyCookie = "cookie SERVERID insert indirect nocache" + cookie := listener.StickySessionCookie + if cookie == "" { + cookie = "SERVERID" + } + stickyCookie = fmt.Sprintf("cookie %s insert indirect nocache", cookie) if maxIdle := listener.StickySessionCookieTimeout; maxIdle > 0 { stickyCookie += fmt.Sprintf(" maxidle %ds", maxIdle) } case "server": cookie := listener.StickySessionCookie if cookie != "" { - stickyCookie = fmt.Sprintf("cookie %q rewrite nocache", cookie) + stickyCookie = fmt.Sprintf("cookie %q rewrite", cookie) } } if stickyCookie != "" {