From f2f3b71cdeb1ce9069bd1fba7dca443bd7584218 Mon Sep 17 00:00:00 2001 From: dror1212 Date: Tue, 4 Aug 2026 11:46:00 +0300 Subject: [PATCH 1/3] Handle hosted clusters without SSH keys Signed-off-by: dror1212 --- frontend/src/resources/hosted-cluster.ts | 2 +- frontend/src/resources/utils/get-cluster.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/resources/hosted-cluster.ts b/frontend/src/resources/hosted-cluster.ts index d5f5c9a9381..c745e79ed36 100644 --- a/frontend/src/resources/hosted-cluster.ts +++ b/frontend/src/resources/hosted-cluster.ts @@ -48,7 +48,7 @@ export interface HostedCluster extends IResource { pullSecret: { name: string } - sshKey: { + sshKey?: { name: string } networking: { diff --git a/frontend/src/resources/utils/get-cluster.ts b/frontend/src/resources/utils/get-cluster.ts index 2a7af4a6052..812bf2b54dc 100644 --- a/frontend/src/resources/utils/get-cluster.ts +++ b/frontend/src/resources/utils/get-cluster.ts @@ -613,7 +613,7 @@ export function getCluster({ ? { agent: !!hostedCluster.spec.platform?.agent, nodePools: clusterNodePools, - secretNames: [hostedCluster.spec?.sshKey.name || '', hostedCluster.spec?.pullSecret?.name || ''].filter( + secretNames: [hostedCluster.spec?.sshKey?.name || '', hostedCluster.spec?.pullSecret?.name || ''].filter( (name) => !!name ), hostingNamespace: hostedCluster.metadata?.namespace || '', From 5de394cd1a0a8357ec5c2ae70fdf85926d2974b2 Mon Sep 17 00:00:00 2001 From: dror1212 Date: Tue, 4 Aug 2026 12:08:55 +0300 Subject: [PATCH 2/3] Add coverage for hosted clusters without SSH keys Signed-off-by: dror1212 --- .../src/resources/utils/get-cluster.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/frontend/src/resources/utils/get-cluster.test.ts b/frontend/src/resources/utils/get-cluster.test.ts index 2340b3cc45f..a7d99a415a1 100644 --- a/frontend/src/resources/utils/get-cluster.test.ts +++ b/frontend/src/resources/utils/get-cluster.test.ts @@ -5,6 +5,7 @@ import { ClusterCurator, ClusterCuratorApiVersion, ClusterCuratorKind } from '.. import { ClusterDeployment, ClusterDeploymentApiVersion, ClusterDeploymentKind } from '../cluster-deployment' import { ClusterStatus, + getCluster, getClusterStatus, getDistributionInfo, getHCUpgradePercent, @@ -1028,6 +1029,22 @@ const mockClusterCuratorPosthookFailed: ClusterCurator = { }, } +describe('getCluster', () => { + it('should handle a hosted cluster without an SSH key', () => { + const { sshKey: _sshKey, ...spec } = mockHostedCluster.spec + const hostedCluster = { ...mockHostedCluster, spec } as HostedClusterK8sResource + + const cluster = getCluster({ + hostedCluster, + managedClusterAddOns: [], + clusterManagementAddOns: {}, + nodePools: [], + }) + + expect(cluster.hypershift?.secretNames).toEqual(['psecret']) + }) +}) + describe('getDistributionInfo', () => { it('should have correct available updates and available channels', () => { const d = getDistributionInfo( From 76873d362003164eaaf1cefab8882817e8d2b632 Mon Sep 17 00:00:00 2001 From: Kevin Cormier Date: Mon, 10 Aug 2026 11:01:40 -0400 Subject: [PATCH 3/3] Tweak code Signed-off-by: Kevin Cormier --- frontend/src/resources/hosted-cluster.ts | 2 +- frontend/src/resources/utils/get-cluster.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/resources/hosted-cluster.ts b/frontend/src/resources/hosted-cluster.ts index c745e79ed36..ba702604012 100644 --- a/frontend/src/resources/hosted-cluster.ts +++ b/frontend/src/resources/hosted-cluster.ts @@ -45,7 +45,7 @@ export interface HostedCluster extends IResource { release: { image: string } - pullSecret: { + pullSecret?: { name: string } sshKey?: { diff --git a/frontend/src/resources/utils/get-cluster.ts b/frontend/src/resources/utils/get-cluster.ts index 812bf2b54dc..1f3e36bfce4 100644 --- a/frontend/src/resources/utils/get-cluster.ts +++ b/frontend/src/resources/utils/get-cluster.ts @@ -613,7 +613,7 @@ export function getCluster({ ? { agent: !!hostedCluster.spec.platform?.agent, nodePools: clusterNodePools, - secretNames: [hostedCluster.spec?.sshKey?.name || '', hostedCluster.spec?.pullSecret?.name || ''].filter( + secretNames: [hostedCluster.spec?.sshKey?.name, hostedCluster.spec?.pullSecret?.name].filter( (name) => !!name ), hostingNamespace: hostedCluster.metadata?.namespace || '',