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

Handle dashboard pod on server start/stop commands #1024

Merged
merged 1 commit into from
Dec 9, 2020
Merged
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
31 changes: 31 additions & 0 deletions src/tasks/che.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export class CheTasks {
cheSelector = 'app=che,component=che'
cheDeploymentName: string

dashboardDeploymentName = 'che-dashboard'
dashboardSelector = 'app=che,component=che-dashboard'

keycloakDeploymentName = 'keycloak'
keycloakSelector = 'app=che,component=keycloak'

Expand Down Expand Up @@ -118,6 +121,14 @@ export class CheTasks {
ctx.isCheStopped = await this.kube.deploymentStopped(this.cheDeploymentName, this.cheNamespace)
}

ctx.isDashboardDeployed = await this.kube.deploymentExist(this.dashboardDeploymentName, this.cheNamespace)
if (ctx.isDashboardDeployed) {
ctx.isDashboardReady = await this.kube.deploymentReady(this.dashboardDeploymentName, this.cheNamespace)
if (!ctx.isDashboardReady) {
ctx.isDashboardStopped = await this.kube.deploymentStopped(this.dashboardDeploymentName, this.cheNamespace)
}
}

ctx.isKeycloakDeployed = await this.kube.deploymentExist(this.keycloakDeploymentName, this.cheNamespace)
if (ctx.isKeycloakDeployed) {
ctx.isKeycloakReady = await this.kube.deploymentReady(this.keycloakDeploymentName, this.cheNamespace)
Expand Down Expand Up @@ -252,6 +263,14 @@ export class CheTasks {
return this.kubeTasks.podStartTasks(this.cheSelector, this.cheNamespace)
}
},
{
title: 'Eclipse Che dashboard pod bootstrap',
enabled: ctx => ctx.isDashboardDeployed && !ctx.isDashboardReady,
task: async () => {
await this.kube.scaleDeployment(this.dashboardDeploymentName, this.cheNamespace, 1)
return this.kubeTasks.podStartTasks(this.dashboardSelector, this.cheNamespace)
}
},
...this.checkEclipseCheStatus()
]
}
Expand Down Expand Up @@ -295,6 +314,18 @@ export class CheTasks {
}
}
},
{
title: 'Scale \"dashboard\" deployment to zero',
enabled: (ctx: any) => ctx.isDashboardDeployed && !ctx.isDashboardStopped,
task: async (_ctx: any, task: any) => {
try {
await this.kube.scaleDeployment(this.dashboardDeploymentName, this.cheNamespace, 0)
task.title = await `${task.title}...done`
} catch (error) {
command.error(`E_SCALE_DEPLOY_FAIL - Failed to scale dashboard deployment. ${error.message}`)
}
}
},
{
title: 'Scale \"keycloak\" deployment to zero',
enabled: (ctx: any) => ctx.isKeycloakDeployed && !ctx.isKeycloakStopped,
Expand Down