-
Notifications
You must be signed in to change notification settings - Fork 513
Pass API token as kubernetes secret #3421
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
Pass API token as kubernetes secret #3421
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
@stefannica Are you okay with this approach in general? If yes I'd clean this up a little and write some docs for it |
@@ -174,6 +192,20 @@ def run_step_on_kubernetes(step_name: str) -> None: | |||
|
|||
logger.info("Orchestration pod completed.") | |||
|
|||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only run this cleanup in case the orchestration pod exited succesfully. This is in order to prevent accidently deleting the secret while a step pod is still running, but will lead to some secrets being left over if the pipeline failed. @stefannica what do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading the ThreadedDagRunner
implementation correctly, this code is only reached when all of the pods have completed running (i.e. all of the threads have been "joined"). So you don't need this condition at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which condition? I'm not explicitly checking for success anywhere, but implicitly by putting the code where it is right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see... then why don't you just use a try/finally around ThreadedDagRunner.run()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is precisely my question: This would handle also the case where a step is failing. There is however one other option that I've also seen sometimes: The dag runner fails with some random error, even though the step is actually still running. In that case, we would remove the secret already. Now that I'm typing it however, I realize that at this point the token would already be set as environment variable, which means we can delete it without disturbing the (potentially still active) step. I'll adjust it.
* POC: Pass API token as kubernetes secret * Better secret name * Cleanup secrets and docs * Dont regenerate unnecessary tokens * Formatting * Docsrtrings * Always run secret cleanup * Formatting
Describe changes
Add option to pass the ZenML server API token as a Kubernetes secret instead of plain environment variable.
Pre-requisites
Please ensure you have done the following:
develop
and the open PR is targetingdevelop
. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes