Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide for reading secret in the agent #1037

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions examples/extend_flyte/extend_flyte/agent_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,28 @@
# kubectl rollout restart deployment flytepropeller -n flyte
# ```
#
# ### How to read a secret in the agent
#
# To read a secret in the agent, you can either mount secrets as files or environment variables.
#
# #### Local Development
# - Write the secret to a file (/etc/secrets/agent/secret1).
# - Add the secret to the environment variable (_FSEC_AGENT_SECRET1).
#
# ```python
# def create(
# self,
# context: grpc.ServicerContext,
# output_prefix: str,
# task_template: TaskTemplate,
# inputs: Optional[LiteralMap] = None,
# ) -> CreateTaskResponse:
# context = flytekit.current_context()
# token = context.secrets.get("agent", "secret1")
# jobId = job.create(token=token, ...)
# ...
# ```
#
# #### Agent in th Cluster
# When agent is running in the cluster, the secret must be manually mounted to the agent pod or added as an environment variable.
#