Skip to content

Commit

Permalink
fix: unique session name per route
Browse files Browse the repository at this point in the history
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
  • Loading branch information
sanposhiho committed Aug 7, 2024
1 parent 128817b commit c91cfb6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/gatewayapi/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ func (t *Translator) processHTTPRouteRule(httpRoute *HTTPRouteContext, ruleIdx i
if rule.SessionPersistence.SessionName == nil {

Check warning on line 324 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L323-L324

Added lines #L323 - L324 were not covered by tests
// SessionName is optional on the gateway-api, but envoy requires it
// so we generate the one here.
sessionName = "sticky-host"

// We generate a unique session name per route.
// `/` isn't allowed in the header key, so we just replace it with `-`.
sessionName = strings.ReplaceAll(irRouteDestinationName(httpRoute, ruleIdx), "/", "-")
} else {
sessionName = *rule.SessionPersistence.SessionName

Check warning on line 332 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L330-L332

Added lines #L330 - L332 were not covered by tests
}
Expand Down

0 comments on commit c91cfb6

Please sign in to comment.