Skip to content

Commit

Permalink
MGMT-15528: Use labels if status lacks OCP version (#2288)
Browse files Browse the repository at this point in the history
Just a fallback to another source of information.

Co-authored-by: Jonathan Kilzi <[email protected]>
  • Loading branch information
mareklibra and jkilzi authored Aug 24, 2023
1 parent b3bf25f commit 1837a8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions libs/ui-lib/lib/cim/components/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
10 changes: 8 additions & 2 deletions libs/ui-lib/lib/cim/components/helpers/toAssisted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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 || '',
Expand Down

0 comments on commit 1837a8a

Please sign in to comment.