Skip to content

Commit

Permalink
chore: Revert some changes needed for downstream to deploy from a sta…
Browse files Browse the repository at this point in the history
…ble channel with che-server engine

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha committed Jan 26, 2022
1 parent 6f2dc43 commit 953440a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export const DEVWORKSPACE_CSV_PREFIX = 'devworkspace-operator'
// OLM channels
export const OLM_STABLE_CHANNEL_NAME = 'stable'
export const OLM_STABLE_CHANNEL_STARTING_CSV_TEMPLATE = 'eclipse-che.v{{VERSION}}'
export const OLM_STABLE_ALL_NAMESPACES_CHANNEL_NAME = 'tech-preview-stable-all-namespaces'
export const OLM_STABLE_ALL_NAMESPACES_CHANNEL_STARTING_CSV_TEMPLATE = 'eclipse-che.v{{VERSION}}-all-namespaces'
export const OLM_NEXT_CHANNEL_NAME = 'next'
export const OLM_NEXT_ALL_NAMESPACES_CHANNEL_NAME = 'next-all-namespaces'
// OLM namespaces
export const DEFAULT_OPENSHIFT_MARKET_PLACE_NAMESPACE = 'openshift-marketplace'
export const DEFAULT_OLM_KUBERNETES_NAMESPACE = 'olm'
Expand Down
13 changes: 9 additions & 4 deletions src/tasks/installers/olm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { OLM, OLMInstallationUpdate } from '../../api/context'
import { KubeHelper } from '../../api/kube'
import { CatalogSource, Subscription } from '../../api/types/olm'
import { VersionHelper } from '../../api/version'
import { CHECTL_PROJECT_NAME, CSV_PREFIX, CUSTOM_CATALOG_SOURCE_NAME, DEFAULT_CHE_NAMESPACE, DEFAULT_CHE_OLM_PACKAGE_NAME, DEFAULT_CHE_OPERATOR_SUBSCRIPTION_NAME, DEFAULT_OLM_KUBERNETES_NAMESPACE, DEFAULT_OPENSHIFT_MARKET_PLACE_NAMESPACE, DEFAULT_OPENSHIFT_OPERATORS_NS_NAME, INDEX_IMG, KUBERNETES_OLM_CATALOG, NEXT_CATALOG_SOURCE_NAME, OLM_NEXT_CHANNEL_NAME, OLM_STABLE_CHANNEL_NAME, OLM_STABLE_CHANNEL_STARTING_CSV_TEMPLATE, OPENSHIFT_OLM_CATALOG, OPERATOR_GROUP_NAME } from '../../constants'
import { CHECTL_PROJECT_NAME, CSV_PREFIX, CUSTOM_CATALOG_SOURCE_NAME, DEFAULT_CHE_NAMESPACE, DEFAULT_CHE_OLM_PACKAGE_NAME, DEFAULT_CHE_OPERATOR_SUBSCRIPTION_NAME, DEFAULT_OLM_KUBERNETES_NAMESPACE, DEFAULT_OPENSHIFT_MARKET_PLACE_NAMESPACE, DEFAULT_OPENSHIFT_OPERATORS_NS_NAME, INDEX_IMG, KUBERNETES_OLM_CATALOG, NEXT_CATALOG_SOURCE_NAME, OLM_NEXT_ALL_NAMESPACES_CHANNEL_NAME, OLM_NEXT_CHANNEL_NAME, OLM_STABLE_ALL_NAMESPACES_CHANNEL_NAME, OLM_STABLE_ALL_NAMESPACES_CHANNEL_STARTING_CSV_TEMPLATE, OLM_STABLE_CHANNEL_NAME, OLM_STABLE_CHANNEL_STARTING_CSV_TEMPLATE, OPENSHIFT_OLM_CATALOG, OPERATOR_GROUP_NAME } from '../../constants'
import { getEmbeddedTemplatesDirectory, getProjectName, isKubernetesPlatformFamily } from '../../util'
import { createEclipseCheCluster, patchingEclipseCheCluster } from './common-tasks'
import { OLMDevWorkspaceTasks } from './olm-dev-workspace-operator'
Expand Down Expand Up @@ -52,7 +52,10 @@ export class OLMTasks {
title: 'Configure context information',
task: async (ctx: any, task: any) => {
ctx.operatorNamespace = flags.chenamespace || DEFAULT_CHE_NAMESPACE
ctx.operatorNamespace = DEFAULT_OPENSHIFT_OPERATORS_NS_NAME
if (flags[OLM.CHANNEL] === OLM_STABLE_ALL_NAMESPACES_CHANNEL_NAME || flags[OLM.CHANNEL] === OLM_NEXT_ALL_NAMESPACES_CHANNEL_NAME) {
ctx.operatorNamespace = DEFAULT_OPENSHIFT_OPERATORS_NS_NAME
}

ctx.defaultCatalogSourceNamespace = isKubernetesPlatformFamily(flags.platform) ? DEFAULT_OLM_KUBERNETES_NAMESPACE : DEFAULT_OPENSHIFT_MARKET_PLACE_NAMESPACE
// catalog source name for stable Che version
ctx.catalogSourceNameStable = isKubernetesPlatformFamily(flags.platform) ? KUBERNETES_OLM_CATALOG : OPENSHIFT_OLM_CATALOG
Expand All @@ -68,6 +71,8 @@ export class OLMTasks {
ctx.startingCSV = flags[OLM.STARTING_CSV]
} else if (flags[OLM.CHANNEL] === OLM_STABLE_CHANNEL_NAME) {
ctx.startingCSV = OLM_STABLE_CHANNEL_STARTING_CSV_TEMPLATE.replace(new RegExp('{{VERSION}}', 'g'), flags.version)
} else if (flags[OLM.CHANNEL] === OLM_STABLE_ALL_NAMESPACES_CHANNEL_NAME) {
ctx.startingCSV = OLM_STABLE_ALL_NAMESPACES_CHANNEL_STARTING_CSV_TEMPLATE.replace(new RegExp('{{VERSION}}', 'g'), flags.version)
} // else use latest in the channel
// Set approval starategy to manual to prevent autoupdate to the latest version right before installation
ctx.approvalStrategy = OLMInstallationUpdate.MANUAL
Expand Down Expand Up @@ -175,10 +180,10 @@ export class OLMTasks {
// custom Che CatalogSource
const catalogSourceNamespace = flags[OLM.CATALOG_SOURCE_NAMESPACE] || ctx.operatorNamespace
subscription = this.constructSubscription(ctx.subscriptionName, flags[OLM.PACKAGE_MANIFEST_NAME], ctx.operatorNamespace, catalogSourceNamespace, channel || OLM_STABLE_CHANNEL_NAME, ctx.sourceName, ctx.approvalStrategy, ctx.startingCSV)
} else if (channel === OLM_STABLE_CHANNEL_NAME || (VersionHelper.isDeployingStableVersion(flags) && !channel)) {
} else if (channel === OLM_STABLE_CHANNEL_NAME || channel === OLM_STABLE_ALL_NAMESPACES_CHANNEL_NAME || (VersionHelper.isDeployingStableVersion(flags) && !channel)) {
// stable Che CatalogSource
subscription = this.constructSubscription(ctx.subscriptionName, DEFAULT_CHE_OLM_PACKAGE_NAME, ctx.operatorNamespace, ctx.defaultCatalogSourceNamespace, channel || OLM_STABLE_CHANNEL_NAME, ctx.catalogSourceNameStable, ctx.approvalStrategy, ctx.startingCSV)
} else if (channel === OLM_NEXT_CHANNEL_NAME || !channel) {
} else if (channel === OLM_NEXT_CHANNEL_NAME || channel === OLM_NEXT_ALL_NAMESPACES_CHANNEL_NAME || !channel) {
// next Che CatalogSource
subscription = this.constructSubscription(ctx.subscriptionName, `eclipse-che-preview-${ctx.generalPlatformName}`, ctx.operatorNamespace, ctx.operatorNamespace, channel || OLM_NEXT_CHANNEL_NAME, NEXT_CATALOG_SOURCE_NAME, ctx.approvalStrategy, ctx.startingCSV)
} else {
Expand Down

0 comments on commit 953440a

Please sign in to comment.