Skip to content

Commit

Permalink
Only start che on minishift and minikube if userland-proxy is disabled
Browse files Browse the repository at this point in the history
Change-Id: Iea000a65c26cca00972deea498d6131eb3c5709b
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
  • Loading branch information
benoitf committed Mar 28, 2019
1 parent 271ea82 commit f070963
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/platforms/minikube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ export class MinikubeHelper {
},
task: () => this.startMinikube()
},
{ title: 'Verify userland-proxy is disabled',
task: async (_ctx: any, task: any) => {
const userlandDisabled = await this.isUserLandDisabled()
if (!userlandDisabled) {
command.error(`E_PLATFORM_NOT_COMPLIANT_USERLAND: userland-proxy=false parameter is required on docker daemon but it was not found.
This setting is given when originally starting minikube. (you can then later check by performing command : minikube ssh -- ps auxwwww | grep dockerd
It needs to contain --userland-proxy=false
Command that needs to be added on top of your start command:
$ minikube start <all your existing-options> --docker-opt userland-proxy=false
Note: you may have to recreate the minikube installation.
`)
} else {
task.title = `${task.title}...done.`
}
}
},
// { title: 'Verify minikube memory configuration', skip: () => 'Not implemented yet', task: () => {}},
// { title: 'Verify kubernetes version', skip: () => 'Not implemented yet', task: () => {}},
{ title: 'Verify if minikube ingress addon is enabled',
Expand Down Expand Up @@ -77,7 +93,7 @@ export class MinikubeHelper {
}

async startMinikube() {
await execa('minikube', ['start', '--memory=4096', '--cpus=4', '--disk-size=50g'], { timeout: 180000 })
await execa('minikube', ['start', '--memory=4096', '--cpus=4', '--disk-size=50g', '--docker-opt', 'userland-proxy=false'], { timeout: 180000 })
}

async isIngressAddonEnabled(): Promise<boolean> {
Expand All @@ -93,4 +109,13 @@ export class MinikubeHelper {
const { stdout } = await execa('minikube', ['ip'], { timeout: 10000 })
return stdout
}

/**
* Check if userland-proxy=false is set in docker daemon options
* if not, return an error
*/
async isUserLandDisabled(): Promise<boolean> {
const {stdout} = await execa('minikube', ['ssh', '--', 'ps', 'auxwww', '|', 'grep dockerd'], { timeout: 10000 })
return stdout.includes('--userland-proxy=false');
}
}
25 changes: 25 additions & 0 deletions src/platforms/minishift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ export class MinishiftHelper {
}
}
},
{ title: 'Verify userland-proxy is disabled',
task: async (_ctx: any, task: any) => {
const userlandDisabled = await this.isUserLandDisabled()
if (!userlandDisabled) {
command.error(`E_PLATFORM_NOT_COMPLIANT_USERLAND: userland-proxy=false parameter is required on docker daemon but it was not found.
This setting is given when originally starting minishift. (you can then later check by performing command : minishift ssh -- ps auxwwww | grep dockerd
It needs to contain --userland-proxy=false
Command that needs to be added on top of your start command:
$ minishift start <all your existing-options> --docker-opt userland-proxy=false
Note: you may have to recreate the minishift installation.
`)
} else {
task.title = `${task.title}...done.`
}
}
},
// { title: 'Verify minishift memory configuration', skip: () => 'Not implemented yet', task: () => {}},
// { title: 'Verify kubernetes version', skip: () => 'Not implemented yet', task: () => {}},
{ title: 'Retrieving minishift IP and domain for routes URLs',
Expand Down Expand Up @@ -74,4 +90,13 @@ export class MinishiftHelper {
const { stdout } = await execa('minishift', ['ip'], { timeout: 10000 })
return stdout
}

/**
* Check if userland-proxy=false is set in docker daemon options
* if not, return an error
*/
async isUserLandDisabled(): Promise<boolean> {
const {stdout} = await execa('minishift', ['ssh', '--', 'ps', 'auxwww', '|', 'grep dockerd'], { timeout: 10000 })
return stdout.includes('--userland-proxy=false');
}
}

0 comments on commit f070963

Please sign in to comment.