Skip to content

Commit

Permalink
Removes --installer helm option (#1787)
Browse files Browse the repository at this point in the history
* chore: warn user if DevWorkspace is enabled on k8s

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha authored Nov 2, 2021
1 parent aa964ec commit 8ca24f4
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 609 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/e2e-minikube-helm.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/e2e-minikube-olm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
name: Minikube E2E
on: pull_request
jobs:
minikube-e2e-helm:
minikube-e2e-olm:
name: OLM installer
runs-on: ubuntu-20.04
steps:
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ _See code: [src/commands/server/debug.ts](https://github.com/che-incubator/chect

## `chectl server:delete`

delete any Eclipse Che related resource: Kubernetes/OpenShift/Helm
delete any Eclipse Che related resource: Kubernetes/OpenShift

```
USAGE
Expand Down Expand Up @@ -485,7 +485,7 @@ USAGE
$ chectl server:deploy
OPTIONS
-a, --installer=helm|operator|olm
-a, --installer=operator|olm
Installer type. If not set, default is "olm" for OpenShift 4.x platform otherwise "operator".
-b, --domain=domain
Expand Down Expand Up @@ -566,11 +566,6 @@ OPTIONS
--devfile-registry-url=devfile-registry-url
The URL of the external Devfile registry.
--helm-patch-yaml=helm-patch-yaml
Path to yaml file with Helm Chart values patch.
The file format is identical to values.yaml from the chart.
Note, Provided command line arguments take precedence over patch file.
--k8spoddownloadimagetimeout=k8spoddownloadimagetimeout
[default: 600000] Waiting time for Pod downloading image (in milliseconds)
Expand Down
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"countries-and-timezones": "^3.2.3",
"debug": "^4.3.2",
"eclipse-che-operator": "git://github.com/eclipse-che/che-operator#main",
"eclipse-che-server": "git://github.com/eclipse-che/che-server#main",
"esprima": "^4.0.1",
"execa": "^5.1.1",
"fancy-test": "^1.4.9",
Expand Down Expand Up @@ -151,15 +150,12 @@
},
"repository": "che-incubator/chectl",
"scripts": {
"postinstall": "npm run -s postinstall-repositories && npm run -s postinstall-helm && npm run -s postinstall-cert-manager && npm run -s postinstall-operator && npm run -s postinstall-cleanup",
"postinstall-helm": "rimraf templates/kubernetes && cpx 'node_modules/eclipse-che-server/deploy/kubernetes/**' 'templates/kubernetes'",
"postinstall-cert-manager": "rimraf templates/cert-manager && cpx 'node_modules/eclipse-che-server/deploy/cert-manager/**' 'templates/cert-manager'",
"postinstall": "npm run -s postinstall-repositories && npm run -s postinstall-operator && npm run -s postinstall-cleanup",
"postinstall-operator": "node prepare-che-operator-templates.js",
"postinstall-repositories": "yarn upgrade eclipse-che-server eclipse-che-operator",
"postinstall-cleanup": "rimraf node_modules/eclipse-che-server && rimraf node_modules/eclipse-che-operator",
"postinstall-repositories": "yarn upgrade eclipse-che-operator",
"postinstall-cleanup": "rimraf node_modules/eclipse-che-operator",
"test": "jest --collect-coverage",
"test-watch": "jest --watchAll",
"e2e-minikube-helm": "export PLATFORM=minikube && export INSTALLER=helm && yarn jest ./test/e2e/e2e.test.ts --testRegex='/test/(e2e)/.*.test.ts'",
"e2e-minikube-operator": "export PLATFORM=minikube && export INSTALLER=operator && yarn jest ./test/e2e/e2e.test.ts --testRegex='/test/(e2e)/.*.test.ts'",
"e2e-minishift": "export PLATFORM=minishift && export INSTALLER=operator && yarn jest ./test/e2e/e2e.test.ts --testRegex='/test/(e2e)/.*.test.ts'",
"e2e-openshift": "export PLATFORM=openshift && export INSTALLER=operator && yarn jest ./test/e2e/e2e.test.ts --testRegex='/test/(e2e)/.*.test.ts'",
Expand Down
1 change: 0 additions & 1 deletion src/api/che.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ export class CheHelper {
if (installer === 'operator') {
destDir = path.join(destDir, OPERATOR_TEMPLATE_DIR)
}
// No need to add kubernetes folder for Helm installer as it already present in the archive

const tempDir = path.join(os.tmpdir(), Date.now().toString())
await fs.mkdirp(tempDir)
Expand Down
3 changes: 0 additions & 3 deletions src/api/github-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { Octokit } from '@octokit/rest'
export const ECLIPSE_CHE_ORG = 'eclipse-che'
export const ECLIPSE_CHE_INCUBATOR_ORG = 'che-incubator'

export const CHE_REPO = 'che-server'
export const CHE_OPERATOR_REPO = 'che-operator'
export const CHECTL_REPO = 'chectl'

Expand Down Expand Up @@ -45,8 +44,6 @@ export class CheGithubClient {
async getTemplatesTagInfo(installer: string, version?: string): Promise<TagInfo | undefined> {
if (installer === 'operator' || installer === 'olm') {
return this.getTagInfoByVersion(ECLIPSE_CHE_ORG, CHE_OPERATOR_REPO, version)
} else if (installer === 'helm') {
return this.getTagInfoByVersion(ECLIPSE_CHE_ORG, CHE_REPO, version)
}
throw new Error(`Unsupported installer: ${installer}`)
}
Expand Down
5 changes: 0 additions & 5 deletions src/api/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const A_DAY_IN_MS = 24 * 60 * 60 * 1000
export namespace VersionHelper {
export const MINIMAL_OPENSHIFT_VERSION = '3.11'
export const MINIMAL_K8S_VERSION = '1.19'
export const MINIMAL_HELM_VERSION = '2.15'
export const CHE_POD_MANIFEST_FILE = '/home/user/eclipse-che/tomcat/webapps/ROOT/META-INF/MANIFEST.MF'
export const CHE_PREFFIX_VERSION = 'Implementation-Version: '

Expand Down Expand Up @@ -116,10 +115,6 @@ export namespace VersionHelper {
return checkMinimalVersion(actualVersion, MINIMAL_OPENSHIFT_VERSION)
}

export function checkMinimalHelmVersion(actualVersion: string): boolean {
return checkMinimalVersion(actualVersion, MINIMAL_HELM_VERSION)
}

/**
* Compare versions and return true if actual version is greater or equal to minimal.
* The comparison will be done by major and minor versions.
Expand Down
5 changes: 1 addition & 4 deletions src/commands/server/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ import { assumeYes, batch, cheDeployment, cheNamespace, CHE_TELEMETRY, listrRend
import { DEFAULT_ANALYTIC_HOOK_NAME } from '../../constants'
import { CheTasks } from '../../tasks/che'
import { DevWorkspaceTasks } from '../../tasks/component-installers/devfile-workspace-operator-installer'
import { HelmTasks } from '../../tasks/installers/helm'
import { OLMTasks } from '../../tasks/installers/olm'
import { OperatorTasks } from '../../tasks/installers/operator'
import { ApiTasks } from '../../tasks/platforms/api'
import { findWorkingNamespace, getCommandSuccessMessage, notifyCommandCompletedSuccessfully, wrapCommandError } from '../../util'

export default class Delete extends Command {
static description = 'delete any Eclipse Che related resource: Kubernetes/OpenShift/Helm'
static description = 'delete any Eclipse Che related resource: Kubernetes/OpenShift'

static flags: flags.Input<any> = {
help: flags.help({ char: 'h' }),
Expand Down Expand Up @@ -66,7 +65,6 @@ export default class Delete extends Command {

const apiTasks = new ApiTasks()
const kube = new KubeHelper(flags)
const helmTasks = new HelmTasks(flags)
const operatorTasks = new OperatorTasks()
const olmTasks = new OLMTasks()
const cheTasks = new CheTasks(flags)
Expand All @@ -77,7 +75,6 @@ export default class Delete extends Command {
tasks.add(operatorTasks.deleteTasks(flags))
tasks.add(olmTasks.deleteTasks(flags))
tasks.add(cheTasks.deleteTasks(flags))
tasks.add(helmTasks.deleteTasks(flags))
tasks.add(cheTasks.waitPodsDeletedTasks())

// Remove devworkspace controller only if there are no more cheClusters after olm/operator tasks
Expand Down
25 changes: 5 additions & 20 deletions src/commands/server/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as semver from 'semver'
import { ChectlContext, OLM } from '../../api/context'
import { KubeHelper } from '../../api/kube'
import { batch, cheDeployment, cheDeployVersion, cheNamespace, cheOperatorCRPatchYaml, cheOperatorCRYaml, CHE_OPERATOR_CR_PATCH_YAML_KEY, CHE_OPERATOR_CR_YAML_KEY, CHE_TELEMETRY, DEPLOY_VERSION_KEY, k8sPodDownloadImageTimeout, K8SPODDOWNLOADIMAGETIMEOUT_KEY, k8sPodErrorRecheckTimeout, K8SPODERRORRECHECKTIMEOUT_KEY, k8sPodReadyTimeout, K8SPODREADYTIMEOUT_KEY, k8sPodWaitTimeout, K8SPODWAITTIMEOUT_KEY, listrRenderer, logsDirectory, LOG_DIRECTORY_KEY, skipKubeHealthzCheck as skipK8sHealthCheck } from '../../common-flags'
import { DEFAULT_ANALYTIC_HOOK_NAME, DEFAULT_CHE_NAMESPACE, DEFAULT_OLM_SUGGESTED_NAMESPACE, DOCS_LINK_INSTALL_RUNNING_CHE_LOCALLY, MIN_CHE_OPERATOR_INSTALLER_VERSION, MIN_HELM_INSTALLER_VERSION, MIN_OLM_INSTALLER_VERSION, OLM_STABLE_ALL_NAMESPACES_CHANNEL_NAME } from '../../constants'
import { DEFAULT_ANALYTIC_HOOK_NAME, DEFAULT_CHE_NAMESPACE, DEFAULT_OLM_SUGGESTED_NAMESPACE, DOCS_LINK_INSTALL_RUNNING_CHE_LOCALLY, MIN_CHE_OPERATOR_INSTALLER_VERSION, MIN_OLM_INSTALLER_VERSION, OLM_STABLE_ALL_NAMESPACES_CHANNEL_NAME } from '../../constants'
import { CheTasks } from '../../tasks/che'
import { DevWorkspaceTasks } from '../../tasks/component-installers/devfile-workspace-operator-installer'
import { DexTasks } from '../../tasks/component-installers/dex'
Expand Down Expand Up @@ -97,7 +97,7 @@ export default class Deploy extends Command {
installer: string({
char: 'a',
description: 'Installer type. If not set, default is "olm" for OpenShift 4.x platform otherwise "operator".',
options: ['helm', 'operator', 'olm'],
options: ['operator', 'olm'],
}),
domain: string({
char: 'b',
Expand All @@ -118,12 +118,6 @@ export default class Deploy extends Command {
}),
[CHE_OPERATOR_CR_YAML_KEY]: cheOperatorCRYaml,
[CHE_OPERATOR_CR_PATCH_YAML_KEY]: cheOperatorCRPatchYaml,
'helm-patch-yaml': string({
description: `Path to yaml file with Helm Chart values patch.
The file format is identical to values.yaml from the chart.
Note, Provided command line arguments take precedence over patch file.`,
default: '',
}),
'workspace-pvc-storage-class-name': string({
description: 'persistent volume(s) storage class name to use to store Eclipse Che workspaces data',
env: 'CHE_INFRA_KUBERNETES_PVC_STORAGE__CLASS__NAME',
Expand Down Expand Up @@ -251,12 +245,6 @@ export default class Deploy extends Command {
this.warn('"--domain" flag is ignored for Openshift family infrastructures. It should be done on the cluster level.')
}

if (flags.installer === 'helm') {
if (!isKubernetesPlatformFamily(flags.platform) && flags.platform !== 'docker-desktop') {
this.error(`🛑 Current platform is ${flags.platform}. Helm installer is only available on top of Kubernetes flavor platform (including Minikube, Docker Desktop).`)
}
}

if (flags.installer === 'olm') {
// OLM installer only checks
if (flags.platform === 'minishift') {
Expand Down Expand Up @@ -320,9 +308,6 @@ export default class Deploy extends Command {
case 'operator':
minAllowedVersion = MIN_CHE_OPERATOR_INSTALLER_VERSION
break
case 'helm':
minAllowedVersion = MIN_HELM_INSTALLER_VERSION
break
default:
// Should never happen
minAllowedVersion = 'latest'
Expand Down Expand Up @@ -354,8 +339,8 @@ export default class Deploy extends Command {
await this.setPlaformDefaults(flags, ctx)
await this.config.runHook(DEFAULT_ANALYTIC_HOOK_NAME, { command: Deploy.id, flags })

if (!flags.batch && flags.installer === 'helm') {
if (!await cli.confirm('\'helm\' installer is deprecated. Do you want to proceed? [y/n]')) {
if (!flags.batch && isKubernetesPlatformFamily(flags.platform) && (isDevWorkspaceEnabled(ctx) || flags['workspace-engine'] === 'dev-workspace')) {
if (!await cli.confirm('DevWorkspace is experimental feature. It requires direct access to the underlying infrastructure REST API.\nThis results in huge privilege escalation. Do you want to proceed? [y/n]')) {
cli.exit(0)
}
}
Expand Down Expand Up @@ -388,7 +373,7 @@ export default class Deploy extends Command {
preInstallTasks.add({
title: '🧪 DevWorkspace engine (experimental / technology preview) 🚨',
enabled: () => (isDevWorkspaceEnabled(ctx) || flags['workspace-engine'] === 'dev-workspace') && !ctx.isOpenShift,
task: () => new Listr(devWorkspaceTasks.getInstallTasks(flags)),
task: () => new Listr(devWorkspaceTasks.getInstallTasks()),
})

const installTasks = new Listr(undefined, ctx.listrOptions)
Expand Down
1 change: 0 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const OPERATOR_TEMPLATE_DIR = 'che-operator'
// minimal installable versions by current chectl
export const MIN_OLM_INSTALLER_VERSION = '7.17.0'
export const MIN_CHE_OPERATOR_INSTALLER_VERSION = '7.13.1'
export const MIN_HELM_INSTALLER_VERSION = '7.10.0'

// labels
export const CHE_RELATED_COMPONENT_LABEL = 'client/org.eclipse.che=true'
Expand Down
2 changes: 0 additions & 2 deletions src/tasks/che.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export class CheTasks {
title: `Verify if Eclipse Che is deployed into namespace \"${this.cheNamespace}\"`,
task: async (ctx: any, task: any) => {
if (await this.kube.isDeploymentExist(this.cheDeploymentName, this.cheNamespace)) {
// helm chart and Eclipse Che operator use a deployment
ctx.isCheDeployed = true
ctx.isCheReady = await this.kube.deploymentReady(this.cheDeploymentName, this.cheNamespace)
if (!ctx.isCheReady) {
Expand Down Expand Up @@ -595,7 +594,6 @@ export class CheTasks {
return [
{
title: `${follow ? 'Start following' : 'Read'} Operator logs`,
skip: () => flags.installer === 'helm',
task: async (ctx: any, task: any) => {
await this.che.readPodLog(flags.chenamespace, CHE_OPERATOR_SELECTOR, ctx.directory, follow)
task.title = `${task.title}...done`
Expand Down
10 changes: 3 additions & 7 deletions src/tasks/component-installers/cert-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class CertManagerTasks {
/**
* Verify if cert-manager is installed in cluster
*/
getDeployCertManagerTasks(flags: any): ReadonlyArray<Listr.ListrTask> {
getDeployCertManagerTasks(): ReadonlyArray<Listr.ListrTask> {
return [
{
title: 'Check Cert Manager deployment',
Expand All @@ -55,12 +55,8 @@ export class CertManagerTasks {
title: 'Deploy Cert Manager',
enabled: ctx => !ctx.certManagerInstalled,
task: async (ctx: any, task: any) => {
let yamlPath = path.join(flags.templates, 'cert-manager', 'cert-manager.yaml')
if (!await fs.pathExists(yamlPath)) {
// Older Che versions don't have Cert Manager install yaml in templates
// Try to use embedded in chectl version
yamlPath = path.join(getEmbeddedTemplatesDirectory(), '..', 'resources', 'cert-manager.yml')
}
const yamlPath = path.join(getEmbeddedTemplatesDirectory(), '..', 'resources', 'cert-manager.yml')

// Apply additional --validate=false flag to be able to deploy Cert Manager on Kubernetes v1.15.4 or below
await this.kubeHelper.applyResource(yamlPath, '--validate=false')
ctx.certManagerInstalled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ export class DevWorkspaceTasks {
/**
* Returns list of tasks which setup dev-workspace.
*/
getInstallTasks(flags: any): ReadonlyArray<Listr.ListrTask> {
getInstallTasks(): ReadonlyArray<Listr.ListrTask> {
return [
{
title: 'Verify cert-manager installation',
enabled: (ctx: any) => !ctx.isOpenShift,
task: async (ctx: any, _task: any) => {
return new Listr(this.certManagerTask.getDeployCertManagerTasks(flags), ctx.listrOptions)
return new Listr(this.certManagerTask.getDeployCertManagerTasks(), ctx.listrOptions)
},
},
]
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/component-installers/dex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class DexTasks {

if (!await this.kube.getSecret(DexTasks.TLS_SECRET_NAME, DexTasks.NAMESPACE_NAME)) {
const certManager = new CertManagerTasks(this.flags)
certs.add(certManager.getDeployCertManagerTasks(this.flags))
certs.add(certManager.getDeployCertManagerTasks())
certs.add(certManager.getGenerateCertManagerCACertificateTasks(this.flags))
certs.add(certManager.getCreateCertificateIssuerTasks(this.flags))

Expand Down
5 changes: 1 addition & 4 deletions src/tasks/installers/common-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ export function downloadTemplates(flags: any): Listr.ListrTask {
case 'operator':
installerTemplatesSubDir = OPERATOR_TEMPLATE_DIR
break
case 'helm':
installerTemplatesSubDir = 'kubernetes'
break
case 'olm':
// Should be handled on install phase when catalog source is deployed
return
Expand Down Expand Up @@ -183,7 +180,7 @@ export function retrieveCheCaCertificateTask(flags: any): Listr.ListrTask {
return {
title: 'Retrieving Che self-signed CA certificate',
// It makes sense to retrieve CA certificate only if self-signed certificate is used.
enabled: () => flags.tls && flags.installer !== 'helm',
enabled: () => flags.tls,
task: async (ctx: any, task: any) => {
const che = new CheHelper(flags)
const kube = new KubeHelper()
Expand Down
Loading

0 comments on commit 8ca24f4

Please sign in to comment.