Documentation
¶
Overview ¶
Package sessionaffinity provides a session affinity scorer plugin for the epp.
Index ¶
- Constants
- func Factory(name string, rawParameters *json.Decoder, _ plugin.Handle) (plugin.Plugin, error)
- type SessionAffinity
- func (s *SessionAffinity) Category() scheduling.ScorerCategory
- func (s *SessionAffinity) ResponseHeader(ctx context.Context, request *scheduling.InferenceRequest, ...)
- func (s *SessionAffinity) Score(ctx context.Context, request *scheduling.InferenceRequest, ...) map[scheduling.Endpoint]float64
- func (s *SessionAffinity) TypedName() plugin.TypedName
Constants ¶
const (
// SessionAffinityType is the type of the SessionAffinity scorer.
SessionAffinityType = "session-affinity-scorer"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SessionAffinity ¶
type SessionAffinity struct {
// contains filtered or unexported fields
}
SessionAffinity is a routing scorer that routes subsequent requests in a session to the same pod as the first request in the session was sent to, by giving that pod the specified weight and assigning zero score to the rest of the targets
func NewSessionAffinity ¶
func NewSessionAffinity(name, sessionHeader, profileName string) *SessionAffinity
NewSessionAffinity returns a scorer. When sessionHeader is empty the default x-session-token header is used.
func (*SessionAffinity) Category ¶
func (s *SessionAffinity) Category() scheduling.ScorerCategory
Category returns the preference the scorer applies when scoring candidate endpoints.
func (*SessionAffinity) ResponseHeader ¶
func (s *SessionAffinity) ResponseHeader(ctx context.Context, request *scheduling.InferenceRequest, response *requestcontrol.Response, targetPod *datalayer.EndpointMetadata)
ResponseHeader sets the session header on the response sent to the client.
func (*SessionAffinity) Score ¶
func (s *SessionAffinity) Score(ctx context.Context, request *scheduling.InferenceRequest, endpoints []scheduling.Endpoint) map[scheduling.Endpoint]float64
Score assign a high score to the pod used in previous requests and zero to others
func (*SessionAffinity) TypedName ¶
func (s *SessionAffinity) TypedName() plugin.TypedName
TypedName returns the typed name of the plugin.