mirror of
https://github.com/alibaba/higress.git
synced 2026-05-23 04:07:26 +08:00
feat(ingress): support custom parameter names for MCP SSE stateful sessions (#3008)
This commit is contained in:
@@ -41,6 +41,9 @@ const (
|
||||
|
||||
defaultAffinityCookieName = "INGRESSCOOKIE"
|
||||
defaultAffinityCookiePath = "/"
|
||||
|
||||
mcpSseStatefulKey = "mcp-sse-stateful-param-name"
|
||||
defaultMcpSseStatefulKey = "sessionId"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -66,10 +69,11 @@ type consistentHashByCookie struct {
|
||||
}
|
||||
|
||||
type LoadBalanceConfig struct {
|
||||
simple networking.LoadBalancerSettings_SimpleLB
|
||||
other *consistentHashByOther
|
||||
cookie *consistentHashByCookie
|
||||
McpSseStateful bool
|
||||
simple networking.LoadBalancerSettings_SimpleLB
|
||||
other *consistentHashByOther
|
||||
cookie *consistentHashByCookie
|
||||
McpSseStateful bool
|
||||
McpSseStatefulKey string
|
||||
}
|
||||
|
||||
type loadBalance struct{}
|
||||
@@ -139,6 +143,11 @@ func (l loadBalance) Parse(annotations Annotations, config *Ingress, _ *GlobalCo
|
||||
lb = strings.ToUpper(lb)
|
||||
if lb == "MCP-SSE" {
|
||||
loadBalanceConfig.McpSseStateful = true
|
||||
if key, err := annotations.ParseStringASAP(mcpSseStatefulKey); err == nil {
|
||||
loadBalanceConfig.McpSseStatefulKey = key
|
||||
} else {
|
||||
loadBalanceConfig.McpSseStatefulKey = defaultMcpSseStatefulKey
|
||||
}
|
||||
} else {
|
||||
loadBalanceConfig.simple = networking.LoadBalancerSettings_SimpleLB(networking.LoadBalancerSettings_SimpleLB_value[lb])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user