Skip to content
Merged
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
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11731-fixed-1740521257689.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

RTX 6000 plans showing up in LKE UI ([#11731](https://github.com/linode/manager/pull/11731))
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ export const KubernetesPlansPanel = (props: Props) => {
const plans = getPlanSelectionsByPlanType(
flags.disableLargestGbPlans
? replaceOrAppendPlaceholder512GbPlans(_types)
: _types
: _types,
{ isLKE: true }
);

const tabs = Object.keys(plans).map(
Expand Down
35 changes: 35 additions & 0 deletions packages/manager/src/features/components/PlansPanel/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,41 @@ describe('getPlanSelectionsByPlanType', () => {

expect(actualKeys).toEqual(expectedOrder);
});

it('should filter out RTX6000 plans when isLKE is true', () => {
const rtx6000Plan = typeFactory.build({
class: 'gpu',
id: 'g1-gpu-rtx6000-1',
});
const rtx4000Plan = typeFactory.build({
class: 'gpu',
id: 'g1-gpu-rtx4000-1',
});

// With isLKE: true, RTX6000 should be filtered out
const actualWithLKE = getPlanSelectionsByPlanType(
[rtx6000Plan, rtx4000Plan],
{ isLKE: true }
);

// With isLKE: false or default, RTX6000 should remain
const actualWithoutLKE = getPlanSelectionsByPlanType(
[rtx6000Plan, rtx4000Plan],
{ isLKE: false }
);

const actualWithDefault = getPlanSelectionsByPlanType([
rtx6000Plan,
rtx4000Plan,
]);

// RTX6000 should be filtered out in LKE context
expect(actualWithLKE.gpu).toEqual([rtx4000Plan]);

// RTX6000 should remain in non-LKE context
expect(actualWithoutLKE.gpu).toEqual([rtx6000Plan, rtx4000Plan]);
expect(actualWithDefault.gpu).toEqual([rtx6000Plan, rtx4000Plan]);
});
});

describe('determineInitialPlanCategoryTab', () => {
Expand Down
20 changes: 18 additions & 2 deletions packages/manager/src/features/components/PlansPanel/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type {
} from './types';
import type {
Capabilities,
BaseType,
LinodeTypeClass,
Region,
RegionAvailability,
Expand Down Expand Up @@ -74,6 +75,16 @@ export const useIsAcceleratedPlansEnabled = () => {
return { isAcceleratedLKEPlansEnabled, isAcceleratedLinodePlansEnabled };
};

const shouldExcludePlan = (
type: { id: string },
options: { isLKE?: boolean } = {}
): boolean => {
const { isLKE = false } = options;
const excludedPlanIdSubstring = 'rtx6000';
// Filter out RTX6000 plans when in LKE context
return isLKE && type.id.includes(excludedPlanIdSubstring);
Comment thread
bill-akamai marked this conversation as resolved.
};

/**
* getPlanSelectionsByPlanType function takes an array of types, groups
* them based on their class property into different plan types, filters out empty
Expand All @@ -85,17 +96,22 @@ export const useIsAcceleratedPlansEnabled = () => {
*/

export const getPlanSelectionsByPlanType = <
T extends { class: LinodeTypeClass }
T extends BaseType & { class: LinodeTypeClass }
>(
types: T[]
types: T[],
options: { isLKE?: boolean } = {}
): Partial<PlansByType<T>> => {
const plansByType: PlansByType<T> = planTypeOrder.reduce((acc, key) => {
acc[key] = [];
return acc;
}, {} as PlansByType<T>);
const { isLKE = false } = options;

// group plans by type
for (const type of types) {
if (shouldExcludePlan(type, { isLKE })) {
continue;
}
switch (type.class) {
case 'nanode':
case 'standard':
Expand Down