Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove devfile and plugin registries defaults #228

Merged
merged 3 commits into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/commands/server/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,11 @@ export default class Start extends Command {
env: 'CHE_TEMPLATES_FOLDER'
}),
'devfile-registry-url': string({
description: 'The URL of the Devfile registry.',
default: 'https://che-devfile-registry.openshift.io/',
description: 'The URL of the external Devfile registry.',
env: 'CHE_WORKSPACE_DEVFILE__REGISTRY__URL'
}),
'plugin-registry-url': string({
description: 'The URL of the plugin registry.',
default: 'https://che-plugin-registry.openshift.io/v3',
description: 'The URL of the external plugin registry.',
env: 'CHE_WORKSPACE_PLUGIN__REGISTRY__URL'
}),
cheboottimeout: string({
Expand Down Expand Up @@ -288,6 +286,20 @@ export default class Start extends Command {
})
}

if (!flags['devfile-registry-url']) {
cheBootstrapSubTasks.add({
title: 'Devfile registry pod bootstrap',
task: () => this.podStartTasks(this.getDevfileRegistrySelector(), flags.chenamespace)
})
}

if (!flags['plugin-registry-url']) {
cheBootstrapSubTasks.add({
title: 'Plugin registry pod bootstrap',
task: () => this.podStartTasks(this.getPluginRegistrySelector(), flags.chenamespace)
})
}

cheBootstrapSubTasks.add({
title: 'Che pod bootstrap',
task: () => this.podStartTasks(this.getCheServerSelector(), flags.chenamespace)
Expand Down Expand Up @@ -331,6 +343,14 @@ export default class Start extends Command {
return 'app=che,component=keycloak'
}

getDevfileRegistrySelector(): string {
return 'app=che,component=devfile-registry'
}

getPluginRegistrySelector(): string {
return 'app=che,component=plugin-registry'
}

getCheServerSelector(): string {
return 'app=che,component=che'
}
Expand Down
54 changes: 52 additions & 2 deletions src/commands/server/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class Stop extends Command {
}),
'che-selector': string({
description: 'Selector for Che Server resources',
default: 'app=che',
default: 'app=che,component=che',
env: 'CHE_SELECTOR'
}),
'access-token': string({
Expand Down Expand Up @@ -87,6 +87,8 @@ export default class Stop extends Command {
// helm chart and Che operator use a deployment
ctx.foundKeycloakDeployment = await kh.deploymentExist('keycloak', flags.chenamespace)
ctx.foundPostgresDeployment = await kh.deploymentExist('postgres', flags.chenamespace)
ctx.foundDevfileRegistryDeployment = await kh.deploymentExist('devfile-registry', flags.chenamespace)
ctx.foundPluginRegistryDeployment = await kh.deploymentExist('plugin-registry', flags.chenamespace)
if (ctx.foundKeycloakDeployment && ctx.foundPostgresDeployment) {
task.title = await `${task.title}...it does (as well as keycloak and postgres)`
} else {
Expand Down Expand Up @@ -170,7 +172,7 @@ Che server is not ready yet. Try again in a few seconds.`
title: 'Wait until Che pod is deleted',
enabled: (ctx: any) => !ctx.isAlreadyStopped && !ctx.isNotReadyYet,
task: async (_ctx: any, task: any) => {
await kh.waitUntilPodIsDeleted('app=che', flags.chenamespace)
await kh.waitUntilPodIsDeleted('app=che,component=che', flags.chenamespace)
task.title = `${task.title}...done.`
}
},
Expand Down Expand Up @@ -222,6 +224,54 @@ Che server is not ready yet. Try again in a few seconds.`
task.title = `${task.title}...done.`
}
},
{
title: 'Scale \"devfile registry\" deployment to zero',
enabled: (ctx: any) => ctx.foundDevfileRegistryDeployment,
task: async (ctx: any, task: any) => {
try {
if (ctx.deploymentConfigExist) {
await oc.scaleDeploymentConfig('devfile-registry', flags.chenamespace, 0)
} else {
await kh.scaleDeployment('devfile-registry', flags.chenamespace, 0)
}
task.title = await `${task.title}...done`
} catch (error) {
this.error(`E_SCALE_DEPLOY_FAIL - Failed to scale devfile-registry deployment. ${error.message}`)
}
}
},
{
title: 'Wait until Devfile registry pod is deleted',
enabled: (ctx: any) => ctx.foundDevfileRegistryDeployment,
task: async (_ctx: any, task: any) => {
await kh.waitUntilPodIsDeleted('app=che,component=devfile-registry', flags.chenamespace)
task.title = `${task.title}...done.`
}
},
{
title: 'Scale \"plugin registry\" deployment to zero',
enabled: (ctx: any) => ctx.foundPluginRegistryDeployment,
task: async (ctx: any, task: any) => {
try {
if (ctx.deploymentConfigExist) {
await oc.scaleDeploymentConfig('plugin-registry', flags.chenamespace, 0)
} else {
await kh.scaleDeployment('plugin-registry', flags.chenamespace, 0)
}
task.title = await `${task.title}...done`
} catch (error) {
this.error(`E_SCALE_DEPLOY_FAIL - Failed to scale plugin-registry deployment. ${error.message}`)
}
}
},
{
title: 'Wait until Plugin registry pod is deleted',
enabled: (ctx: any) => ctx.foundPluginRegistryDeployment,
task: async (_ctx: any, task: any) => {
await kh.waitUntilPodIsDeleted('app=che,component=plugin-registry', flags.chenamespace)
task.title = `${task.title}...done.`
}
},
], {renderer: flags['listr-renderer'] as any})

try {
Expand Down
18 changes: 15 additions & 3 deletions src/installers/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,30 @@ error: E_COMMAND_FAILED`)

let multiUserFlag = ''
let tlsFlag = ''
let setOptions = ''
let setOptions = []

if (flags.multiuser) {
multiUserFlag = `-f ${destDir}values/multi-user.yaml`
}

if (flags.tls) {
setOptions = `--set global.cheDomain=${flags.domain} --set global.tls.email='${ctx.tlsEmail}'`
setOptions.push(`--set global.cheDomain=${flags.domain} --set global.tls.email='${ctx.tlsEmail}'`)
tlsFlag = `-f ${destDir}values/tls.yaml`
}

let command = `helm upgrade --install che --force --namespace ${flags.chenamespace} --set global.ingressDomain=${flags.domain} ${setOptions} --set cheImage=${flags.cheimage} --set global.cheWorkspacesNamespace=${flags.chenamespace} --set che.workspace.devfileRegistryUrl=${flags['devfile-registry-url']} --set che.workspace.pluginRegistryUrl=${flags['plugin-registry-url']} ${multiUserFlag} ${tlsFlag} ${destDir}`
if (flags['plugin-registry-url']) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is happening if you use server:start without --plugin-registry-url ? it is failing no ?

Copy link
Member Author

Choose a reason for hiding this comment

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

it doesn't set helm parameter so value from helm chart is used. By default registries will be deployed in your minikube and URLs will be set to those eclipse-che/che#13890

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok it was not clear enough for me that this PR can only be merged after eclipse-che/che#13890

Copy link
Member Author

@sparkoo sparkoo Jul 19, 2019

Choose a reason for hiding this comment

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

well, I don't think that this must be merged after. Helm charts currently does not set the registry urls, but then che.properties values are used, which are again set to openshift.io ones https://github.com/eclipse/che/blob/master/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties#L580
So basically nothing happens when we merge this one. The chectl registries url params were added just 2 days ago #189

setOptions.push(`--set che.workspace.pluginRegistryUrl=${flags['plugin-registry-url']} --set chePluginRegistry.deploy=false`)
}

if (flags['devfile-registry-url']) {
setOptions.push(`--set che.workspace.devfileRegistryUrl=${flags['devfile-registry-url']} --set cheDevfileRegistry.deploy=false`)
}

setOptions.push(`--set global.ingressDomain=${flags.domain}`)
setOptions.push(`--set cheImage=${flags.cheimage}`)
setOptions.push(`--set global.cheWorkspacesNamespace=${flags.chenamespace}`)

let command = `helm upgrade --install che --force --namespace ${flags.chenamespace} ${setOptions.join(' ')} ${multiUserFlag} ${tlsFlag} ${destDir}`

let {code, stderr} = await execa.shell(command, { timeout: execTimeout, reject: false })
// if process failed, check the following
Expand Down