-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: [APL-354] - disable shared CPU whenever APL is enabled #11216
base: develop
Are you sure you want to change the base?
Conversation
Coverage Report: ✅ |
Will fix test tomorrow |
packages/manager/src/features/components/PlansPanel/APLNotice.tsx
Outdated
Show resolved
Hide resolved
packages/api-v4/src/linodes/types.ts
Outdated
@@ -332,6 +332,7 @@ export interface LinodeType extends BaseType { | |||
export type LinodeTypeClass = | |||
| 'nanode' | |||
| 'standard' | |||
| 'shared' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused by this. This isn't a proper value returned by the API
https://techdocs.akamai.com/linode-api/reference/get-linode-types
Orr API types are packaged separately and needs to strictly adhere to API types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it not a proper value, or has the documentation never been updated for a new value? Because it does as a matter of fact seem to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise I'm curious how we can call for the shared type class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
standard = shared
I have just created a cluster with shared node pool. Below the payload:
{"control_plane":{"acl":{"enabled":true,"revision-id":""},"high_availability":false},"k8s_version":"1.31","label":"jeho-sh","node_pools":[{"type":"g6-standard-1","count":3}],"region":"us-ord","apl_enabled":false}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
standard = shared, but this is not the case for checking whenever the shared tab is active, because standard is not being used as an ID for that tab, but rather the type is being extended with 'shared' only in the plan segment
isAPLEnabled?: boolean | ||
) => | ||
(hasSelectedRegion && !isSelectedRegionEligibleForPlan(planType)) || | ||
(planType === 'shared' && Boolean(isAPLEnabled)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like adding a feature specific check in a generic component.
can we modified
isPlanPanelDisabled: (
planType?: LinodeTypeClass,
isAPLEnabled?: boolean
) => boolean;
to being able to pass a custom function returning a boolean?
isPlanPanelDisabled: (
planType?: LinodeTypeClass,
disableFn?: (arg) => boolean
) => boolean;
something like that
also, see my initial comment about types, based on that I would not expect this to work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fair enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding this, looking deeper in the code. It might be redundant to do so actually.
we call the function in KubernetesPlansPanel
. If I were to lift the APL part out it would probably also live in KubernetesPlansPanel
so we might as well change this line:
wholePanelIsDisabled={isPlanPanelDisabled(plan, isAPLEnabled)}
to something like this:
wholePanelIsDisabled={isPlanPanelDisabled(plan) || isDisabledByAPL()}
where isDisabledByAPL()
would be something like this:
const isDisabledByAPL = () => (planType === 'shared' && Boolean(isAPLEnabled));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I too would like to see a disableFn instead of having the logic in a generic component, this does not really look future proof. If you think otherwise please explain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ElderMatt the logic has since been moved out of the isPlanPanelDisabled
function. I've implemented my proposal for the time being with a separate isDisabledByAPL
in KubernetesPlansPanel
.
If we allow for a disableFn
parameter then it defeats the purpose of isPlanPanelDisabled
because we'll basically send the result of said function with disableFn. Because in order to use disableFn we first have to decide if something disables the plan, which is the entire purpose of the generic function. Therefore, I went with my proposed solution.
Regarding 'shared' type, it seems that it's indeed not an official type, however it is used as type in the plans panel, so I've tried my best to work around it |
adding @ElderMatt as internal reviewer |
error from storybook |
Cloud Manager UI test results🔺 6 failing tests on test run #5 ↗︎
Details
TroubleshootingUse this command to re-run the failing tests: yarn cy:run -s "cypress/e2e/core/linodes/plan-selection.spec.ts,cypress/e2e/core/linodes/plan-selection.spec.ts,cypress/e2e/core/databases/resize-database.spec.ts,cypress/e2e/core/databases/resize-database.spec.ts,cypress/e2e/core/databases/resize-database.spec.ts,cypress/e2e/core/databases/resize-database.spec.ts" |
isAPLEnabled?: boolean | ||
) => | ||
(hasSelectedRegion && !isSelectedRegionEligibleForPlan(planType)) || | ||
(planType === 'shared' && Boolean(isAPLEnabled)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I too would like to see a disableFn instead of having the logic in a generic component, this does not really look future proof. If you think otherwise please explain.
dataTestId?: string; | ||
} | ||
|
||
const programInfo = `Shared CPU instances are currently not available for Application Platform for LKE`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal, bit no interpolation needed so we can use reg quotes or move this to a constant file.
@@ -82,6 +87,7 @@ export const PlanInformation = (props: PlanInformationProps) => { | |||
hasDisabledClass={getDisabledClass('metal')} | |||
/> | |||
) : null} | |||
{planType === 'shared' ? <APLNotice dataTestId="apl-notice" /> : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is problematic:
- it shows in the Linode create flow (
/linodes/create
) which seems irrelevant toAPL
- it shows for ALL users (shouldn't it only show for users enrolled int he beta?)
This should only show in the LKE plan selection and the isAPLEnabled?
logic should be contained there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have a lot of test failures on this PR.
@dennisvankekem FYI a lot of components are being moved to a new @linode/ui
package for modularization purposes. Besides the e2e failures, this is probably the issues you're seeing in the CI
Description 📝
Shared CPU's are currently unstable with APL, therefore we want to disable the entire table whenever APL is enabled.
Changes 🔄
List any change relevant to the reviewer.
Target release date 🗓️
November the 11th
Preview 📷
How to test 🧪