-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcredentials.py
More file actions
34 lines (28 loc) · 1.41 KB
/
Copy pathcredentials.py
File metadata and controls
34 lines (28 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from pydantic import Field, BaseModel
class CredentialMapping(BaseModel):
"""Maps a Kubernetes secret to an environment variable in the agent container.
This allows agents to securely access credentials stored in Kubernetes secrets
by mapping them to environment variables. For example, you can map a secret
containing an API key to an environment variable that your agent code expects.
Example:
A mapping of {"env_var_name": "OPENAI_API_KEY",
"secret_name": "ai-credentials",
"secret_key": "openai-key"}
will make the value from the "openai-key" field in the "ai-credentials"
Kubernetes secret available to the agent as OPENAI_API_KEY environment variable.
Attributes:
env_var_name: The name of the environment variable that will be available to the agent
secret_name: The name of the Kubernetes secret containing the credential
secret_key: The key within the Kubernetes secret that contains the credential value
"""
env_var_name: str = Field(
...,
description="Name of the environment variable that will be available to the agent",
)
secret_name: str = Field(
..., description="Name of the Kubernetes secret containing the credential"
)
secret_key: str = Field(
...,
description="Key within the Kubernetes secret that contains the credential value",
)