From a1e198bba2e22196889cee0c04a923624d977817 Mon Sep 17 00:00:00 2001 From: Marek Libra Date: Fri, 11 Aug 2023 12:59:14 +0200 Subject: [PATCH] MGMT-15528: Use labels if status lacks OCP version Just a fallback to another source of information. --- libs/ui-lib/lib/cim/components/common/constants.ts | 2 ++ libs/ui-lib/lib/cim/components/helpers/toAssisted.ts | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/ui-lib/lib/cim/components/common/constants.ts b/libs/ui-lib/lib/cim/components/common/constants.ts index 521f3306b9..95927a5523 100644 --- a/libs/ui-lib/lib/cim/components/common/constants.ts +++ b/libs/ui-lib/lib/cim/components/common/constants.ts @@ -19,3 +19,5 @@ export const getInfraEnvDocs = (docVersion: string) => `https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/${docVersion}/html-single/clusters/index#enable-cim`; export const BMH_HOSTNAME_ANNOTATION = 'bmac.agent-install.openshift.io/hostname'; + +export const OCP_VERSION_MAJOR_MINOR = 'hive.openshift.io/version-major-minor'; diff --git a/libs/ui-lib/lib/cim/components/helpers/toAssisted.ts b/libs/ui-lib/lib/cim/components/helpers/toAssisted.ts index 09dc0b3565..47218bed93 100644 --- a/libs/ui-lib/lib/cim/components/helpers/toAssisted.ts +++ b/libs/ui-lib/lib/cim/components/helpers/toAssisted.ts @@ -6,7 +6,11 @@ import { AgentClusterInstallK8sResource } from '../../types/k8s/agent-cluster-in import { getAgentStatus, getClusterStatus } from './status'; import { getHostNetworks } from './network'; import { BareMetalHostK8sResource, InfraEnvK8sResource } from '../../types'; -import { AGENT_BMH_NAME_LABEL_KEY, BMH_HOSTNAME_ANNOTATION } from '../common/constants'; +import { + AGENT_BMH_NAME_LABEL_KEY, + BMH_HOSTNAME_ANNOTATION, + OCP_VERSION_MAJOR_MINOR, +} from '../common/constants'; import { getAgentProgress, getAgentRole, getInfraEnvNameOfAgent } from './agents'; import { getClusterDeploymentCpuArchitecture } from './clusterDeployment'; @@ -117,7 +121,9 @@ export const getAICluster = ({ agents?: AgentK8sResource[]; infraEnv?: InfraEnvK8sResource; }): Cluster => { - const installVersion = clusterDeployment.status?.installVersion; + const installVersion = + clusterDeployment.status?.installVersion || + clusterDeployment.metadata?.labels?.[OCP_VERSION_MAJOR_MINOR]; const [status, statusInfo] = getClusterStatus(agentClusterInstall); const aiCluster: Cluster = { id: clusterDeployment.metadata?.uid || '',