Skip to content

Commit

Permalink
remove --skip-oidc-provider-check flag and its logic
Browse files Browse the repository at this point in the history
Signed-off-by: ynqa <[email protected]>
  • Loading branch information
ynqa committed Jul 26, 2024
1 parent 4571efa commit d117f79
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 55 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ USAGE
[--k8spoddownloadimagetimeout <value>] [--k8spoderrorrechecktimeout <value>] [-d <value>] [-p
minikube|k8s|openshift|microk8s|docker-desktop|crc] [-b <value>] [--debug] [--che-operator-image <value>]
[--che-operator-cr-yaml <value>] [--che-operator-cr-patch-yaml <value>] [--workspace-pvc-storage-class-name <value>]
[--skip-version-check] [--skip-cert-manager] [--skip-devworkspace-operator] [--skip-oidc-provider-check]
[--skip-version-check] [--skip-cert-manager] [--skip-devworkspace-operator]
[--auto-update] [--starting-csv <value>] [--package-manifest-name <value>] [--catalog-source-yaml <value>
--olm-channel <value>] [--catalog-source-name <value> --catalog-source-namespace <value> ] [--catalog-source-image
<value> ] [--cluster-monitoring] [--telemetry on|off] [--skip-kubernetes-health-check]
Expand Down Expand Up @@ -416,9 +416,6 @@ FLAGS
--skip-kubernetes-health-check
Skip Kubernetes health check
--skip-oidc-provider-check
Skip OIDC Provider check
--skip-version-check
Skip minimal versions check.
Expand Down
4 changes: 0 additions & 4 deletions src/commands/server/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ import {
SKIP_DEV_WORKSPACE_FLAG,
SKIP_KUBE_HEALTHZ_CHECK,
SKIP_KUBE_HEALTHZ_CHECK_FLAG,
SKIP_OIDC_PROVIDER,
SKIP_OIDC_PROVIDER_FLAG,
SKIP_VERSION_CHECK,
SKIP_VERSION_CHECK_FLAG,
STARTING_CSV,
Expand Down Expand Up @@ -127,7 +125,6 @@ export default class Deploy extends Command {
[SKIP_VERSION_CHECK_FLAG]: SKIP_VERSION_CHECK,
[SKIP_CERT_MANAGER_FLAG]: SKIP_CERT_MANAGER,
[SKIP_DEV_WORKSPACE_FLAG]: SKIP_DEV_WORKSPACE,
[SKIP_OIDC_PROVIDER_FLAG]: SKIP_OIDC_PROVIDER,
[AUTO_UPDATE_FLAG]: AUTO_UPDATE,
[STARTING_CSV_FLAG]: STARTING_CSV,
[OLM_CHANNEL_FLAG]: OLM_CHANNEL,
Expand Down Expand Up @@ -156,7 +153,6 @@ export default class Deploy extends Command {

// Platform Checks
const platformTasks = newListr()
platformTasks.add(PlatformTasks.getEnsureOIDCProviderInstalledTask())
platformTasks.add(PlatformTasks.getPreflightCheckTasks())

// PreInstall tasks
Expand Down
6 changes: 0 additions & 6 deletions src/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ export const LISTR_RENDERER = Flags.string({
hidden: true,
})

export const SKIP_OIDC_PROVIDER_FLAG = 'skip-oidc-provider-check'
export const SKIP_OIDC_PROVIDER = Flags.boolean({
description: 'Skip OIDC Provider check',
default: false,
})

export const SKIP_KUBE_HEALTHZ_CHECK_FLAG = 'skip-kubernetes-health-check'
export const SKIP_KUBE_HEALTHZ_CHECK = Flags.boolean({
description: 'Skip Kubernetes health check',
Expand Down
43 changes: 2 additions & 41 deletions src/tasks/platforms/platform-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,14 @@ import { K8sTasks } from './k8s'
import { MicroK8sTasks } from './microk8s'
import { MinikubeTasks } from './minikube'
import { OpenshiftTasks } from './openshift'
import {EclipseChe} from '../installers/eclipse-che/eclipse-che'
import {KubeClient} from '../../api/kube-client'
import {CheCtlContext, OIDCContext} from '../../context'
import {PLATFORM_FLAG, SKIP_OIDC_PROVIDER_FLAG} from '../../flags'
import {CheCtlContext} from '../../context'
import {PLATFORM_FLAG} from '../../flags'
import {newListr} from '../../utils/utls'

/**
* Platform specific tasks.
*/
export namespace PlatformTasks {
export function getEnsureOIDCProviderInstalledTask(): Listr.ListrTask {
const flags = CheCtlContext.getFlags()
return {
title: 'Check if OIDC Provider installed',
enabled: () => !flags[SKIP_OIDC_PROVIDER_FLAG],
skip: () => {
if (flags[PLATFORM_FLAG] === 'minikube') {
return 'Dex will be automatically installed as OIDC Identity Provider'
}
},
task: async (_ctx: any, task: any) => {
const kubeHelper = KubeClient.getInstance()
const apiServerPods = await kubeHelper.getPodListByLabel('kube-system', 'component=kube-apiserver')
for (const pod of apiServerPods) {
if (!pod.spec) {
continue
}

for (const container of pod.spec.containers) {
if (container.command && container.command.some(value => value.includes(OIDCContext.ISSUER_URL)) && container.command.some(value => value.includes(OIDCContext.CLIENT_ID))) {
task.title = `${task.title}...[OK]`
return
}

if (container.args && container.args.some(value => value.includes(OIDCContext.ISSUER_URL)) && container.args.some(value => value.includes(OIDCContext.CLIENT_ID))) {
task.title = `${task.title}...[OK]`
return
}
}
}

task.title = `${task.title}...[Not Found]`
throw new Error(`API server is not configured with OIDC Identity Provider, see details ${EclipseChe.DOC_LINK_CONFIGURE_API_SERVER}. To bypass OIDC Provider check, use \'--skip-oidc-provider-check\' flag`)
},
}
}

export function getPreflightCheckTasks(): Listr.ListrTask<any> {
const flags = CheCtlContext.getFlags()

Expand Down

0 comments on commit d117f79

Please sign in to comment.