Skip to content
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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

dennisvankekem
Copy link
Contributor

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.

  • added 'shared' to LinodeTypeClass
  • added isAPLEnabled to isPlanPanelDisabled
  • created new notice for APL

Target release date 🗓️

November the 11th

Preview 📷

image

How to test 🧪

  • Make sure APL feature flag is enabled and you are enrolled into the beta
  • go to create Kubernetes cluster page
  • Enable APL
  • Observe that the entire shared CPU table is disabled

@dennisvankekem dennisvankekem requested a review from a team as a code owner November 6, 2024 15:27
@dennisvankekem dennisvankekem requested review from hana-akamai and harsh-akamai and removed request for a team November 6, 2024 15:27
@abailly-akamai abailly-akamai added the LKE Related to Linode Kubernetes Engine offerings label Nov 6, 2024
Copy link

github-actions bot commented Nov 6, 2024

Coverage Report:
Base Coverage: 87.45%
Current Coverage: 87.45%

@dennisvankekem
Copy link
Contributor Author

Will fix test tomorrow

@@ -332,6 +332,7 @@ export interface LinodeType extends BaseType {
export type LinodeTypeClass =
| 'nanode'
| 'standard'
| 'shared'
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

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}

Copy link
Contributor Author

@dennisvankekem dennisvankekem Nov 11, 2024

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));
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fair enough

Copy link
Contributor Author

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));

Copy link
Contributor

@ElderMatt ElderMatt Nov 11, 2024

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.

Copy link
Contributor Author

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.

@dennisvankekem
Copy link
Contributor Author

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

@dennisvankekem
Copy link
Contributor Author

adding @ElderMatt as internal reviewer

@dennisvankekem
Copy link
Contributor Author

error from storybook Could not load .//src/components/Notice/Notice (imported by src/features/components/PlansPanel/APLNotice.tsx): ENOENT: no such file or directory, open './/src/components/Notice/Notice' doesn't make sense to me, it loads Notice the exact same as the other notices like MetalNotice

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🔺 6 failing tests on test run #5 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
6 Failing439 Passing2 Skipped111m 39s

Details

Failing Tests
SpecTest
plan-selection.spec.tsdisplays linode plans panel based on availability » displays the proper plans based on the region and types
plan-selection.spec.tsdisplays kubernetes plans panel based on availability » displays the proper plans based on the region and types
resize-database.spec.tsResizes a g6-standard-6 MySQL v8.x 3-node cluster » Can resize active database clusters
resize-database.spec.tsResizes a g6-standard-6 MySQL v8.x 3-node cluster » Can resize active database clusters from g6-standard-6 type and switch plan type
resize-database.spec.tsResizes a g6-dedicated-16 MySQL v5.x 3-node cluster » Can resize active database clusters
resize-database.spec.tsResizes a g6-dedicated-16 MySQL v5.x 3-node cluster » Can resize active database clusters from g6-dedicated-16 type and switch plan type

Troubleshooting

Use 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"

packages/manager/src/utilities/planNotices.ts Show resolved Hide resolved
isAPLEnabled?: boolean
) =>
(hasSelectedRegion && !isSelectedRegionEligibleForPlan(planType)) ||
(planType === 'shared' && Boolean(isAPLEnabled));
Copy link
Contributor

@ElderMatt ElderMatt Nov 11, 2024

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`;
Copy link
Contributor

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}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is problematic:

  1. it shows in the Linode create flow (/linodes/create) which seems irrelevant to APL
  2. 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

Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LKE Related to Linode Kubernetes Engine offerings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants