Vaikath Job07/11/2022, 8:36 PM
when trying to use an OAuth token with the Secrets API. i.e. The config.toml is located on my local machine with and has a section:
Failed to load and execute flow run: ValueError('Local Secret "<prefect.client.secrets.Secret object at 0x00000221D3B7B100>" was not found.')
The code that registers the flow is similar to this:
[context.secrets] GITLAB="<OAuth Token>"
I assume this is happening because the config.toml is not on the K8s cluster. If this is the case, is there a way I can attach this storage to the flow without storing OAuth tokens on the cluster itself?
secret = Secret("GITLAB") flow.storage = GitLab(host="path/to/host", repo="repo/address", path="flow/sample_flow.py", access_token_secret=secret) flow.register(project_name="test-project-name")
and Prefect will fetch the value during runtime. Yes you need config.toml available to Kubernetes or you can check this for options
flow.storage = GitLab(host="path/to/host", repo="repo/address", path="flow/sample_flow.py", access_token_secret="GITLAB") flow.register(project_name="test-project-name")
Vaikath Job07/11/2022, 9:19 PM