<#3201 [Bug] SecretsManager get function supports ...
# flyte-github
c
#3201 [Bug] SecretsManager get function supports env_var pararmeters. Pull request opened by 0yukali0 ## Tracking issue flyteorg/flyte# ## Why are the changes needed? In flytekit secretsManager, it will check whether the secret exist in an env var "_" or in a file "/etc/secrets//"._ In flytekit secret, create a env "MYSECRET" when setting "envvar=MYSECRET" parameters. _SecretManager won't find it with naming rule with "_". ## What changes were proposed in this pull request? Adding env_var pararmeters in secreateManager get function. Initially, secretManager search the secret with following orders. 1. "_" env 2. "/etc/secrets//" file In this PR, its order will be 3. "_" env 2 . env_var 4. "/etc/secrets//" file ## How was this patch tested? make test
os.environ["LOCAL_ENV_VAR"] = "value" assert sec.get(group="group", key="key2", env_var="LOCAL_ENV_VAR") == "value" assert sec.get(key="key", env_var="LOCAL_ENV_VAR") == "value" assert sec.get(env_var="LOCAL_ENV_VAR") == "value"
### Setup process ### Screenshots ## Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. ## Related PRs ## Docs link ### Summary by Bito This PR fixes a bug in SecretsManager by adjusting secret lookup order and adding an optional 'env_var' parameter. It includes renaming and reordering variables in the context_manager module with updated type annotations. The changes enhance reliability and clarity of secret management in flytekit. Unit tests added: True Estimated effort to review (1-5, lower is better): 1 flyteorg/flytekit