-
Notifications
You must be signed in to change notification settings - Fork 305
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
Fix the Get Secret Bug from OS Environment Variable #2077
Fix the Get Secret Bug from OS Environment Variable #2077
Conversation
Signed-off-by: Future Outlier <[email protected]>
os.environ.get
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2077 +/- ##
==========================================
- Coverage 85.71% 81.04% -4.68%
==========================================
Files 313 176 -137
Lines 23396 17001 -6395
Branches 3501 3501
==========================================
- Hits 20055 13779 -6276
+ Misses 2733 2643 -90
+ Partials 608 579 -29 ☔ View full report in Codecov by Sentry. |
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 think this is a low-risk change so let's go ahead, but i don't understand what's happening. why is this happening now? why hasn't this come up before? it could be an issue in the secrets mounting bit? when you get the secret using kubectl
, are we sure it doesn't have the newline?
I have tested the scenario in the single binary mode using I think maybe we have encountered this issue before, that's why we will remove whitespace when using |
This reverts commit 452a2ec.
Signed-off-by: Future Outlier <[email protected]> Co-authored-by: Future Outlier <[email protected]>
Why are the changes needed?
In the current design of flytekit, we have two ways to retrieve secrets:
If you choose the first method, you will encounter an issue: the retrieved secret value needs to have
whitespace characters
removed.This update aims to fix errors that occur when using
flytekit.current_context().secrets.get
along with the first method above, especially inSingle Binary Mode
.What changes were proposed in this pull request?
Call
strip
method to remove whitespace characters incontext manager
get secret function.Note: The type of variable from os environment is python pickle object, maybe that's why we have this error.
I've tried to return
type
of the secret value.Use code like below.
How was this patch tested?
Setup process
Use Default Flytekit Image
Return Value
Use Flytekit Image Built by this branch
Return Value
Dockerfile (Use this branch)
Python File
Screenshots
Use Default Flytekit Image
This image shows the output from the
default Flytekit image
, which includes a trailing blank space at the end of the output string.Use Built Image By This branch
This image displays the output using the
new Flytekit image
from this branch, where the trailing blank space at the end of the output string is removed.Check all the applicable boxes