Skip to content

Commit

Permalink
Update kubernetes.use_secret_as_volume to accept secret name as a par…
Browse files Browse the repository at this point in the history
…ameter

Signed-off-by: ddalvi <ddalvi@redhat.com>
  • Loading branch information
DharmitD committed Jul 25, 2024
1 parent 10aaf43 commit fbf772e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions kubernetes_platform/python/kfp/kubernetes/secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from kfp.dsl import PipelineTask
from kfp.kubernetes import common
from kfp.kubernetes import kubernetes_executor_config_pb2 as pb

from typing import Union
from kfp.dsl.pipeline_channel import PipelineParameterChannel

def use_secret_as_env(
task: PipelineTask,
Expand Down Expand Up @@ -59,7 +60,7 @@ def use_secret_as_env(

def use_secret_as_volume(
task: PipelineTask,
secret_name: str,
secret_name: Union[str, PipelineParameterChannel],
mount_path: str,
optional: bool = False,
) -> PipelineTask:
Expand All @@ -75,7 +76,9 @@ def use_secret_as_volume(
Returns:
Task object with updated secret configuration.
"""

# Extract the actual string value if secret_name is a PipelineParameterChannel
if isinstance(secret_name, PipelineParameterChannel):
secret_name = secret_name.name
msg = common.get_existing_kubernetes_config_as_message(task)

secret_as_vol = pb.SecretAsVolume(
Expand Down

0 comments on commit fbf772e

Please sign in to comment.