https://flyte.org logo
e

Eric Hsiao

08/19/2022, 2:28 PM
quick question, is there any way to request for specific secrets based on the parameter of the task? For example, if I wanted to print the secret for a specific group, I would have to request secrets for all possible groups
Copy code
@task(secret_requests=[
   Secret(group='hello', key='my_key'),
   Secret(group='hello2', key='my_key')
]):
def print_secret(group: str):
    sm = current_context().secrets
    secret = sm.get(group, 'my_key')
    print(secret)
n

Niels Bantilan

08/19/2022, 2:35 PM
Hi Eric, at the moment parameterized secrets isn’t supported… I do have a few questions: 1. how many groups do you have? 2. does it make sense for you to expose the task to all group secrets? If you know the groups ahead of time, you could do something like:
Copy code
@task(secret_requests=[
   Secret(group=g, key='my_key') for g in groups
]):
def print_secret(group: str):
    sm = current_context().secrets
    secret = sm.get(group, 'my_key')
    print(secret)
e

Eric Hsiao

08/19/2022, 2:41 PM
We have a couple groups (10-20) with a standard set of keys that we know ahead of time. Currently I'm exposing them all with something like that but was curious if there was a more elegant solution.
thanks for the help! 🙂
k

Ketan (kumare3)

08/19/2022, 2:51 PM
Secrets dynamically is not possible as we have to mount things in, this is part of declarative infrastructure
e

Eric Hsiao

08/19/2022, 3:08 PM
That's good to know. I will rethink some of our organization then