Skip to content

Commit

Permalink
fix: Generate certificate for dex independently of CheCluster spec.ne…
Browse files Browse the repository at this point in the history
…tworking.tlsSecretName field

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha committed Aug 25, 2023
1 parent 6c68a87 commit 20d6e5f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
2 changes: 1 addition & 1 deletion src/tasks/che-cluster-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export namespace CheClusterTasks {
}

if (!ctx[InfrastructureContext.IS_OPENSHIFT]) {
if (!cheCluster.spec?.networking?.tlsSecretName) {
if (cheCluster.spec?.networking?.tlsSecretName === undefined) {
merge(cheCluster, { spec: { networking: { tlsSecretName: EclipseChe.CHE_TLS_SECRET_NAME } } })
}
if (flags[DOMAIN_FLAG]) {
Expand Down
3 changes: 0 additions & 3 deletions src/tasks/installers/dex-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { KubeClient } from '../../api/kube-client'
import {base64Decode, getEmbeddedTemplatesDirectory, newListr, safeLoadFromYamlFile} from '../../utils/utls'
import { V1Certificate } from '../../api/types/cert-manager'
import {Installer} from './installer'
import {Che} from '../../utils/che'
import {CHE_NAMESPACE_FLAG, DOMAIN_FLAG} from '../../flags'
import {PlatformTasks} from '../platforms/platform-tasks'
import {CommonTasks} from '../common-tasks'
Expand Down Expand Up @@ -90,7 +89,6 @@ export class DexInstaller implements Installer {
})
tasks.add({
title: 'Create Certificates',
skip: () => Che.getTlsSecretName() === '',
task: async (_ctx: any, task: any) => {
const dexCaCertificateFilePath = this.getDexCaCertificateFilePath()

Expand Down Expand Up @@ -132,7 +130,6 @@ export class DexInstaller implements Installer {
})
tasks.add({
title: `Create ConfigMap ${Dex.CONFIG_MAP}`,
skip: () => Che.getTlsSecretName() === '',
task: async (ctx: any, task: any) => {
const flags = CheCtlContext.getFlags()
const dexCa = new V1ConfigMap()
Expand Down
17 changes: 0 additions & 17 deletions src/utils/che.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {CheCtlContext, EclipseCheContext, InfrastructureContext} from '../contex
import {EclipseChe} from '../tasks/installers/eclipse-che/eclipse-che'
import {KubeClient} from '../api/kube-client'
import {CHE_NAMESPACE_FLAG} from '../flags'
import {CheCluster} from '../api/types/che-cluster'
import {OpenShift} from './openshift'
import * as nodeforge from 'node-forge'
import {base64Decode} from './utls'
Expand All @@ -34,22 +33,6 @@ export namespace Che {
return logsReader.readNamespaceEvents(namespace, directory, follow)
}

export function getTlsSecretName(): string {
const ctx = CheCtlContext.get()

const crPatch = ctx[EclipseCheContext.CR_PATCH] as CheCluster
if (crPatch?.spec?.networking?.tlsSecretName !== undefined) {
return crPatch?.spec?.networking?.tlsSecretName
}

const customCR = ctx[EclipseCheContext.CUSTOM_CR] as CheCluster
if (customCR?.spec?.networking?.tlsSecretName !== undefined) {
return customCR?.spec?.networking?.tlsSecretName
}

return EclipseChe.CHE_TLS_SECRET_NAME
}

export function getCheClusterFieldConfigured(fieldPath: string): any | undefined {
const ctx = CheCtlContext.get()

Expand Down

0 comments on commit 20d6e5f

Please sign in to comment.