sessionaffinity

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package sessionaffinity provides the session header helpers shared by the session-affinity scorer and filter plugins.

Index

Constants

View Source
const DefaultHeader = "x-session-token"

DefaultHeader is the default request/response header carrying the session token.

Variables

This section is empty.

Functions

func DecodePodName

func DecodePodName(ctx context.Context, token string) string

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

func NormalizeHeader(name string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL