diff --git a/flytekit/models/security.py b/flytekit/models/security.py index e210c910b7..2c7d62ec5c 100644 --- a/flytekit/models/security.py +++ b/flytekit/models/security.py @@ -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): @@ -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 @@ -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 @@ -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, )