diff --git a/frontend/packages/dev-console/src/components/edit-application/__tests__/edit-application-data.ts b/frontend/packages/dev-console/src/components/edit-application/__tests__/edit-application-data.ts index 8a798b7ea7d..fc9113b5b36 100644 --- a/frontend/packages/dev-console/src/components/edit-application/__tests__/edit-application-data.ts +++ b/frontend/packages/dev-console/src/components/edit-application/__tests__/edit-application-data.ts @@ -59,6 +59,7 @@ export const appResources: AppResources = { 'app.kubernetes.io/instance': 'nationalparks-py', 'app.kubernetes.io/name': 'python', 'app.openshift.io/runtime': 'python', + 'app.openshift.io/runtime-icon': 'python', 'app.openshift.io/runtime-version': '3.6', 'app.openshift.io/runtime-namespace': 'div', }, diff --git a/frontend/packages/dev-console/src/components/edit-application/edit-application-utils.ts b/frontend/packages/dev-console/src/components/edit-application/edit-application-utils.ts index 428d4a017f2..3332cab3877 100644 --- a/frontend/packages/dev-console/src/components/edit-application/edit-application-utils.ts +++ b/frontend/packages/dev-console/src/components/edit-application/edit-application-utils.ts @@ -24,6 +24,7 @@ import { ClusterBuildStrategy } from '@console/shipwright-plugin/src/types'; import { UNASSIGNED_KEY } from '@console/topology/src/const'; import { RUNTIME_LABEL, + RUNTIME_ICON_LABEL, CUSTOM_ICON_ANNOTATION, PIPELINE_RUNTIME_LABEL, PIPELINE_RUNTIME_VERSION_LABEL, @@ -202,6 +203,7 @@ export const getDefaultLabels = () => { 'app', 'app.kubernetes.io/instance', 'app.openshift.io/runtime', + 'app.openshift.io/runtime-icon', 'app.kubernetes.io/part-of', 'app.openshift.io/runtime-version', 'app.openshift.io/runtime-namespace', @@ -485,8 +487,10 @@ export const getIconInitialValues = ( editAppResource: K8sResourceKind, overrideKnative?: boolean, ) => { - const runtimeLabel = editAppResource?.metadata?.labels?.[RUNTIME_LABEL]; - const runtimeIcon = runtimeLabel && hasIcon(runtimeLabel) ? runtimeLabel : null; + const runtimeIconLabel = + editAppResource?.metadata?.labels?.[RUNTIME_ICON_LABEL] ?? + editAppResource?.metadata?.labels?.[RUNTIME_LABEL]; + const runtimeIcon = runtimeIconLabel && hasIcon(runtimeIconLabel) ? runtimeIconLabel : null; const isKnative = overrideKnative ?? getResourcesType(editAppResource) === Resources.KnativeService; diff --git a/frontend/packages/dev-console/src/components/import/import-submit-utils.ts b/frontend/packages/dev-console/src/components/import/import-submit-utils.ts index 7f65e434c8a..cee88e040b5 100644 --- a/frontend/packages/dev-console/src/components/import/import-submit-utils.ts +++ b/frontend/packages/dev-console/src/components/import/import-submit-utils.ts @@ -35,7 +35,12 @@ import { safeYAMLToJS } from '@console/shared/src/utils/yaml'; import { BUILD_OUTPUT_IMAGESTREAM_URL } from '@console/shipwright-plugin/src/const'; import { BuildModel as ShipwrightBuildModel } from '@console/shipwright-plugin/src/models'; import { CREATE_APPLICATION_KEY } from '@console/topology/src/const'; -import { CUSTOM_ICON_ANNOTATION, PIPELINE_SERVICE_ACCOUNT, RUNTIME_LABEL } from '../../const'; +import { + CUSTOM_ICON_ANNOTATION, + PIPELINE_SERVICE_ACCOUNT, + RUNTIME_LABEL, + RUNTIME_ICON_LABEL, +} from '../../const'; import { PipelineKind } from '../../types/pipeline'; import { getAppLabels, @@ -435,7 +440,10 @@ export const createOrUpdateDeployment = ( } = formData; const imageStreamName = imageStream && imageStream.metadata.name; - const runtimeIcon = imageStream && imageStream.metadata.labels?.[RUNTIME_LABEL]; + const runtimeIcon = + imageStream && + (imageStream.metadata.labels?.[RUNTIME_ICON_LABEL] ?? + imageStream.metadata.labels?.[RUNTIME_LABEL]); const defaultLabels = getAppLabels({ name, applicationName, diff --git a/frontend/packages/dev-console/src/const.ts b/frontend/packages/dev-console/src/const.ts index c40665e7c7d..3944323c9bf 100644 --- a/frontend/packages/dev-console/src/const.ts +++ b/frontend/packages/dev-console/src/const.ts @@ -24,6 +24,7 @@ export const LAST_BUILD_PAGE_TAB_STORAGE_KEY = `devconsole.last.build-page-tab`; export const NAME_LABEL = 'app.kubernetes.io/name'; export const INSTANCE_LABEL = 'app.kubernetes.io/instance'; export const RUNTIME_LABEL = 'app.openshift.io/runtime'; +export const RUNTIME_ICON_LABEL = 'app.openshift.io/runtime-icon'; export const FLAG_DEVELOPER_CATALOG = 'DEVELOPER_CATALOG'; export const FLAG_OPERATOR_BACKED_SERVICE_CATALOG_TYPE = 'OPERATOR_BACKED_SERVICE_CATALOG_TYPE'; export const FLAG_SAMPLE_CATALOG_TYPE = 'SAMPLE_CATALOG_TYPE'; diff --git a/frontend/packages/dev-console/src/utils/resource-label-utils.ts b/frontend/packages/dev-console/src/utils/resource-label-utils.ts index 0f80c7a65d2..1fc3e25a50e 100644 --- a/frontend/packages/dev-console/src/utils/resource-label-utils.ts +++ b/frontend/packages/dev-console/src/utils/resource-label-utils.ts @@ -30,7 +30,7 @@ export const getAppLabels = ({ }; if (runtimeIcon) { - labels['app.openshift.io/runtime'] = runtimeIcon; + labels['app.openshift.io/runtime-icon'] = runtimeIcon; } if (applicationName && applicationName.trim().length > 0) { labels['app.kubernetes.io/part-of'] = applicationName; diff --git a/frontend/packages/topology/src/data-transforms/transform-utils.ts b/frontend/packages/topology/src/data-transforms/transform-utils.ts index 3e4ae4323db..e1082f05a93 100644 --- a/frontend/packages/topology/src/data-transforms/transform-utils.ts +++ b/frontend/packages/topology/src/data-transforms/transform-utils.ts @@ -1,7 +1,12 @@ import { Model, NodeModel } from '@patternfly/react-topology'; import i18next from 'i18next'; import * as _ from 'lodash'; -import { CUSTOM_ICON_ANNOTATION, RUNTIME_LABEL, NAME_LABEL } from '@console/dev-console/src/const'; +import { + CUSTOM_ICON_ANNOTATION, + NAME_LABEL, + RUNTIME_ICON_LABEL, + RUNTIME_LABEL, +} from '@console/dev-console/src/const'; import { WatchK8sResources, WatchK8sResults, @@ -116,6 +121,7 @@ export const createTopologyNodeData = ( const contextDir = getContextDirByName(resources, deploymentsName); const builderImageIcon = returnIfValidURL(deploymentsAnnotations[CUSTOM_ICON_ANNOTATION]) ?? + getImageForIconClass(`icon-${deploymentsLabels[RUNTIME_ICON_LABEL]}`) ?? getImageForIconClass(`icon-${deploymentsLabels[RUNTIME_LABEL]}`) ?? getImageForIconClass(`icon-${deploymentsLabels[NAME_LABEL]}`); return {