Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Add flag to have openstack client re-auth when token expires #224

Merged
merged 1 commit into from
Aug 23, 2018

Conversation

stevesloka
Copy link
Member

Fixes #207 by allowing the openstack client to automatically refresh the auth token. Also, if the auth fails more the 3 times, then the app will quit and be restarted.

Signed-off-by: Steve Sloka steves@heptio.com

@@ -56,7 +56,7 @@ func (lrt *LogRoundTripper) RoundTrip(request *http.Request) (*http.Response, er

if response.StatusCode == http.StatusUnauthorized {
if lrt.numReauthAttempts == 3 {
return response, fmt.Errorf("tried to re-authenticate 3 times with no success")
log.Fatal("tried to re-authenticate 3 times with no success")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we should be calling os.Exit deep within a library. I'd rather see us handling this in main.go or somewhere higher in the call stack. However, getting this bubbled up to main might be complicated with our current design, as the reconciler doesn't return an error.

With all this said, wouldn't this be caught by the healthz + liveness probe?

Signed-off-by: Steve Sloka <steves@heptio.com>
@stevesloka
Copy link
Member Author

@alexbrand I reverted that log.Fatal. The probe should be able to pick up the issue if the refresh token fails.

Copy link
Contributor

@alexbrand alexbrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, sounds good!

I think we could improve this in another PR, and bubble the error up to main.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants