-
Notifications
You must be signed in to change notification settings - Fork 28
fix(ContainerAuthenticator): add sa-token as default CR token filename #183
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
Conversation
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.
LGTM!
} else { | ||
// If the user didn't specify a filename, try our two defaults. | ||
crToken, err = authenticator.readFile(defaultCRTokenFilename1) | ||
if err != nil { |
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 perfectly fine here, but a question came to my mind and can't let it go. We would like to try to read the 2nd file, even if the error is not a FileNotFound
but - let's say - a permission issue, right? Really just asking... :)
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.
Good question... yes, I thought about the various errors that might occur and whether we should treat a permissions issue differently than a "file doesn't exist at all" issue.
I concluded that we should try to keep this simple and treat any error while trying to read the file the same... i.e. we couldn't read it (whatever the reason) so move on to the next one to try. I think it's extremely unlikely that we'd encounter a scenario where both default files (vault-token and sa-token) exist and we end up using "sa-token" by mistake because "vault-token" is not readable by the application.
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.
Looks good and tested on internal cluster 👍
This commit adds support for a second default CR token filename. If the user doesn't specify a CR token filename, the authenticator will first try '/var/run/secrets/tokens/vault-token', and then '/var/run/secrets/tokens/sa-token' in that order. Signed-off-by: Phil Adams <phil_adams@us.ibm.com>
00d9171
to
1362e18
Compare
## [5.13.4](v5.13.3...v5.13.4) (2023-05-22) ### Bug Fixes * **ContainerAuthenticator:** add sa-token as default CR token filename ([#183](#183)) ([25472f3](25472f3))
🎉 This PR is included in version 5.13.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This commit adds support for a second default CR token filename. If the user doesn't specify a CR token filename, the authenticator will first try
/var/run/secrets/tokens/vault-token
, and then/var/run/secrets/tokens/sa-token
in that order.