-
Notifications
You must be signed in to change notification settings - Fork 191
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: look for vault cached token before login #544
fix: look for vault cached token before login #544
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #544 +/- ##
==========================================
+ Coverage 71.32% 71.75% +0.43%
==========================================
Files 26 26
Lines 1953 1983 +30
==========================================
+ Hits 1393 1423 +30
Misses 460 460
Partials 100 100 ☔ View full report in Codecov by Sentry. |
@DaThumpingRabbit can you rebase your branch with main? Will run once up to date |
Ah yes sorry I didn't notice the updates on the main branch, I just rebased it |
Will you have a chance to review that ? I am waiting for this to reduce my vault lease consumption |
@DaThumpingRabbit thanks for the PR. Looking it over, I think the approach I would like to see taken is to move all the token stuff (checking for and setting token) from the individual vault auth files to the vault backend https://github.com/argoproj-labs/argocd-vault-plugin/blob/main/pkg/backends/vault.go#L32. We then call the |
I see, I started to do those changes, however, I think that the token storing part was delegated to the individual auth files because of the specific token use-case (where the vault client detects the variable itself) |
Or if this seems cleaner to you, we could add a method to the AuthType type to indicate whether the storing / retrieving of the token should be considered (maybe a ShouldStoreToken function that returns a boolean and the vault backend conditions its behavior according to that) |
@werne2j I just committed a proposition to remove duplicated code in the vault auth types as you mentioned by following the idea I posted above |
@DaThumpingRabbit Looking back over it, i think going with the first strategy is fine. No need to over think it. If you want to roll back to that commit we can kick off the CI and try to get this into the next release |
Signed-off-by: DaThumpingRabbit <[email protected]>
Signed-off-by: DaThumpingRabbit <[email protected]>
@werne2j Thanks for checking it, I just rolled back to the first solution as you said and I am ready on my side if you want to trigger the CI again and merge it ! |
@werne2j I am not sure I understand what went wrong with the pipeline on the mac tests |
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.
Thanks @DaThumpingRabbit
Description
This commit adds the check of the cached vault token before doing the authentication flow over again
Fixes: #536
Checklist
Please make sure that your PR fulfills the following requirements:
go mod tidy -compat=1.17
to ensure only the minimum is pulled in.Type of Change
Other information