Documentation
¶
Overview ¶
Package sessionaffinity provides the session header helpers shared by the session-affinity scorer and filter plugins.
Index ¶
- Constants
- func DecodePodName(ctx context.Context, token string) string
- func NormalizeHeader(name string) string
- func ResolvePodToWrite(request *scheduling.InferenceRequest, profileName string, ...) *datalayer.EndpointMetadata
- func WriteResponseHeader(ctx context.Context, pluginType, sessionHeader string, ...)
Constants ¶
const DefaultHeader = "x-session-token"
DefaultHeader is the default request/response header carrying the session token.
Variables ¶
This section is empty.
Functions ¶
func DecodePodName ¶
DecodePodName decodes a base64-encoded session token into a pod NamespacedName string. It returns "" when the token is empty or cannot be decoded.
func NormalizeHeader ¶
NormalizeHeader lowercases and trims the configured session header name, falling back to DefaultHeader when empty. Request headers are lowercased at ingestion, so the configured name must be lowercased to match.
func ResolvePodToWrite ¶
func ResolvePodToWrite(request *scheduling.InferenceRequest, profileName string, targetPod *datalayer.EndpointMetadata) *datalayer.EndpointMetadata
ResolvePodToWrite looks up the target pod from the scheduling results if profileName is set. When profileName is empty, targetPod (the primary/decode pod) is returned. When profileName is set, the function returns the profile's endpoint or nil if the profile was not scheduled (e.g. decode-only requests skip prefill).
func WriteResponseHeader ¶
func WriteResponseHeader(ctx context.Context, pluginType, sessionHeader string, response *requestcontrol.Response, targetPod *datalayer.EndpointMetadata)
WriteResponseHeader encodes targetPod into sessionHeader on the response sent to the client; pluginType labels the originating plugin in logs. TODO: this should be using a cookie and ensure not overriding any other cookie values if present. Tracked in https://github.com/llm-d/llm-d-router/issues/28
Types ¶
This section is empty.