diff --git a/src/tasks/che.ts b/src/tasks/che.ts index dbc66b892..ef3c3d0b1 100644 --- a/src/tasks/che.ts +++ b/src/tasks/che.ts @@ -76,6 +76,14 @@ export class CheTasks { this.cheDeploymentName = flags['deployment-name'] } + async skipKeycloakDeploy(): Promise { + 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. * @@ -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', @@ -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) }, diff --git a/src/tasks/installers/common-tasks.ts b/src/tasks/installers/common-tasks.ts index bca914979..ff9c070d3 100644 --- a/src/tasks/installers/common-tasks.ts +++ b/src/tasks/installers/common-tasks.ts @@ -24,7 +24,7 @@ import { CheGithubClient } from '../../api/github-client' import { KubeHelper } from '../../api/kube' import { VersionHelper } from '../../api/version' import { CHE_CLUSTER_CRD, DOCS_LINK_IMPORT_CA_CERT_INTO_BROWSER, OPERATOR_TEMPLATE_DIR } from '../../constants' -import { getProjectVersion, isOpenshiftPlatformFamily } from '../../util' +import { getProjectVersion } from '../../util' export function createNamespaceTask(namespaceName: string, labels: {}): Listr.ListrTask { return { @@ -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 || shouldNotDeployKeycloak(flags, cr) + 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 @@ -155,11 +155,6 @@ export function createEclipseCheCluster(flags: any, kube: KubeHelper): Listr.Lis } } -function shouldNotDeployKeycloak(flags: any, cr: any): boolean { - return cr.spec.auth.externalIdentityProvider || cr.spec.auth.nativeUserMode || - (isOpenshiftPlatformFamily(flags.platform) && cr.spec.devWorkspace.enable) -} - /** * Update CheCluster CR object using CR patch file. * Clean up custom images if they weren't defined in the CR patch file to prevent update failing.