Skip to content

Commit

Permalink
Move cr name to constant
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoliy Bazko <abazko@redhat.com>
  • Loading branch information
tolusha committed Apr 14, 2020
1 parent 0440b5e commit 7905ed1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/commands/server/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as path from 'path'

import { KubeHelper } from '../../api/kube'
import { cheDeployment, cheNamespace, listrRenderer } from '../../common-flags'
import { DEFAULT_CHE_OPERATOR_IMAGE } from '../../constants'
import { CHE_CLUSTER_CR_NAME, DEFAULT_CHE_OPERATOR_IMAGE } from '../../constants'
import { CheTasks } from '../../tasks/che'
import { InstallerTasks } from '../../tasks/installers/installer'
import { ApiTasks } from '../../tasks/platforms/api'
Expand Down Expand Up @@ -159,7 +159,7 @@ export default class Update extends Command {

async setDomainFlag(flags: any): Promise<void> {
const kubeHelper = new KubeHelper()
const cheCluster = await kubeHelper.getCheCluster('eclipse-che', flags.chenamespace)
const cheCluster = await kubeHelper.getCheCluster(CHE_CLUSTER_CR_NAME, flags.chenamespace)
if (cheCluster && cheCluster.spec.k8s && cheCluster.spec.k8s.ingressDomain) {
flags.domain = cheCluster.spec.k8s.ingressDomain
}
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ export const CA_CERT_GENERATION_JOB_IMAGE = 'quay.io/eclipse/che-cert-manager-ca

export const CERT_MANAGER_NAMESPACE_NAME = 'cert-manager'
export const CHE_TLS_SECRET_NAME = 'che-tls'
export const CHE_CLUSTER_CR_NAME = 'eclipse-che'
12 changes: 6 additions & 6 deletions src/tasks/installers/operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as path from 'path'

import { CheHelper } from '../../api/che'
import { KubeHelper } from '../../api/kube'
import { CHE_CLUSTER_CR_NAME } from '../../constants'
import { isKubernetesPlatformFamily } from '../../util'

export class OperatorTasks {
Expand All @@ -29,7 +30,6 @@ export class OperatorTasks {
operatorClusterRoleBinding = 'che-operator'
cheClusterCrd = 'checlusters.org.eclipse.che'
operatorName = 'che-operator'
operatorCheCluster = 'eclipse-che'
resourcesPath = ''

/**
Expand Down Expand Up @@ -226,9 +226,9 @@ export class OperatorTasks {
}
},
{
title: `Create Eclipse Che cluster ${this.operatorCheCluster} in namespace ${flags.chenamespace}`,
title: `Create Eclipse Che cluster ${CHE_CLUSTER_CR_NAME} in namespace ${flags.chenamespace}`,
task: async (ctx: any, task: any) => {
const cheCluster = await kube.getCheCluster(this.operatorCheCluster, flags.chenamespace)
const cheCluster = await kube.getCheCluster(CHE_CLUSTER_CR_NAME, flags.chenamespace)
if (cheCluster) {
task.title = `${task.title}...It already exists.`
} else {
Expand Down Expand Up @@ -427,11 +427,11 @@ export class OperatorTasks {
deleteTasks(flags: any): ReadonlyArray<Listr.ListrTask> {
let kh = new KubeHelper(flags)
return [{
title: `Delete the CR ${this.operatorCheCluster} of type ${this.cheClusterCrd}`,
title: `Delete the CR ${CHE_CLUSTER_CR_NAME} of type ${this.cheClusterCrd}`,
task: async (_ctx: any, task: any) => {
if (await kh.crdExist(this.cheClusterCrd) &&
await kh.getCheCluster(this.operatorCheCluster, flags.chenamespace)) {
await kh.deleteCheCluster(this.operatorCheCluster, flags.chenamespace)
await kh.getCheCluster(CHE_CLUSTER_CR_NAME, flags.chenamespace)) {
await kh.deleteCheCluster(CHE_CLUSTER_CR_NAME, flags.chenamespace)
await cli.wait(2000) //wait a couple of secs for the finalizers to be executed
task.title = await `${task.title}...OK`
} else {
Expand Down

0 comments on commit 7905ed1

Please sign in to comment.