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

feat: detect nativeUserMode will be enabled so don't wait for keycloak #1502

Merged
merged 3 commits into from
Aug 5, 2021
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
26 changes: 24 additions & 2 deletions src/tasks/che.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ export class CheTasks {
this.cheDeploymentName = flags['deployment-name']
}

async skipKeycloakDeploy(): Promise<boolean> {
const cheCluster = await this.kube.getCheCluster(this.cheNamespace)
if (!cheCluster) {
return false
}
return cheCluster.spec.auth.nativeUserMode
}

/**
* Returns tasks list that waits until every Eclipse Che component will be started.
*
Expand All @@ -93,7 +101,15 @@ export class CheTasks {
{
title: 'Keycloak pod bootstrap',
enabled: ctx => ctx.isKeycloakDeployed && !ctx.isKeycloakReady,
task: () => this.kubeTasks.podStartTasks(this.keycloakSelector, this.cheNamespace),
task: async (_ctx: any, task: any) => {
if (await this.skipKeycloakDeploy()) {
task.title = `${task.title}...skipped`
return {
task: () => {},
}
}
return this.kubeTasks.podStartTasks(this.keycloakSelector, this.cheNamespace)
},
},
{
title: 'Devfile Registry pod bootstrap',
Expand Down Expand Up @@ -252,7 +268,13 @@ export class CheTasks {
{
title: 'Keycloak pod bootstrap',
enabled: ctx => ctx.isKeycloakDeployed && !ctx.isKeycloakReady,
task: async () => {
task: async (_ctx: any, task: any) => {
if (await this.skipKeycloakDeploy()) {
task.title = `${task.title}...skipped`
return {
task: () => {},
}
}
await this.kube.scaleDeployment(this.keycloakDeploymentName, this.cheNamespace, 1)
return this.kubeTasks.podStartTasks(this.keycloakSelector, this.cheNamespace)
},
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/installers/common-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function createEclipseCheCluster(flags: any, kube: KubeHelper): Listr.Lis
const cheClusterCR = ctx.customCR || ctx.defaultCR
const cr = await kube.createCheCluster(cheClusterCR, flags, ctx, !ctx.customCR)

ctx.isKeycloakReady = ctx.isKeycloakReady || cr.spec.auth.externalIdentityProvider || cr.spec.auth.nativeUserMode
ctx.isKeycloakReady = ctx.isKeycloakReady || cr.spec.auth.externalIdentityProvider
ctx.isPostgresReady = ctx.isPostgresReady || cr.spec.database.externalDb
ctx.isDevfileRegistryReady = ctx.isDevfileRegistryReady || cr.spec.server.externalDevfileRegistry
ctx.isPluginRegistryReady = ctx.isPluginRegistryReady || cr.spec.server.externalPluginRegistry
Expand Down