Skip to content

Commit

Permalink
Adds secret env name
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com>
  • Loading branch information
thomasjpfan committed Jan 10, 2025
1 parent dfa8f04 commit 615499e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions flytekit/models/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class Secret(_common.FlyteIdlEntity):
key is optional and can be an individual secret identifier within the secret For k8s this is required
version is the version of the secret. This is an optional field
mount_requirement provides a hint to the system as to how the secret should be injected
env_name is optional. Custom environment name to set the value of the secret.
If mount_requirement is ENV_VAR, then the value is the secret itself.
If mount_requirement is FILE, then the value is the path to the secret file.
"""

class MountType(Enum):
Expand All @@ -39,6 +42,7 @@ class MountType(Enum):
key: Optional[str] = None
group_version: Optional[str] = None
mount_requirement: MountType = MountType.ANY
env_name: Optional[str] = None

def __post_init__(self):
from flytekit.configuration.plugin import get_plugin
Expand All @@ -56,6 +60,7 @@ def to_flyte_idl(self) -> _sec.Secret:
group_version=self.group_version,
key=self.key,
mount_requirement=self.mount_requirement.value,
env_name=self.env_name,
)

@classmethod
Expand All @@ -65,6 +70,7 @@ def from_flyte_idl(cls, pb2_object: _sec.Secret) -> "Secret":
group_version=pb2_object.group_version if pb2_object.group_version else None,
key=pb2_object.key if pb2_object.key else None,
mount_requirement=Secret.MountType(pb2_object.mount_requirement),
env_name=pb2_object.env_name if pb2_object.env_name else None,
)


Expand Down

0 comments on commit 615499e

Please sign in to comment.