main
py 46 lines 1.73 KB
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 """Connection configuration for the object store secondary tier."""
4
5 from dataclasses import dataclass, field
6
7
8 @dataclass
9 class ObjStoreConfig:
10 """Connection parameters for an object store backend.
11
12 When ``access_key`` and ``secret_key`` are left empty the NIXL OBJ
13 plugin falls back to the AWS SDK default credential provider chain
14 (IAM roles, environment variables, credential files, etc.), which
15 enables workload-identity based auth on Kubernetes.
16 """
17
18 bucket: str
19 endpoint_override: str
20 access_key: str = field(default="", repr=False)
21 secret_key: str = field(default="", repr=False)
22 session_token: str = field(default="", repr=False)
23 region: str = ""
24 scheme: str = "http"
25 ca_bundle: str = ""
26
27 def to_nixl_params(self) -> dict[str, str]:
28 """Build the NIXL backend params dict.
29
30 Credential and optional fields are only included when non-empty
31 so that the AWS SDK default credential chain can activate.
32 """
33 params: dict[str, str] = {
34 "bucket": self.bucket,
35 "endpoint_override": self.endpoint_override,
36 "scheme": self.scheme,
37 }
38 # Omit empty optional fields so the NIXL OBJ plugin's underlying
39 # AWS SDK can fall back to its default credential provider chain
40 # (IAM roles, env vars, credential files, etc.).
41 # https://github.com/ai-dynamo/nixl/blob/main/src/plugins/obj/README.md
42 for key in ("access_key", "secret_key", "session_token", "region", "ca_bundle"):
43 value = getattr(self, key)
44 if value:
45 params[key] = value
46 return params