Skip to content

Commit

Permalink
[Fix] Operator: Sticky cookie corrected
Browse files Browse the repository at this point in the history
In some cases using the same JSESSIONID cookie as the one that approuter uses does not seem to work!
Try to fix this by setting a different cookie.

Change-Id: I66b68a10ad66a9d3c3dbfd578096baf6d137b0e6
  • Loading branch information
Pavan-SAP committed Jan 10, 2024
1 parent 3fd5550 commit 7b5a65b
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion internal/controller/reconcile-domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ func (c *Controller) getUpdatedTenantDestinationRuleObject(ctx context.Context,
ConsistentHash: &networkingv1beta1.LoadBalancerSettings_ConsistentHashLB{
HashKey: &networkingv1beta1.LoadBalancerSettings_ConsistentHashLB_HttpCookie{
HttpCookie: &networkingv1beta1.LoadBalancerSettings_ConsistentHashLB_HTTPCookie{
Name: HttpCookieName,
Name: RouterHttpCookieName,
Ttl: durationpb.New(0 * time.Second),
Path: "/",
},
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const (
ConsumerTenantType = "consumer"
)

// Use same name as default cookie from approuter used for session stickiness
const HttpCookieName = "JSESSIONID"
// Use a different name for sticky cookie than the one from approuter (JSESSIONID) used for session handling
const RouterHttpCookieName = "CAPOP_ROUTER_STICKY"

const (
EnvCAPOpAppVersion = "CAPOP_APP_VERSION"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ spec:
loadBalancer:
consistentHash:
httpCookie:
name: JSESSIONID
name: CAPOP_ROUTER_STICKY
path: /
ttl: 0s
4 changes: 2 additions & 2 deletions internal/controller/testdata/captenant/cat-13.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
annotations:
sme.sap.com/resource-hash: ca930fa3ab9c0c67bf3d2d948cdacefd93505d6089f56ebcd7cc7cf06e66ad7d
sme.sap.com/resource-hash: 97ecccd1443b2219a85159a5fdb2f8444543746a5ae890114462e6666e556696
sme.sap.com/owner-identifier: default.test-cap-01-provider
generation: 1
labels:
Expand All @@ -100,6 +100,6 @@ spec:
loadBalancer:
consistentHash:
httpCookie:
name: JSESSIONID
name: CAPOP_ROUTER_STICKY
path: /
ttl: 0s
4 changes: 2 additions & 2 deletions internal/controller/testdata/captenant/cat-15.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
annotations:
sme.sap.com/resource-hash: ca930fa3ab9c0c67bf3d2d948cdacefd93505d6089f56ebcd7cc7cf06e66ad7d
sme.sap.com/resource-hash: 97ecccd1443b2219a85159a5fdb2f8444543746a5ae890114462e6666e556696
sme.sap.com/owner-identifier: default.test-cap-01-provider
labels:
sme.sap.com/owner-generation: "3"
Expand All @@ -97,6 +97,6 @@ spec:
loadBalancer:
consistentHash:
httpCookie:
name: JSESSIONID
name: CAPOP_ROUTER_STICKY
path: /
ttl: 0s
4 changes: 2 additions & 2 deletions internal/controller/testdata/captenant/cat-17.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
annotations:
sme.sap.com/resource-hash: ca930fa3ab9c0c67bf3d2d948cdacefd93505d6089f56ebcd7cc7cf06e66ad7d
sme.sap.com/resource-hash: 97ecccd1443b2219a85159a5fdb2f8444543746a5ae890114462e6666e556696
sme.sap.com/owner-identifier: default.test-cap-01-provider
labels:
sme.sap.com/owner-generation: "3"
Expand All @@ -97,7 +97,7 @@ spec:
loadBalancer:
consistentHash:
httpCookie:
name: JSESSIONID
name: CAPOP_ROUTER_STICKY
path: /
ttl: 0s
---
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/testdata/captenant/cat-17.initial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
annotations:
sme.sap.com/resource-hash: ca930fa3ab9c0c67bf3d2d948cdacefd93505d6089f56ebcd7cc7cf06e66ad7d
sme.sap.com/resource-hash: 97ecccd1443b2219a85159a5fdb2f8444543746a5ae890114462e6666e556696
sme.sap.com/owner-identifier: default.test-cap-01-provider
labels:
sme.sap.com/owner-generation: "3"
Expand All @@ -96,6 +96,6 @@ spec:
loadBalancer:
consistentHash:
httpCookie:
name: JSESSIONID
name: CAPOP_ROUTER_STICKY
path: /
ttl: 0s
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ spec:
loadBalancer:
consistentHash:
httpCookie:
name: JSESSIONID
name: CAPOP_ROUTER_STICKY
path: /
ttl: 0s

0 comments on commit 7b5a65b

Please sign in to comment.