Add support for customizable user (#7569)

This commit is contained in:
Harshavardhana
2019-06-10 07:57:42 -07:00
committed by Nitish Tiwari
parent 1008c2c069
commit 91ceae23d0
13 changed files with 244 additions and 31 deletions

View File

@@ -1,3 +1,5 @@
// +build ignore
/*
* MinIO Cloud Storage, (C) 2019 MinIO, Inc.
*
@@ -36,7 +38,7 @@ const (
initGraceTime = 300
healthPath = "/minio/health/live"
timeout = time.Duration(30 * time.Second)
minioProcess = "minio"
tcp = "tcp"
)
// returns container boot time by finding
@@ -66,9 +68,16 @@ func findEndpoint() (string, error) {
// split netstat output in rows
scanner := bufio.NewScanner(stdout)
scanner.Split(bufio.ScanLines)
// loop over the rows to find MinIO process
// MinIO works on TCP and it is supposed to be
// the only process listening on a port inside
// container. So we take the first row of netstat
// output (that has tcp) and assume that is the
// MinIO server port.
// Since MinIO is running as non-root user, we can
// no longer depend on the PID/Program name column
// of netstat output
for scanner.Scan() {
if strings.Contains(scanner.Text(), minioProcess) {
if strings.Contains(scanner.Text(), tcp) {
line := scanner.Text()
newLine := strings.Replace(line, ":::", "127.0.0.1:", 1)
fields := strings.Fields(newLine)