Skip to content

Commit 3022f7b

Browse files
authored
feat: Adding TLS support for Remote::Milvus vector_io (#2011)
# What does this PR do? For the Issue :- #[2010](#2010) Currently, if we try to connect the Llama stack server to a remote Milvus instance that has TLS enabled, the connection fails because TLS support is not implemented in the Llama stack codebase. As a result, users are unable to use secured Milvus deployments out of the box. After adding this , the user will be able to connect to remote::Milvus which is TLS enabled . if TLS enabled :- ``` vector_io: - provider_id: milvus provider_type: remote::milvus config: uri: "http://<host>:<port>" token: "<user>:<password>" secure: True server_pem_path: "path/to/server.pem" ``` [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan I have already tested it by connecting to a Milvus instance which is TLS enabled and i was able to start llama stack server .
1 parent 65cc971 commit 3022f7b

File tree

2 files changed

+79
-1
lines changed
  • docs/source/providers/vector_io
  • llama_stack/providers/remote/vector_io/milvus

2 files changed

+79
-1
lines changed

docs/source/providers/vector_io/milvus.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,81 @@ You can install Milvus using pymilvus:
2727
```bash
2828
pip install pymilvus
2929
```
30+
31+
## Configuration
32+
33+
In Llama Stack, Milvus can be configured in two ways:
34+
- **Inline (Local) Configuration** - Uses Milvus-Lite for local storage
35+
- **Remote Configuration** - Connects to a remote Milvus server
36+
37+
### Inline (Local) Configuration
38+
39+
The simplest method is local configuration, which requires setting `db_path`, a path for locally storing Milvus-Lite files:
40+
41+
```yaml
42+
vector_io:
43+
- provider_id: milvus
44+
provider_type: inline::milvus
45+
config:
46+
db_path: ~/.llama/distributions/together/milvus_store.db
47+
```
48+
49+
### Remote Configuration
50+
51+
Remote configuration is suitable for larger data storage requirements:
52+
53+
#### Standard Remote Connection
54+
55+
```yaml
56+
vector_io:
57+
- provider_id: milvus
58+
provider_type: remote::milvus
59+
config:
60+
uri: "http://<host>:<port>"
61+
token: "<user>:<password>"
62+
```
63+
64+
#### TLS-Enabled Remote Connection (One-way TLS)
65+
66+
For connections to Milvus instances with one-way TLS enabled:
67+
68+
```yaml
69+
vector_io:
70+
- provider_id: milvus
71+
provider_type: remote::milvus
72+
config:
73+
uri: "https://<host>:<port>"
74+
token: "<user>:<password>"
75+
secure: True
76+
server_pem_path: "/path/to/server.pem"
77+
```
78+
79+
#### Mutual TLS (mTLS) Remote Connection
80+
81+
For connections to Milvus instances with mutual TLS (mTLS) enabled:
82+
83+
```yaml
84+
vector_io:
85+
- provider_id: milvus
86+
provider_type: remote::milvus
87+
config:
88+
uri: "https://<host>:<port>"
89+
token: "<user>:<password>"
90+
secure: True
91+
ca_pem_path: "/path/to/ca.pem"
92+
client_pem_path: "/path/to/client.pem"
93+
client_key_path: "/path/to/client.key"
94+
```
95+
96+
#### Key Parameters for TLS Configuration
97+
98+
- **`secure`**: Enables TLS encryption when set to `true`. Defaults to `false`.
99+
- **`server_pem_path`**: Path to the **server certificate** for verifying the server’s identity (used in one-way TLS).
100+
- **`ca_pem_path`**: Path to the **Certificate Authority (CA) certificate** for validating the server certificate (required in mTLS).
101+
- **`client_pem_path`**: Path to the **client certificate** file (required for mTLS).
102+
- **`client_key_path`**: Path to the **client private key** file (required for mTLS).
103+
30104
## Documentation
31105
See the [Milvus documentation](https://milvus.io/docs/install-overview.md) for more details about Milvus in general.
106+
107+
For more details on TLS configuration, refer to the [TLS setup guide](https://milvus.io/docs/tls.md).

llama_stack/providers/remote/vector_io/milvus/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from typing import Any
88

9-
from pydantic import BaseModel
9+
from pydantic import BaseModel, ConfigDict
1010

1111
from llama_stack.schema_utils import json_schema_type
1212

@@ -17,6 +17,8 @@ class MilvusVectorIOConfig(BaseModel):
1717
token: str | None = None
1818
consistency_level: str = "Strong"
1919

20+
model_config = ConfigDict(extra="allow")
21+
2022
@classmethod
2123
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> dict[str, Any]:
2224
return {"uri": "${env.MILVUS_ENDPOINT}", "token": "${env.MILVUS_TOKEN}"}

0 commit comments

Comments
 (0)