elegant-plastic-42374
04/19/2024, 8:12 PMCurrently, @secrets supports only AWS Secrets Manager. Contact us on Metaflow support Slack if you are interested in using another secrets manager.
Are there any plans to support the @secrets decorator for GCP users? It seems ideal for flows that you wish to run remotely and locally.
Currently as a workaround, I’m using the @kubernetes decorator to access secrets I sync to the cluster from GSM. I couldn’t seem to override that with enviornment=local so I ended up putting a fork in my DAG (based on a separate parameter) to support both the remote (using the @kubernetes decorator) and local versions of this step. Given that this flow is running at scale with Argo Workflows (which has been awesome), this fork is not ideal because it results in a few extra steps consuming resources. It also requires individuals to be authenticated with Kubernetes in order to run this flow locally. I experimented with conditional decorator application using functools but this seemed to cause compilation issues.
Thanks!ancient-application-36103
04/19/2024, 10:49 PMI couldn't seem to override that with enviornment=local so I ended up putting a fork in my DAG (based on a separate parameter) to support both the remote (using the @kubernetes decorator) and local versions of this step.
We have plans to introduce support for @secrets for both Azure and GCP - likely this quarter.elegant-plastic-42374
04/22/2024, 5:49 PMevaluate_dataset_remote and evalute_datset_local functions that conditionally runs the evaluation depending on whether self.remote was set to True or Falseelegant-plastic-42374
06/04/2024, 9:32 PM# New approach
@secrets(
sources=[
"projects/1234567/secrets/secretname/versions/latest",
"projects/1234567/secrets/secretname2/versions/latest",
],
)
This replaced the previous solution we had, which was not ideal for our use case, but functional:
# Old approach
@kubernetes(
secrets=[
"secretname",
"secretname2",
]
An error isn’t raised by the @secrets decorator, but this step of my flow is now failing partway through because the expected secret environment variable is missing. When I manually checked the environment variables in the pod running this step, I confirmed none of my secrets seem to get loaded in. Am I using this feature correctly?square-wire-39606
06/05/2024, 2:04 AMelegant-plastic-42374
06/05/2024, 5:42 PMshy-address-41011
06/05/2024, 9:18 PM@secrets(sources=["projects/<id>/secrets/test_secret/versions/latest"])
@step
def hello(self):
for key,value in os.environ.items():
print(f'{key}---->{value}')
self.next(self.end)elegant-plastic-42374
06/05/2024, 11:33 PMsnake_case vs the SCREAMING_SNAKE_CASE I expected to find.elegant-plastic-42374
06/05/2024, 11:33 PMbroad-branch-21430
06/05/2024, 11:37 PM@secrets(sources=[{"id":"projects/<projectId>/secrets/test-secret", "options": {"env_var_name": "MY_SECRET"}}], )
If you use the decorator like this - then metaflow will make available the secret value in the env var MY_SECRETelegant-plastic-42374
06/05/2024, 11:38 PM