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

Commit

Permalink
Merge pull request #103 from madushajg/master
Browse files Browse the repository at this point in the history
Fix MySQL pod restarting issue in minikube
  • Loading branch information
nadundesilva committed Jul 19, 2019
2 parents f44987a + 609e79a commit fa8a95e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
3 changes: 1 addition & 2 deletions components/docker-auth/cmd/authserver/auth_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ func main() {
log.Printf("[%s] Error occured while decoding POST request for authentication : %s", execId, err)
}

log.Printf("[%s] Authentication request received by server. Uname : %s, Token : %s", execId,
authParams.UName, authParams.Token)
log.Printf("[%s] Authentication request received by server for Uname : %s", execId, authParams.UName)

authnRes := auth.Authenticate(authParams.UName, authParams.Token, execId)

Expand Down
4 changes: 2 additions & 2 deletions components/docker-auth/pkg/auth/authn_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func validateAccessToken(token string, providedUsername string, execId string) b
} else if res.StatusCode != http.StatusOK {
log.Printf("[%s] Error while calling IDP, status code :%d. Exiting without authorization\n", execId,
res.StatusCode)
os.Exit(extension.ErrorExitCode)
return false
}

defer res.Body.Close()
Expand Down Expand Up @@ -284,7 +284,7 @@ func resolveCredentials(execId string) (string, string, bool) {
func isValidUser(tokenUsername interface{}, providedUsername string, execId string) bool {
if username, ok := tokenUsername.(string); ok {
usernameTokens := strings.Split(username, "@")
log.Printf("[%s] User needed to be validated %s with provided username %s\n",
log.Printf("[%s] User %s, needed to be validated with provided username %s\n",
execId, usernameTokens[0], providedUsername)
if providedUsername == usernameTokens[0] {
log.Printf("[%s] User received is valid\n", execId)
Expand Down
10 changes: 9 additions & 1 deletion components/docker-auth/pkg/db/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,21 @@ func GetDbConnectionPool() (*sql.DB, error) {
return nil, fmt.Errorf("error occurred while establishing database connection pool "+
" : %v", err)
}
log.Printf("DB connection pool established")

dbConnection.SetMaxOpenConns(dbPoolConfigurations[extension.MaxIdleConnectionsEnvVar])
dbConnection.SetMaxIdleConns(dbPoolConfigurations[extension.ConnectionMaxLifetimeEnvVar])
dbConnection.SetConnMaxLifetime(time.Minute * time.Duration(dbPoolConfigurations[extension.
ConnectionMaxLifetimeEnvVar]))

err = dbConnection.Ping()
if err != nil {
log.Printf("Failed to ping database connection pool: %s", err)
return nil, fmt.Errorf("error occurred while pinging database connection pool "+
" : %v", err)
}

log.Printf("Ping successful. DB connection pool established")

return dbConnection, nil
}

Expand Down
2 changes: 1 addition & 1 deletion components/docker-auth/pkg/extension/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ExecIdHeaderName = "x-cellery-hub-exec-id"
const getVisibilityQuery = "SELECT VISIBILITY FROM REGISTRY_ARTIFACT_IMAGE " +
"INNER JOIN REGISTRY_ORGANIZATION ON REGISTRY_ORGANIZATION.ORG_NAME=REGISTRY_ARTIFACT_IMAGE.ORG_NAME " +
"WHERE REGISTRY_ARTIFACT_IMAGE.IMAGE_NAME=? AND " +
"REGISTRY_ORGANIZATION.ORG_NAME = ? LIMIT 1"
"REGISTRY_ORGANIZATION.ORG_NAME=? LIMIT 1"
const getUserAvailabilityQuery = "SELECT 1 FROM " +
"REGISTRY_ORG_USER_MAPPING " +
"WHERE REGISTRY_ORG_USER_MAPPING.USER_UUID=? AND REGISTRY_ORG_USER_MAPPING.ORG_NAME=?"
Expand Down

0 comments on commit fa8a95e

Please sign in to comment.