diff --git a/README.md b/README.md index b885cd796..f457554fc 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,9 @@ OPTIONS -p, --platform=minikube|minishift|k8s|openshift|microk8s|docker-desktop|crc Type of Kubernetes platform. Valid values are "minikube", "minishift", "k8s (for kubernetes)", "openshift", "crc (for CodeReady Containers)", "microk8s". + + --skip-kubernetes-health-check + Skip Kubernetes health check ``` _See code: [src/commands/cacert/export.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/cacert/export.ts)_ @@ -238,6 +241,8 @@ OPTIONS --debug-port=debug-port [default: 8000] Eclipse Che server debug port --listr-renderer=default|silent|verbose [default: default] Listr renderer + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/server/debug.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/server/debug.ts)_ @@ -259,6 +264,8 @@ OPTIONS --listr-renderer=default|silent|verbose [default: default] Listr renderer --skip-deletion-check Skip user confirmation on deletion check + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/server/delete.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/server/delete.ts)_ @@ -281,6 +288,8 @@ OPTIONS --deployment-name=deployment-name [default: che] Eclipse Che deployment name --listr-renderer=default|silent|verbose [default: default] Listr renderer + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/server/logs.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/server/logs.ts)_ @@ -415,6 +424,9 @@ OPTIONS --skip-cluster-availability-check Skip cluster availability check. The check is a simple request to ensure the cluster is reachable. + --skip-kubernetes-health-check + Skip Kubernetes health check + --skip-version-check Skip minimal versions check. @@ -454,6 +466,8 @@ OPTIONS --deployment-name=deployment-name [default: che] Eclipse Che deployment name --listr-renderer=default|silent|verbose [default: default] Listr renderer + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/server/stop.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/server/stop.ts)_ @@ -493,6 +507,8 @@ OPTIONS --listr-renderer=default|silent|verbose [default: default] Listr renderer + --skip-kubernetes-health-check Skip Kubernetes health check + --skip-version-check Skip user confirmation on version check ``` @@ -534,6 +550,8 @@ OPTIONS --name=name Workspace name: overrides the workspace name to use instead of the one defined in the devfile. + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/workspace/create.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/workspace/create.ts)_ @@ -559,6 +577,8 @@ OPTIONS --delete-namespace Indicates that a Kubernetes namespace where workspace was created will be deleted as well + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/workspace/delete.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/workspace/delete.ts)_ @@ -590,6 +610,8 @@ OPTIONS --access-token=access-token Eclipse Che OIDC Access Token --kube-context=kube-context Kubeconfig context to inject + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/workspace/inject.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/workspace/inject.ts)_ @@ -609,6 +631,8 @@ OPTIONS deployed --access-token=access-token Eclipse Che OIDC Access Token + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/workspace/list.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/workspace/list.ts)_ @@ -632,6 +656,8 @@ OPTIONS field. --listr-renderer=default|silent|verbose [default: default] Listr renderer + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/workspace/logs.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/workspace/logs.ts)_ @@ -657,6 +683,8 @@ OPTIONS deployed --access-token=access-token Eclipse Che OIDC Access Token + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/workspace/start.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/workspace/start.ts)_ @@ -679,6 +707,8 @@ OPTIONS deployed --access-token=access-token Eclipse Che OIDC Access Token + + --skip-kubernetes-health-check Skip Kubernetes health check ``` _See code: [src/commands/workspace/stop.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/workspace/stop.ts)_ diff --git a/src/commands/cacert/export.ts b/src/commands/cacert/export.ts index 496bcdaf3..6d389c487 100644 --- a/src/commands/cacert/export.ts +++ b/src/commands/cacert/export.ts @@ -16,7 +16,7 @@ import * as os from 'os' import * as path from 'path' import { CheHelper } from '../../api/che' -import { cheNamespace } from '../../common-flags' +import { cheNamespace, skipKubeHealthzCheck } from '../../common-flags' import { DEFAULT_CA_CERT_FILE_NAME } from '../../constants' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' @@ -42,6 +42,7 @@ export default class Export extends Command { env: 'CHE_CA_CERT_LOCATION', default: '' }), + 'skip-kubernetes-health-check': skipKubeHealthzCheck } async run() { diff --git a/src/commands/server/debug.ts b/src/commands/server/debug.ts index 4c8dc17cc..b626431d1 100644 --- a/src/commands/server/debug.ts +++ b/src/commands/server/debug.ts @@ -12,7 +12,7 @@ import { Command, flags } from '@oclif/command' import { integer } from '@oclif/parser/lib/flags' import * as Listr from 'listr' -import { cheNamespace, listrRenderer } from '../../common-flags' +import { cheNamespace, listrRenderer, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' @@ -26,7 +26,8 @@ export default class Debug extends Command { 'debug-port': integer({ description: 'Eclipse Che server debug port', default: 8000 - }) + }), + 'skip-kubernetes-health-check': skipKubeHealthzCheck } async run() { diff --git a/src/commands/server/delete.ts b/src/commands/server/delete.ts index e2260d995..116247a5e 100644 --- a/src/commands/server/delete.ts +++ b/src/commands/server/delete.ts @@ -14,7 +14,7 @@ import { cli } from 'cli-ux' import * as Listrq from 'listr' import { KubeHelper } from '../../api/kube' -import { cheNamespace, listrRenderer } from '../../common-flags' +import { cheNamespace, listrRenderer, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { HelmTasks } from '../../tasks/installers/helm' import { MinishiftAddonTasks } from '../../tasks/installers/minishift-addon' @@ -33,6 +33,7 @@ export default class Delete extends Command { description: 'Skip user confirmation on deletion check', default: false }), + 'skip-kubernetes-health-check': skipKubeHealthzCheck } async run() { diff --git a/src/commands/server/logs.ts b/src/commands/server/logs.ts index f5ff5e34b..abbc9c2b3 100644 --- a/src/commands/server/logs.ts +++ b/src/commands/server/logs.ts @@ -15,7 +15,7 @@ import * as notifier from 'node-notifier' import * as os from 'os' import * as path from 'path' -import { cheDeployment, cheNamespace, listrRenderer } from '../../common-flags' +import { cheDeployment, cheNamespace, listrRenderer, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' @@ -31,7 +31,8 @@ export default class Logs extends Command { char: 'd', description: 'Directory to store logs into', env: 'CHE_LOGS' - }) + }), + 'skip-kubernetes-health-check': skipKubeHealthzCheck } async run() { diff --git a/src/commands/server/start.ts b/src/commands/server/start.ts index 08becd492..9b4f16059 100644 --- a/src/commands/server/start.ts +++ b/src/commands/server/start.ts @@ -17,7 +17,7 @@ import * as notifier from 'node-notifier' import * as os from 'os' import * as path from 'path' -import { cheDeployment, cheNamespace, listrRenderer } from '../../common-flags' +import { cheDeployment, cheNamespace, listrRenderer, skipKubeHealthzCheck as skipK8sHealthCheck } from '../../common-flags' import { DEFAULT_CHE_IMAGE, DEFAULT_CHE_OPERATOR_IMAGE, DOCS_LINK_INSTALL_TLS_WITH_SELF_SIGNED_CERT } from '../../constants' import { CheTasks } from '../../tasks/che' import { retrieveCheCaCertificateTask } from '../../tasks/installers/common-tasks' @@ -185,7 +185,8 @@ export default class Start extends Command { Catalog source will be applied to the namespace with Che operator. Also you need define 'olm-channel' name and 'package-manifest-name'. This parameter is used only when the installer is the 'olm'.`, - }) + }), + 'skip-kubernetes-health-check': skipK8sHealthCheck } async setPlaformDefaults(flags: any): Promise { diff --git a/src/commands/server/stop.ts b/src/commands/server/stop.ts index 6825e8a1f..d2759e755 100644 --- a/src/commands/server/stop.ts +++ b/src/commands/server/stop.ts @@ -11,7 +11,7 @@ import { Command, flags } from '@oclif/command' import { string } from '@oclif/parser/lib/flags' -import { accessToken, cheDeployment, cheNamespace, listrRenderer } from '../../common-flags' +import { accessToken, cheDeployment, cheNamespace, listrRenderer, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' @@ -28,7 +28,8 @@ export default class Stop extends Command { env: 'CHE_SELECTOR' }), 'access-token': accessToken, - 'listr-renderer': listrRenderer + 'listr-renderer': listrRenderer, + 'skip-kubernetes-health-check': skipKubeHealthzCheck } async run() { diff --git a/src/commands/server/update.ts b/src/commands/server/update.ts index f64ac07c1..4453283fa 100644 --- a/src/commands/server/update.ts +++ b/src/commands/server/update.ts @@ -17,7 +17,7 @@ import * as notifier from 'node-notifier' import * as path from 'path' import { KubeHelper } from '../../api/kube' -import { cheDeployment, cheNamespace, listrRenderer } from '../../common-flags' +import { cheDeployment, cheNamespace, listrRenderer, skipKubeHealthzCheck } from '../../common-flags' import { CHE_CLUSTER_CR_NAME, DEFAULT_CHE_OPERATOR_IMAGE } from '../../constants' import { CheTasks } from '../../tasks/che' import { InstallerTasks } from '../../tasks/installers/installer' @@ -57,6 +57,7 @@ export default class Update extends Command { }), 'deployment-name': cheDeployment, 'listr-renderer': listrRenderer, + 'skip-kubernetes-health-check': skipKubeHealthzCheck, help: flags.help({ char: 'h' }), } diff --git a/src/commands/workspace/create.ts b/src/commands/workspace/create.ts index 2081d69e3..7671e1524 100644 --- a/src/commands/workspace/create.ts +++ b/src/commands/workspace/create.ts @@ -14,7 +14,7 @@ import { cli } from 'cli-ux' import * as Listr from 'listr' import * as notifier from 'node-notifier' -import { accessToken, cheNamespace } from '../../common-flags' +import { accessToken, cheNamespace, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' import { WorkspaceTasks } from '../../tasks/workspace-tasks' @@ -45,7 +45,8 @@ export default class Create extends Command { description: 'Debug workspace start. It is useful when workspace start fails and it is needed to print more logs on startup. This flag is used in conjunction with --start flag.', default: false }), - 'access-token': accessToken + 'access-token': accessToken, + 'skip-kubernetes-health-check': skipKubeHealthzCheck } async run() { diff --git a/src/commands/workspace/delete.ts b/src/commands/workspace/delete.ts index 226829aa5..ecd37ec31 100644 --- a/src/commands/workspace/delete.ts +++ b/src/commands/workspace/delete.ts @@ -15,7 +15,7 @@ import * as notifier from 'node-notifier' import { CheHelper } from '../../api/che' import { KubeHelper } from '../../api/kube' -import { accessToken, cheNamespace } from '../../common-flags' +import { accessToken, cheNamespace, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' @@ -29,7 +29,8 @@ export default class Delete extends Command { description: 'Indicates that a Kubernetes namespace where workspace was created will be deleted as well', default: false }), - 'access-token': accessToken + 'access-token': accessToken, + 'skip-kubernetes-health-check': skipKubeHealthzCheck } static args = [ { diff --git a/src/commands/workspace/inject.ts b/src/commands/workspace/inject.ts index 3e19a2056..b30ddbe04 100644 --- a/src/commands/workspace/inject.ts +++ b/src/commands/workspace/inject.ts @@ -20,7 +20,7 @@ import * as path from 'path' import { CheHelper } from '../../api/che' import { KubeHelper } from '../../api/kube' -import { accessToken, cheNamespace } from '../../common-flags' +import { accessToken, cheNamespace, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' import { getClusterClientCommand, OPENSHIFT_CLI } from '../../util' @@ -50,7 +50,8 @@ export default class Inject extends Command { required: false }), 'access-token': accessToken, - chenamespace: cheNamespace + chenamespace: cheNamespace, + 'skip-kubernetes-health-check': skipKubeHealthzCheck } // Holds cluster CLI tool name: kubectl or oc diff --git a/src/commands/workspace/list.ts b/src/commands/workspace/list.ts index bead51780..c313e050a 100644 --- a/src/commands/workspace/list.ts +++ b/src/commands/workspace/list.ts @@ -13,7 +13,7 @@ import { cli } from 'cli-ux' import * as Listrq from 'listr' import { CheHelper } from '../../api/che' -import { accessToken, cheNamespace } from '../../common-flags' +import { accessToken, cheNamespace, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' @@ -23,7 +23,8 @@ export default class List extends Command { static flags = { help: flags.help({ char: 'h' }), chenamespace: cheNamespace, - 'access-token': accessToken + 'access-token': accessToken, + 'skip-kubernetes-health-check': skipKubeHealthzCheck } async run() { diff --git a/src/commands/workspace/logs.ts b/src/commands/workspace/logs.ts index f22628e63..f8e56f30f 100644 --- a/src/commands/workspace/logs.ts +++ b/src/commands/workspace/logs.ts @@ -15,7 +15,7 @@ import * as notifier from 'node-notifier' import * as os from 'os' import * as path from 'path' -import { listrRenderer } from '../../common-flags' +import { listrRenderer, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' @@ -39,7 +39,8 @@ export default class Logs extends Command { char: 'd', description: 'Directory to store logs into', env: 'CHE_LOGS' - }) + }), + 'skip-kubernetes-health-check': skipKubeHealthzCheck } async run() { diff --git a/src/commands/workspace/start.ts b/src/commands/workspace/start.ts index 816f6ba5c..d7450aa99 100644 --- a/src/commands/workspace/start.ts +++ b/src/commands/workspace/start.ts @@ -13,7 +13,7 @@ import { cli } from 'cli-ux' import Listr = require('listr') import * as notifier from 'node-notifier' -import { accessToken, cheNamespace } from '../../common-flags' +import { accessToken, cheNamespace, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' import { WorkspaceTasks } from '../../tasks/workspace-tasks' @@ -30,6 +30,7 @@ export default class Start extends Command { }), 'access-token': accessToken, chenamespace: cheNamespace, + 'skip-kubernetes-health-check': skipKubeHealthzCheck } static args = [ diff --git a/src/commands/workspace/stop.ts b/src/commands/workspace/stop.ts index 6289baa4d..e7d4047cb 100644 --- a/src/commands/workspace/stop.ts +++ b/src/commands/workspace/stop.ts @@ -13,7 +13,7 @@ import { cli } from 'cli-ux' import Listr = require('listr') import * as notifier from 'node-notifier' -import { accessToken, cheNamespace } from '../../common-flags' +import { accessToken, cheNamespace, skipKubeHealthzCheck } from '../../common-flags' import { CheTasks } from '../../tasks/che' import { ApiTasks } from '../../tasks/platforms/api' import { WorkspaceTasks } from '../../tasks/workspace-tasks' @@ -25,6 +25,7 @@ export default class Stop extends Command { help: flags.help({ char: 'h' }), 'access-token': accessToken, chenamespace: cheNamespace, + 'skip-kubernetes-health-check': skipKubeHealthzCheck } static args = [ diff --git a/src/common-flags.ts b/src/common-flags.ts index c288e70a6..3474a7369 100644 --- a/src/common-flags.ts +++ b/src/common-flags.ts @@ -7,7 +7,7 @@ * * SPDX-License-Identifier: EPL-2.0 **********************************************************************/ -import { string } from '@oclif/parser/lib/flags' +import { boolean, string } from '@oclif/parser/lib/flags' export const cheNamespace = string({ char: 'n', @@ -32,3 +32,8 @@ export const accessToken = string({ description: 'Eclipse Che OIDC Access Token', env: 'CHE_ACCESS_TOKEN' }) + +export const skipKubeHealthzCheck = boolean({ + description: 'Skip Kubernetes health check', + default: false +}) diff --git a/src/tasks/platforms/api.ts b/src/tasks/platforms/api.ts index 78fcc7877..5926523b4 100644 --- a/src/tasks/platforms/api.ts +++ b/src/tasks/platforms/api.ts @@ -22,16 +22,18 @@ export class ApiTasks { let kube = new KubeHelper(flags) return { title: 'Verify Kubernetes API', + skip: () => flags['skip-kubernetes-health-check'], task: async (ctx: any, task: any) => { try { await kube.checkKubeApi() - ctx.isOpenShift = await kube.isOpenShift() task.title = await `${task.title}...OK` + + ctx.isOpenShift = await kube.isOpenShift() if (ctx.isOpenShift) { task.title = await `${task.title} (it's OpenShift)` } } catch (error) { - command.error(`Failed to connect to Kubernetes API. ${error.message}`) + command.error(`Failed to connect to Kubernetes API, error: ${error.message}. If you're sure that your Kubernetes cluster is healthy - you can skip this check with '--skip-kubernetes-health-check' flag.`) } } } diff --git a/src/tasks/platforms/docker-desktop.ts b/src/tasks/platforms/docker-desktop.ts index 7e4fd5b21..dc892b4c4 100644 --- a/src/tasks/platforms/docker-desktop.ts +++ b/src/tasks/platforms/docker-desktop.ts @@ -50,6 +50,7 @@ export class DockerDesktopTasks { }, { title: 'Verify remote kubernetes status', + skip: () => flags['skip-kubernetes-health-check'], task: async (_ctx: any, task: any) => { try { await this.kh.checkKubeApi() diff --git a/src/tasks/platforms/k8s.ts b/src/tasks/platforms/k8s.ts index b44199b5f..f7d343413 100644 --- a/src/tasks/platforms/k8s.ts +++ b/src/tasks/platforms/k8s.ts @@ -33,6 +33,7 @@ export class K8sTasks { }, { title: 'Verify remote kubernetes status', + skip: () => flags['skip-kubernetes-health-check'], task: async (_ctx: any, task: any) => { const kh = new KubeHelper(flags) try { diff --git a/yarn.lock b/yarn.lock index 88ec6ef78..894b9dd5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1521,12 +1521,11 @@ ecc-jsbn@~0.1.1: "eclipse-che-operator@git://github.com/eclipse/che-operator#master": version "0.0.0" - resolved "git://github.com/eclipse/che-operator#bc47b7b1afc6a255bcec1a27a9a6cf36b1ad7e5f" + resolved "git://github.com/eclipse/che-operator#b0a62e0f4de376a7aa4e260ce1b1774bc32d2784" "eclipse-che@git://github.com/eclipse/che#master": version "0.0.0" - uid a9ae197a5ee39cc6870cb1c4a5802612ac046134 - resolved "git://github.com/eclipse/che#a9ae197a5ee39cc6870cb1c4a5802612ac046134" + resolved "git://github.com/eclipse/che#3a31ab8f59c02c57d225dd2ccb151d025784e0aa" editorconfig@^0.15.0: version "0.15.3"