Documentation
¶
Index ¶
Constants ¶
const ( // AppLabelManagedBy identifies the controller or product managing a resource. AppLabelManagedBy = "app.kubernetes.io/managed-by" // ConsoleManagedByValue marks resources created and managed by AIBrix Console. ConsoleManagedByValue = "aibrix-console" // ConsoleDeploymentIDAnnotation links a Kubernetes resource to the canonical // Console deployment object used by the API and frontend route. ConsoleDeploymentIDAnnotation = "console.aibrix.ai/deployment-id" // ConsoleDeploymentNameAnnotation preserves the user-facing Console name. ConsoleDeploymentNameAnnotation = "console.aibrix.ai/deployment-name" )
const ( // PodDrainingAnnotationKey marks a pod that has entered controller-managed drain. // RoleSet and PodSet controllers write the string value "true" before deleting // a live serving pod. Gateway routing and controller deletion helpers read this // annotation; any value other than "true" is treated as not draining. PodDrainingAnnotationKey = "aibrix.ai/draining" // PodDrainStartTimeAnnotationKey stores the RFC3339 UTC time when drain began. // Controllers use it to decide whether the configured drain timeout has expired. PodDrainStartTimeAnnotationKey = "aibrix.ai/drain-start-time" // PodDrainReasonAnnotationKey records why the controller started drain. // It is diagnostic metadata only and is not used for routing decisions. PodDrainReasonAnnotationKey = "aibrix.ai/drain-reason" // PodDrainTargetActionAnnotationKey records the action the controller intends // after drain. The drain helper validates this for delete intent so stale or // foreign drain states do not cause immediate deletion. PodDrainTargetActionAnnotationKey = "aibrix.ai/drain-target-action" // PodDrainReasonScaleIn means the pod was selected because desired replicas shrank. PodDrainReasonScaleIn = "scale-in" // PodDrainReasonRollout means the pod was selected during rollout or replacement. PodDrainReasonRollout = "rollout" // PodDrainTargetActionDelete is the only drain target action supported by the // current RoleSet/PodSet delete path. PodDrainTargetActionDelete = "delete" )
const ( // HeaderSessionID identifies the backend selected for session-affinity routing. HeaderSessionID = "x-session-id" // HeaderSessionKey carries a caller-owned opaque key, used by session-affinity // routing and by the PD router's session-delta prefill charge. HeaderSessionKey = "x-aibrix-session-key" )
const ( // KVEventsEnabledLabel indicates if KV events are enabled for this pod // This label was introduced specifically for KV Event Sync feature // Example: "model.aibrix.ai/kv-events-enabled": "true" KVEventsEnabledLabel = "model.aibrix.ai/kv-events-enabled" // LoraIDLabel specifies the LoRA adapter ID for KV sync // This label is used by KV Event Sync to track LoRA-specific caches // Example: "model.aibrix.ai/lora-id": "123" LoraIDLabel = "model.aibrix.ai/lora-id" )
Label keys for KV Event Sync
const ( // EnvPrefixCacheKVEventSyncEnabled enables KV event synchronization // When true, enables ZMQ-based cache event synchronization EnvPrefixCacheKVEventSyncEnabled = "AIBRIX_PREFIX_CACHE_KV_EVENT_SYNC_ENABLED" // EnvPrefixCacheKVEventPublishAddr specifies ZMQ publish address // Format: "tcp://*:5555" or similar ZMQ address EnvPrefixCacheKVEventPublishAddr = "AIBRIX_PREFIX_CACHE_KV_EVENT_PUBLISH_ADDR" // EnvPrefixCacheKVEventSubscribeAddrs specifies ZMQ subscribe addresses // Comma-separated list of ZMQ addresses to subscribe to EnvPrefixCacheKVEventSubscribeAddrs = "AIBRIX_PREFIX_CACHE_KV_EVENT_SUBSCRIBE_ADDRS" // EnvPrefixCacheUseRemoteTokenizer enables remote tokenizer usage // When true, uses remote tokenizer service instead of local tokenization EnvPrefixCacheUseRemoteTokenizer = "AIBRIX_PREFIX_CACHE_USE_REMOTE_TOKENIZER" // EnvPrefixCacheTokenizerType specifies the tokenizer type for prefix cache // Options: "character", "tiktoken", "remote" EnvPrefixCacheTokenizerType = "AIBRIX_PREFIX_CACHE_TOKENIZER_TYPE" // EnvPrefixCacheRemoteTokenizerEndpoint specifies the remote tokenizer service endpoint // Format: "http://service:port" - required when using remote tokenizer EnvPrefixCacheRemoteTokenizerEndpoint = "AIBRIX_PREFIX_CACHE_REMOTE_TOKENIZER_ENDPOINT" // EnvPrefixCacheIncludeTools controls whether the chat request "tools" field is part // of the text used for prefix matching. Defaults to true. EnvPrefixCacheIncludeTools = "AIBRIX_PREFIX_CACHE_INCLUDE_TOOLS" )
Environment variable names for KV Event Sync
const ( KVCacheLabelKeyIdentifier = "kvcache.orchestration.aibrix.ai/name" KVCacheLabelKeyRole = "kvcache.orchestration.aibrix.ai/role" KVCacheLabelKeyMetadataIndex = "kvcache.orchestration.aibrix.ai/etcd-index" KVCacheLabelKeyBackend = "kvcache.orchestration.aibrix.ai/backend" KVCacheAnnotationNodeAffinityKey = "kvcache.orchestration.aibrix.ai/node-affinity-key" KVCacheAnnotationNodeAffinityGPUType = "kvcache.orchestration.aibrix.ai/node-affinity-gpu-type" KVCacheAnnotationPodAffinityKey = "kvcache.orchestration.aibrix.ai/pod-affinity-workload" KVCacheAnnotationPodAntiAffinity = "kvcache.orchestration.aibrix.ai/pod-anti-affinity" KVCacheAnnotationNodeAffinityDefaultKey = "machine.cluster.vke.volcengine.com/gpu-name" // This config will be deprecated in future, users should specify kvcache backend directly. KVCacheAnnotationMode = "kvcache.orchestration.aibrix.ai/mode" KVCacheLabelValueRoleCache = "cache" KVCacheLabelValueRoleMetadata = "metadata" KVCacheLabelValueRoleKVWatcher = "kvwatcher" KVCacheBackendVineyard = "vineyard" KVCacheBackendHPKV = "hpkv" KVCacheBackendInfinistore = "infinistore" KVCacheBackendDefault = KVCacheBackendVineyard )
const ( // ModelLabelName is the label for identifying the model name // Example: "model.aibrix.ai/name": "deepseek-llm-7b-chat" ModelLabelName = "model.aibrix.ai/name" // ModelLabelEngine is the label for identifying the inference engine // Example: "model.aibrix.ai/engine": "vllm" ModelLabelEngine = "model.aibrix.ai/engine" // ModelLabelMetricPort is the label for specifying the metrics port // Example: "model.aibrix.ai/metric-port": "8000" ModelLabelMetricPort = "model.aibrix.ai/metric-port" // ModelLabelPort is the label for specifying the service port // Example: "model.aibrix.ai/port": "8080" ModelLabelPort = "model.aibrix.ai/port" // ModelLabelAdapterEnabled is the label for enabling or disabling adapter dynamic registration // Example: "adapter.model.aibrix.ai/enabled": "true" ModelLabelAdapterEnabled = "adapter.model.aibrix.ai/enabled" // ModelPoolLabelName identifies the warm GPU pool a pod belongs to. A warm GPU // pool is an ordinary Deployment of pre-warmed GPU-host pods; ModelClaims // are bin-packed onto pods sharing the same pool name. // Example: "claim.model.aibrix.ai/pool": "b300-pool-a" ModelPoolLabelName = "claim.model.aibrix.ai/pool" // ModelPoolLabelEnabled marks a pod as a warm GPU pool member that accepts dynamic // ModelClaim attachments (the GPU/CUDA context and the kvcached KV pool are // reserved and the runtime sidecar is ready). Analogous to ModelLabelAdapterEnabled. // Example: "claim.model.aibrix.ai/enabled": "true" ModelPoolLabelEnabled = "claim.model.aibrix.ai/enabled" // ModelPoolLabelEnabledValue is the enabled value for ModelPoolLabelEnabled. ModelPoolLabelEnabledValue = "true" // ModelPoolPolicyAnnotationKey holds one JSON pool policy on the warm // Deployment metadata. It intentionally avoids a separate policy CRD while // keeping the configuration scoped to the pool that owns the GPU pods. // Example: "claim.model.aibrix.ai/pool-policy": '{"reclaim":{"mode":"kv-first","capacityBytes":17179869184}}' ModelPoolPolicyAnnotationKey = "claim.model.aibrix.ai/pool-policy" // ModelClaimPodAnnotationPrefix marks, on a warm GPU pod, that a ModelClaim // has been activated on it. The key is suffixed with the ModelClaim object // name, which the CRD limits to the 63 characters that the name part of a // key may have. The value is a JSON object // {"model":"<servedModelName>","port":<port>,"state":"<state>"}. // A controller that wakes sleeping engines itself also writes // "wakeByRequest":true there. // One key per ModelClaim avoids multi-writer races on a shared annotation. // The gateway cache reads these to make active models routable and retain // sleeping port-0 bindings for request-triggered wake. // Example: "route.claim.model.aibrix.ai/qwen2-7b": // '{"model":"qwen2-7b-instruct","port":9001,"state":"active"}' ModelClaimPodAnnotationPrefix = "route.claim.model.aibrix.ai/" // ModelClaimWakeAnnotationPrefix marks, on the warm pod that holds a // sleeping engine, that a request has asked for that engine's model. The // key is suffixed with the ModelClaim object name, and the value is the // time of the request, in RFC 3339. The gateway writes it, and the // controller wakes the engine and removes it. Its prefix is not // ModelClaimPodAnnotationPrefix, so it is never read as a binding. // Example: "wake.modelclaim.aibrix.ai/qwen2-7b": "2026-10-01T08:00:00Z" ModelClaimWakeAnnotationPrefix = "wake.modelclaim.aibrix.ai/" // ModelClaim routing states are observed runtime states carried alongside // the per-model port. They let the gateway distinguish a sleeping engine // that can be woken from an engine that is merely starting or has failed. ModelClaimRoutingStateActive = "active" ModelClaimRoutingStateActivating = "activating" ModelClaimRoutingStateSleeping = "sleeping" ModelClaimRoutingStateFailed = "failed" // ModelClaimReasonTooLargeForAnyCard is the reason of a claim's Scheduled // condition when no card in its pool could hold it, even empty. Waiting // does not help, so the gateway does not ask its clients to retry. ModelClaimReasonTooLargeForAnyCard = "TooLargeForAnyCard" // ModelClaim route reasons say more than a routing state about why a model // is not served. The controller writes them on the route and on the claim's // Ready condition, and the gateway tells its clients how long to wait by // them. A request waits for room to wake the engine, or the claim moves to // another pod. ModelClaimRouteReasonWaitingForRoom = "WaitingForRoom" ModelClaimRouteReasonMoving = "Moving" // ModelClaimReasonMakingRoom is the reason of a claim's Scheduled condition // while idle engines are put to sleep to make room for it. The gateway // tells a client how long to wait by it as well. ModelClaimReasonMakingRoom = "MakingRoom" )
const ( // ModelAnnoServiceName identifies the Kubernetes Service backing a model when // its externally served name cannot also be used as a Kubernetes object name. ModelAnnoServiceName = "model.aibrix.ai/service-name" // ModelAnnoRouterCustomPath is the anno for add PathPrefixes in httpRoute, split by comma // Example: "model.aibrix.ai/model-router-custom-paths": "/score,/version" ModelAnnoRouterCustomPath = "model.aibrix.ai/model-router-custom-paths" // ModelAnnoConfig is the annotation holding JSON model config with multiple profiles. // Client selects profile at runtime via config-profile header or defaultProfile is selected. // See docs/source/designs/model-config-profiles.rst for schema. ModelAnnoConfig = "model.aibrix.ai/config" )
const (
AibrixSubsystemName = "aibrix"
)
Variables ¶
This section is empty.
Functions ¶
func IsKVEventsEnabled ¶ added in v0.4.0
IsKVEventsEnabled checks if KV events are enabled for the pod
func ModelNameFromMetadata ¶ added in v0.8.0
ModelNameFromMetadata returns the served model name from Kubernetes metadata. Labels remain the preferred source, while annotations support names containing characters that Kubernetes label values reject, such as '/'.
Types ¶
This section is empty.