Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/resources/hosted-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export interface HostedCluster extends IResource {
release: {
image: string
}
pullSecret: {
pullSecret?: {
name: string
}
sshKey: {
sshKey?: {
name: string
}
networking: {
Expand Down
17 changes: 17 additions & 0 deletions frontend/src/resources/utils/get-cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ClusterCurator, ClusterCuratorApiVersion, ClusterCuratorKind } from '..
import { ClusterDeployment, ClusterDeploymentApiVersion, ClusterDeploymentKind } from '../cluster-deployment'
import {
ClusterStatus,
getCluster,
getClusterStatus,
getDistributionInfo,
getHCUpgradePercent,
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/resources/utils/get-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,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 || '',
Expand Down