From 0de9ba466631ed7d330aae2680567c702b6b318e Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Tue, 5 Oct 2021 12:33:16 +0300 Subject: [PATCH] fixes Signed-off-by: Anatolii Bazko --- package.json | 2 +- {installers => resources}/cert-manager.yml | 0 .../dex/cluster-role-binding.yaml | 0 .../dex/cluster-role.yaml | 0 {installers => resources}/dex/configmap.yaml | 2 +- {installers => resources}/dex/deployment.yaml | 0 resources/dex/ingress.yaml | 30 ++++ {installers => resources}/dex/namespace.yaml | 0 .../dex/service-account.yaml | 0 {installers => resources}/dex/service.yaml | 3 - .../prometheus-role-binding.yaml | 0 .../prometheus-role.yaml | 0 src/api/che.ts | 4 +- src/api/kube.ts | 147 ++++++++++-------- .../component-installers/cert-manager.ts | 4 +- src/tasks/component-installers/dex.ts | 71 +++++++-- src/tasks/installers/olm.ts | 4 +- test/api/che.test.ts | 12 +- test/e2e/util.ts | 2 +- 19 files changed, 187 insertions(+), 94 deletions(-) rename {installers => resources}/cert-manager.yml (100%) rename {installers => resources}/dex/cluster-role-binding.yaml (100%) rename {installers => resources}/dex/cluster-role.yaml (100%) rename {installers => resources}/dex/configmap.yaml (95%) rename {installers => resources}/dex/deployment.yaml (100%) create mode 100644 resources/dex/ingress.yaml rename {installers => resources}/dex/namespace.yaml (100%) rename {installers => resources}/dex/service-account.yaml (100%) rename {installers => resources}/dex/service.yaml (75%) rename {installers => resources}/prometheus-role-binding.yaml (100%) rename {installers => resources}/prometheus-role.yaml (100%) diff --git a/package.json b/package.json index 4946a7637..4c4ad75c5 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "files": [ "/bin", "/lib", - "/installers", + "/resources", "/npm-shrinkwrap.json", "/oclif.manifest.json", "/prepare-che-operator-templates.js" diff --git a/installers/cert-manager.yml b/resources/cert-manager.yml similarity index 100% rename from installers/cert-manager.yml rename to resources/cert-manager.yml diff --git a/installers/dex/cluster-role-binding.yaml b/resources/dex/cluster-role-binding.yaml similarity index 100% rename from installers/dex/cluster-role-binding.yaml rename to resources/dex/cluster-role-binding.yaml diff --git a/installers/dex/cluster-role.yaml b/resources/dex/cluster-role.yaml similarity index 100% rename from installers/dex/cluster-role.yaml rename to resources/dex/cluster-role.yaml diff --git a/installers/dex/configmap.yaml b/resources/dex/configmap.yaml similarity index 95% rename from installers/dex/configmap.yaml rename to resources/dex/configmap.yaml index 1a9747099..ffb379973 100644 --- a/installers/dex/configmap.yaml +++ b/resources/dex/configmap.yaml @@ -7,7 +7,7 @@ metadata: app: dex data: config.yaml: | - issuer: https://dex.{{DOMAIN}}:32000 + issuer: https://dex.{{DOMAIN}} storage: type: kubernetes config: diff --git a/installers/dex/deployment.yaml b/resources/dex/deployment.yaml similarity index 100% rename from installers/dex/deployment.yaml rename to resources/dex/deployment.yaml diff --git a/resources/dex/ingress.yaml b/resources/dex/ingress.yaml new file mode 100644 index 000000000..0f5383689 --- /dev/null +++ b/resources/dex/ingress.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: dex + namespace: dex + labels: + app: dex + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/proxy-connect-timeout: "3600" + nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" + nginx.ingress.kubernetes.io/ssl-redirect: "true" +spec: + rules: + - host: dex.{{DOMAIN}} + http: + paths: + - backend: + service: + name: dex + port: + number: 5556 + path: / + pathType: ImplementationSpecific + tls: + - hosts: + - dex.{{DOMAIN}} + secretName: dex.tls + diff --git a/installers/dex/namespace.yaml b/resources/dex/namespace.yaml similarity index 100% rename from installers/dex/namespace.yaml rename to resources/dex/namespace.yaml diff --git a/installers/dex/service-account.yaml b/resources/dex/service-account.yaml similarity index 100% rename from installers/dex/service-account.yaml rename to resources/dex/service-account.yaml diff --git a/installers/dex/service.yaml b/resources/dex/service.yaml similarity index 75% rename from installers/dex/service.yaml rename to resources/dex/service.yaml index 38315ab5c..618522798 100644 --- a/installers/dex/service.yaml +++ b/resources/dex/service.yaml @@ -7,12 +7,9 @@ metadata: labels: app: dex spec: - type: NodePort ports: - name: dex port: 5556 protocol: TCP - targetPort: 5556 - nodePort: 32000 selector: app: dex diff --git a/installers/prometheus-role-binding.yaml b/resources/prometheus-role-binding.yaml similarity index 100% rename from installers/prometheus-role-binding.yaml rename to resources/prometheus-role-binding.yaml diff --git a/installers/prometheus-role.yaml b/resources/prometheus-role.yaml similarity index 100% rename from installers/prometheus-role.yaml rename to resources/prometheus-role.yaml diff --git a/src/api/che.ts b/src/api/che.ts index 35bd05a99..f9a8003cb 100644 --- a/src/api/che.ts +++ b/src/api/che.ts @@ -222,7 +222,7 @@ export class CheHelper { } async chePluginRegistryK8sURL(namespace = ''): Promise { - if (await this.kube.ingressExist('plugin-registry', namespace)) { + if (await this.kube.isIngressExist('plugin-registry', namespace)) { const protocol = await this.kube.getIngressProtocol('plugin-registry', namespace) const hostname = await this.kube.getIngressHost('plugin-registry', namespace) return `${protocol}://${hostname}` @@ -242,7 +242,7 @@ export class CheHelper { async cheK8sURL(namespace = ''): Promise { const ingress_names = ['che', 'che-ingress'] for (const ingress_name of ingress_names) { - if (await this.kube.ingressExist(ingress_name, namespace)) { + if (await this.kube.isIngressExist(ingress_name, namespace)) { const protocol = await this.kube.getIngressProtocol(ingress_name, namespace) const hostname = await this.kube.getIngressHost(ingress_name, namespace) return `${protocol}://${hostname}` diff --git a/src/api/kube.ts b/src/api/kube.ts index 40163e730..50cf982ee 100644 --- a/src/api/kube.ts +++ b/src/api/kube.ts @@ -10,7 +10,7 @@ * Red Hat, Inc. - initial API and implementation */ -import { AdmissionregistrationV1Api, ApiextensionsV1Api, ApiextensionsV1beta1Api, ApisApi, AppsV1Api, AuthorizationV1Api, BatchV1Api, CoreV1Api, CustomObjectsApi, KubeConfig, Log, NetworkingV1Api, PortForward, RbacAuthorizationV1Api, V1ClusterRole, V1ClusterRoleBinding, V1ClusterRoleBindingList, V1ConfigMap, V1ConfigMapEnvSource, V1Container, V1ContainerStateTerminated, V1ContainerStateWaiting, V1Deployment, V1DeploymentList, V1DeploymentSpec, V1EnvFromSource, V1IngressList, V1Job, V1JobSpec, V1LabelSelector, V1MutatingWebhookConfiguration, V1Namespace, V1NamespaceList, V1ObjectMeta, V1PersistentVolumeClaimList, V1Pod, V1PodCondition, V1PodList, V1PodSpec, V1PodTemplateSpec, V1PolicyRule, V1Role, V1RoleBinding, V1RoleBindingList, V1RoleList, V1RoleRef, V1Secret, V1SelfSubjectAccessReview, V1SelfSubjectAccessReviewSpec, V1Service, V1ServiceAccount, V1ServiceList, V1Subject, Watch } from '@kubernetes/client-node' +import { AdmissionregistrationV1Api, ApiextensionsV1Api, ApiextensionsV1beta1Api, ApisApi, AppsV1Api, AuthorizationV1Api, BatchV1Api, CoreV1Api, CustomObjectsApi, KubeConfig, Log, NetworkingV1Api, PortForward, RbacAuthorizationV1Api, V1ClusterRole, V1ClusterRoleBinding, V1ClusterRoleBindingList, V1ConfigMap, V1ConfigMapEnvSource, V1Container, V1ContainerStateTerminated, V1ContainerStateWaiting, V1Deployment, V1DeploymentList, V1DeploymentSpec, V1EnvFromSource, V1Ingress, V1IngressList, V1Job, V1JobSpec, V1LabelSelector, V1MutatingWebhookConfiguration, V1Namespace, V1NamespaceList, V1ObjectMeta, V1PersistentVolumeClaimList, V1Pod, V1PodCondition, V1PodList, V1PodSpec, V1PodTemplateSpec, V1PolicyRule, V1Role, V1RoleBinding, V1RoleBindingList, V1RoleList, V1RoleRef, V1Secret, V1SelfSubjectAccessReview, V1SelfSubjectAccessReviewSpec, V1Service, V1ServiceAccount, V1ServiceList, V1Subject, Watch } from '@kubernetes/client-node' import { Cluster, Context } from '@kubernetes/client-node/dist/config_types' import axios, { AxiosRequestConfig } from 'axios' import { cli } from 'cli-ux' @@ -179,25 +179,25 @@ export class KubeHelper { // Set up watcher const watcher = new Watch(this.kubeConfig) const request = await watcher - .watch(`/api/v1/namespaces/${namespace}/serviceaccounts`, {}, - (_phase: string, obj: any) => { - const serviceAccount = obj as V1ServiceAccount + .watch(`/api/v1/namespaces/${namespace}/serviceaccounts`, {}, + (_phase: string, obj: any) => { + const serviceAccount = obj as V1ServiceAccount - // Filter other service accounts in the given namespace - if (serviceAccount && serviceAccount.metadata && serviceAccount.metadata.name === name) { - // The service account is present, stop watching - if (request) { - request.abort() + // Filter other service accounts in the given namespace + if (serviceAccount && serviceAccount.metadata && serviceAccount.metadata.name === name) { + // The service account is present, stop watching + if (request) { + request.abort() + } + // Release awaiter + resolve() } - // Release awaiter - resolve() - } - }, - error => { - if (error) { - reject(error) - } - }) + }, + error => { + if (error) { + reject(error) + } + }) // Automatically stop watching after timeout const timeoutHandler = setTimeout(() => { @@ -1399,28 +1399,28 @@ export class KubeHelper { // Set up watcher const watcher = new Watch(this.kubeConfig) const request = await watcher - .watch(`/apis/batch/v1/namespaces/${namespace}/jobs/`, {}, - (_phase: string, obj: any) => { - const job = obj as V1Job - - // Filter other jobs in the given namespace - if (job && job.metadata && job.metadata.name === jobName) { - // Check job status - if (job.status && job.status.succeeded && job.status.succeeded >= 1) { - // Job is finished, stop watching - if (request) { - request.abort() + .watch(`/apis/batch/v1/namespaces/${namespace}/jobs/`, {}, + (_phase: string, obj: any) => { + const job = obj as V1Job + + // Filter other jobs in the given namespace + if (job && job.metadata && job.metadata.name === jobName) { + // Check job status + if (job.status && job.status.succeeded && job.status.succeeded >= 1) { + // Job is finished, stop watching + if (request) { + request.abort() + } + // Release awaiter + resolve() } - // Release awaiter - resolve() } - } - }, - error => { - if (error) { - reject(error) - } - }) + }, + error => { + if (error) { + reject(error) + } + }) // Automatically stop watching after timeout const timeoutHandler = setTimeout(() => { @@ -1460,12 +1460,29 @@ export class KubeHelper { } } - async ingressExist(name: string, namespace: string): Promise { + async createIngressFromFile(filePath: string, namespace: string) { + const yamlIngress = this.safeLoadFromYamlFile(filePath) as V1Ingress + return this.createIngressFromObj(yamlIngress, namespace) + } + + async createIngressFromObj(ingress: V1Ingress, namespace: string) { const networkingV1Api = this.kubeConfig.makeApiClient(NetworkingV1Api) try { - const { body } = await networkingV1Api.readNamespacedIngress(name, namespace) - return this.compare(body, name) - } catch { + return await networkingV1Api.createNamespacedIngress(namespace, ingress) + } catch (e) { + throw this.wrapK8sClientError(e) + } + } + + async isIngressExist(name: string, namespace: string): Promise { + const networkingV1Api = this.kubeConfig.makeApiClient(NetworkingV1Api) + try { + await networkingV1Api.readNamespacedIngress(name, namespace) + return true + } catch (e) { + if (e.response && e.response.statusCode === 404) { + return false + } return false } } @@ -2730,32 +2747,32 @@ export class KubeHelper { // Set up watcher const watcher = new Watch(this.kubeConfig) const request = await watcher - .watch(`/api/v1/namespaces/${namespace}/secrets/`, { fieldSelector: `metadata.name=${secretName}` }, - (_phase: string, obj: any) => { - const secret = obj as V1Secret - - // Check all required data fields to be present - if (dataKeys.length > 0 && secret.data) { - for (const key of dataKeys) { - if (!secret.data[key]) { - // Key is missing or empty - return + .watch(`/api/v1/namespaces/${namespace}/secrets/`, { fieldSelector: `metadata.name=${secretName}` }, + (_phase: string, obj: any) => { + const secret = obj as V1Secret + + // Check all required data fields to be present + if (dataKeys.length > 0 && secret.data) { + for (const key of dataKeys) { + if (!secret.data[key]) { + // Key is missing or empty + return + } } } - } - // The secret with all specified fields is present, stop watching - if (request) { - request.abort() - } - // Release awaiter - resolve() - }, - error => { - if (error) { - reject(error) - } - }) + // The secret with all specified fields is present, stop watching + if (request) { + request.abort() + } + // Release awaiter + resolve() + }, + error => { + if (error) { + reject(error) + } + }) // Automatically stop watching after timeout const timeoutHandler = setTimeout(() => { diff --git a/src/tasks/component-installers/cert-manager.ts b/src/tasks/component-installers/cert-manager.ts index f8c7d7ff8..518fe36ed 100644 --- a/src/tasks/component-installers/cert-manager.ts +++ b/src/tasks/component-installers/cert-manager.ts @@ -59,7 +59,7 @@ export class CertManagerTasks { 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(), '..', 'installers', 'cert-manager.yml') + 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') @@ -195,7 +195,7 @@ export class CertManagerTasks { namespace: string): ReadonlyArray { return [ { - title: 'Request certificate', + title: `Request certificate for dnsNames: [${dnsNames}]`, task: async (ctx: any, task: any) => { if (ctx.cheCertificateExists) { throw new Error('Eclipse Che certificate already exists.') diff --git a/src/tasks/component-installers/dex.ts b/src/tasks/component-installers/dex.ts index 7c7f12402..8015913e0 100644 --- a/src/tasks/component-installers/dex.ts +++ b/src/tasks/component-installers/dex.ts @@ -10,7 +10,7 @@ * Red Hat, Inc. - initial API and implementation */ -import { V1ConfigMap } from '@kubernetes/client-node' +import { V1ConfigMap, V1Ingress, V1ObjectMeta } from '@kubernetes/client-node' import { cli } from 'cli-ux' import * as crypto from 'crypto' import * as fs from 'fs-extra' @@ -33,6 +33,15 @@ namespace TemplatePlaceholders { export const CLIENT_SECRET = '{{CLIENT_SECRET}}' } +namespace DexContextKeys { + export const DEX_CA_CRT = 'dex-ca.crt' +} + +namespace ConfigMapDexCA { + export const NAME = 'dex-ca' + export const LABELS = { 'app.kubernetes.io/part-of': 'che.eclipse.org', 'app.kubernetes.io/component': 'ca-bundle' } +} + export class DexTasks { protected clientId = 'eclipse-che' @@ -78,7 +87,7 @@ export class DexTasks { }, }, { - title: 'Create Dex certificate', + title: 'Provide Dex certificate', task: async (ctx: any) => { const certs = new Listr(undefined, ctx.listrOptions) @@ -95,16 +104,39 @@ export class DexTasks { } certs.add([{ - title: 'Save Dex certificate', - task: async (_ctx: any, task: any) => { + title: 'Read Dex certificate', + task: async (ctx: any, task: any) => { const secret = await this.kube.getSecret(this.tlsSecretName, this.namespaceName) if (secret && secret.data) { - const caCrt = base64Decode(secret.data['ca.crt']) - const dexCaCertificateFilePath = this.getDexCaCertificateFilePath() - await this.che.saveCaCert(caCrt, dexCaCertificateFilePath) - task.title = `${task.title}...[OK: ${dexCaCertificateFilePath}]` + ctx[DexContextKeys.DEX_CA_CRT] = base64Decode(secret.data['ca.crt']) + task.title = `${task.title}...[OK]` + } else { + throw new Error(`Dex certificate not found in the secret '${this.tlsSecretName}' in the namespace '${this.namespaceName}'.`) + } + }, + }, + { + title: 'Save Dex certificate', + task: async (ctx: any, task: any) => { + const dexCaCertificateFilePath = this.getDexCaCertificateFilePath() + await this.che.saveCaCert(ctx[DexContextKeys.DEX_CA_CRT], dexCaCertificateFilePath) + task.title = `${task.title}...[OK: ${dexCaCertificateFilePath}]` + }, + }, + { + title: 'Add Dex certificate to Eclipse Che certificates bundle', + task: async (ctx: any, task: any) => { + if (await this.kube.isConfigMapExists(ConfigMapDexCA.NAME, this.flags.chenamespace)) { + task.title = `${task.title}...[Exists]` } else { - throw new Error(`Dex certificate not found the secret in '${this.tlsSecretName}' in the namespace '${this.namespaceName}'.`) + const dexCa = new V1ConfigMap() + dexCa.metadata = new V1ObjectMeta() + dexCa.metadata.name = ConfigMapDexCA.NAME + dexCa.metadata.labels = ConfigMapDexCA.LABELS + dexCa.data = { 'ca.crt': ctx[DexContextKeys.DEX_CA_CRT] } + + await this.kube.createNamespacedConfigMap(this.flags.chenamespace, dexCa) + task.title = `${task.title}...[OK]` } }, }]) @@ -160,6 +192,23 @@ export class DexTasks { } }, }, + { + title: 'Create Dex ingress', + task: async (_ctx: any, task: any) => { + if (await this.kube.isIngressExist(this.dexName, this.namespaceName)) { + task.title = `${task.title}...[Exists]` + } else { + const yamlFilePath = this.getDexResourceFilePath('ingress.yaml') + let yamlContent = fs.readFileSync(yamlFilePath).toString() + yamlContent = yamlContent.replace(new RegExp(TemplatePlaceholders.DOMAIN, 'g'), this.flags.domain) + + const ingress = yaml.load(yamlContent) as V1Ingress + await this.kube.createIngressFromObj(ingress, this.namespaceName) + + task.title = `${task.title}...[OK]` + } + }, + }, { title: 'Create Dex configmap', task: async (ctx: any, task: any) => { @@ -225,7 +274,7 @@ export class DexTasks { title: 'Configure API server', task: async (ctx: any) => { ctx[OIDCContextKeys.CLIENT_ID] = this.clientId - ctx[OIDCContextKeys.ISSUER_URL] = `https://dex.${this.flags.domain}:32000` + ctx[OIDCContextKeys.ISSUER_URL] = `https://dex.${this.flags.domain}` ctx[OIDCContextKeys.CA_FILE] = this.getDexCaCertificateFilePath() return new Listr(this.platform.configureApiServer(this.flags), ctx.listrOptions) }, @@ -241,6 +290,6 @@ export class DexTasks { } getDexResourceFilePath(fileName: string): string { - return path.join(getEmbeddedTemplatesDirectory(), '..', 'installers', 'dex', fileName) + return path.join(getEmbeddedTemplatesDirectory(), '..', 'resources', 'dex', fileName) } } diff --git a/src/tasks/installers/olm.ts b/src/tasks/installers/olm.ts index 7f4141c36..954bf7a41 100644 --- a/src/tasks/installers/olm.ts +++ b/src/tasks/installers/olm.ts @@ -50,7 +50,7 @@ export class OLMTasks { enabled: () => flags['cluster-monitoring'] && flags.platform === 'openshift', title: `Create Role ${this.prometheusRoleName} in namespace ${flags.chenamespace}`, task: async (_ctx: any, task: any) => { - const yamlFilePath = path.join(getEmbeddedTemplatesDirectory(), '..', 'installers', 'prometheus-role.yaml') + const yamlFilePath = path.join(getEmbeddedTemplatesDirectory(), '..', 'resources', 'prometheus-role.yaml') const exist = await kube.roleExist(this.prometheusRoleName, flags.chenamespace) if (exist) { task.title = `${task.title}...It already exists.` @@ -65,7 +65,7 @@ export class OLMTasks { title: `Create RoleBinding ${this.prometheusRoleBindingName} in namespace ${flags.chenamespace}`, task: async (_ctx: any, task: any) => { const exist = await kube.roleBindingExist(this.prometheusRoleBindingName, flags.chenamespace) - const yamlFilePath = path.join(getEmbeddedTemplatesDirectory(), '..', 'installers', 'prometheus-role-binding.yaml') + const yamlFilePath = path.join(getEmbeddedTemplatesDirectory(), '..', 'resources', 'prometheus-role-binding.yaml') if (exist) { task.title = `${task.title}...It already exists.` diff --git a/test/api/che.test.ts b/test/api/che.test.ts index 78f474c97..ce3ff1c87 100644 --- a/test/api/che.test.ts +++ b/test/api/che.test.ts @@ -61,7 +61,7 @@ describe('Eclipse Che helper', () => { }) fancy .stub(kube, 'getNamespace', () => ({})) - .stub(kube, 'ingressExist', () => true) + .stub(kube, 'isIngressExist', () => true) .stub(kube, 'isOpenShift', () => false) .stub(kube, 'getIngressProtocol', () => 'https') .stub(kube, 'getIngressHost', () => 'example.org') @@ -71,7 +71,7 @@ describe('Eclipse Che helper', () => { }) fancy .stub(kube, 'getNamespace', () => ({})) - .stub(kube, 'ingressExist', () => false) + .stub(kube, 'isIngressExist', () => false) .stub(kube, 'isOpenShift', () => true) .stub(oc, 'routeExist', () => false) .do(() => ch.cheURL('che-namespace')) //ERR_ROUTE_NO_EXIST @@ -79,7 +79,7 @@ describe('Eclipse Che helper', () => { .it('fails fetching Eclipse Che URL when ingress does not exist') fancy .stub(kube, 'getNamespace', () => ({})) - .stub(kube, 'ingressExist', () => false) + .stub(kube, 'isIngressExist', () => false) .stub(kube, 'isOpenShift', () => false) .do(() => ch.cheURL('che-namespace')) .catch(err => expect(err.message).to.match(/ERR_INGRESS_NO_EXIST/)) @@ -195,7 +195,7 @@ describe('Eclipse Che helper', () => { }) fancy .stub(kube, 'getNamespace', () => ({})) - .stub(kube, 'ingressExist', () => true) + .stub(kube, 'isIngressExist', () => true) .stub(kube, 'isOpenShift', () => false) .stub(kube, 'getIngressProtocol', () => 'https') .stub(kube, 'getIngressHost', () => 'example.org') @@ -205,7 +205,7 @@ describe('Eclipse Che helper', () => { }) fancy .stub(kube, 'getNamespace', () => ({})) - .stub(kube, 'ingressExist', () => false) + .stub(kube, 'isIngressExist', () => false) .stub(kube, 'isOpenShift', () => true) .stub(oc, 'routeExist', () => false) .do(() => ch.chePluginRegistryURL('che-namespace')) //ERR_ROUTE_NO_EXIST @@ -213,7 +213,7 @@ describe('Eclipse Che helper', () => { .it('fails fetching Plugin Registry URL when ingress does not exist') fancy .stub(kube, 'getNamespace', () => ({})) - .stub(kube, 'ingressExist', () => false) + .stub(kube, 'isIngressExist', () => false) .stub(kube, 'isOpenShift', () => false) .do(() => ch.chePluginRegistryURL('che-namespace')) .catch(err => expect(err.message).to.match(/ERR_INGRESS_NO_EXIST/)) diff --git a/test/e2e/util.ts b/test/e2e/util.ts index add7f0b51..e54b52df0 100644 --- a/test/e2e/util.ts +++ b/test/e2e/util.ts @@ -165,7 +165,7 @@ export class E2eHelper { // Return ingress and protocol from minikube platform async K8SHostname(ingressName: string, namespace: string): Promise { - if (await this.kubeHelper.ingressExist(ingressName, namespace)) { + if (await this.kubeHelper.isIngressExist(ingressName, namespace)) { const protocol = await this.kubeHelper.getIngressProtocol(ingressName, namespace) const hostname = await this.kubeHelper.getIngressHost(ingressName, namespace)