Avoid calling Team API with an expired token.

Previously, the controller fetched the Oauth token once at start, so eventually the token would expire and the operator could not create new users. This commit makes the operator fetch the token before each call to the Teams API.
This commit is contained in:
Oleksii Kliukin
2017-05-12 11:41:28 +02:00
committed by Murat Kabilov
parent b6e6308bdc
commit 48ba6adf8a
4 changed files with 12 additions and 11 deletions
+1 -6
View File
@@ -68,12 +68,7 @@ func (c *Controller) initController() {
c.logger.Fatalf("Can't register ThirdPartyResource: %s", err)
}
token, err := c.getOAuthToken()
if err != nil {
c.logger.Errorf("Can't get OAuth token: %s", err)
} else {
c.config.TeamsAPIClient.OAuthToken = token
}
c.config.TeamsAPIClient.RefreshTokenAction = c.getOAuthToken
// Postgresqls
clusterLw := &cache.ListWatch{