-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds secret env name * Use env_var * Bump flyteidl * Smaller change * Add integration test * Add integration test * Use env_var * Check for file and env_var * Add check for kubectl --------- Signed-off-by: Thomas J. Fan <[email protected]>
- Loading branch information
1 parent
146c670
commit a1c9ad0
Showing
4 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/flytekit/integration/remote/workflows/basic/get_secret.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from flytekit import task, Secret, workflow | ||
from os import getenv | ||
|
||
secret_env_var = Secret( | ||
group="my-group", | ||
key="token", | ||
env_var="MY_SECRET", | ||
mount_requirement=Secret.MountType.ENV_VAR, | ||
) | ||
secret_env_file = Secret( | ||
group="my-group", | ||
key="token", | ||
env_var="MY_SECRET_FILE", | ||
mount_requirement=Secret.MountType.FILE, | ||
) | ||
|
||
|
||
@task(secret_requests=[secret_env_var]) | ||
def get_secret_env_var() -> str: | ||
return getenv("MY_SECRET", "") | ||
|
||
|
||
@task(secret_requests=[secret_env_file]) | ||
def get_secret_file() -> str: | ||
with open(getenv("MY_SECRET_FILE")) as f: | ||
return f.read() |