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

upcoming: [M3-9042] - Update LKE cluster details kube specs for LKE-E monthly pricing #11475

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Update LKE cluster details kube specs for LKE-E monthly pricing ([#11475](https://github.com/linode/manager/pull/11475))
39 changes: 32 additions & 7 deletions packages/manager/cypress/e2e/core/kubernetes/lke-create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
regionFactory,
nodePoolFactory,
kubeLinodeFactory,
lkeHighAvailabilityTypeFactory,
} from 'src/factories';
import {
mockCreateCluster,
Expand Down Expand Up @@ -126,7 +127,10 @@ const mockedLKEHAClusterPrices: PriceType[] = [
transfer: 0,
},
];
const mockedLKEEnterprisePrices = [lkeEnterpriseTypeFactory.build()];
const mockedLKEEnterprisePrices = [
lkeHighAvailabilityTypeFactory.build(),
lkeEnterpriseTypeFactory.build(),
];
const clusterPlans: LkePlanDescription[] = [
{
nodeCount: dedicatedNodeCount,
Expand Down Expand Up @@ -1068,16 +1072,18 @@ describe('LKE Cluster Creation with LKE-E', () => {
* - Confirms an LKE-E supported region can be selected
* - Confirms an LKE-E supported k8 version can be selected
* - Confirms the checkout bar displays the correct LKE-E info
* - Confirms an enterprise cluster can be created
* - Confirms an enterprise cluster can be created with the correct chip, version, and price
*/
it('creates an LKE-E cluster with the account capability', () => {
const clusterLabel = randomLabel();
const mockedEnterpriseCluster = kubernetesClusterFactory.build({
label: clusterLabel,
region: clusterRegion.id,
region: 'us-iad',
tier: 'enterprise',
k8s_version: latestEnterpriseTierKubernetesVersion.id,
});
const mockedEnterpriseClusterPools = [nanodeMemoryPool, dedicatedCpuPool];
const mockedLKEClusterTypes = [dedicatedType, nanodeType];

mockGetAccount(
accountFactory.build({
Expand All @@ -1090,6 +1096,7 @@ describe('LKE Cluster Creation with LKE-E', () => {
mockGetKubernetesVersions([latestKubernetesVersion]).as(
'getKubernetesVersions'
);
mockGetLinodeTypes(mockedLKEClusterTypes).as('getLinodeTypes');
mockGetLKEClusterTypes(mockedLKEEnterprisePrices).as(
'getLKEEnterpriseClusterTypes'
);
Expand All @@ -1108,6 +1115,12 @@ describe('LKE Cluster Creation with LKE-E', () => {
mockGetCluster(mockedEnterpriseCluster).as('getCluster');
mockCreateCluster(mockedEnterpriseCluster).as('createCluster');
mockGetClusters([mockedEnterpriseCluster]).as('getClusters');
mockGetClusterPools(
mockedEnterpriseCluster.id,
mockedEnterpriseClusterPools
).as('getClusterPools');
mockGetDashboardUrl(mockedEnterpriseCluster.id).as('getDashboardUrl');
mockGetApiEndpoints(mockedEnterpriseCluster.id).as('getApiEndpoints');

cy.visitWithLogin('/kubernetes/clusters');
cy.wait(['@getAccount']);
Expand Down Expand Up @@ -1222,8 +1235,8 @@ describe('LKE Cluster Creation with LKE-E', () => {
cy.findByText(`Dedicated 4 GB Plan`).should('be.visible');
cy.findByText('$144.00').should('be.visible');
cy.findByText(`Linode 2 GB Plan`).should('be.visible');
cy.findByText('$36.00').should('be.visible');
cy.findByText('$480.00').should('be.visible');
cy.findByText('$15.00').should('be.visible');
cy.findByText('$459.00').should('be.visible');

ui.button
.findByTitle('Create Cluster')
Expand All @@ -1233,16 +1246,28 @@ describe('LKE Cluster Creation with LKE-E', () => {
});

// Wait for LKE cluster to be created and confirm that we are redirected
// to the cluster summary page, where the cluster has an LKE-E version.
cy.wait(['@getCluster', '@createCluster']);
// to the cluster summary page.
cy.wait([
'@getCluster',
'@getClusterPools',
'@createCluster',
'@getLKEEnterpriseClusterTypes',
'@getLinodeTypes',
'@getDashboardUrl',
'@getApiEndpoints',
]);

cy.url().should(
'endWith',
`/kubernetes/clusters/${mockedEnterpriseCluster.id}/summary`
);

// Confirm the LKE-E cluster has the correct enterprise chip, version, and pricing.
cy.findByText('ENTERPRISE').should('be.visible');
cy.findByText(
`Version ${latestEnterpriseTierKubernetesVersion.id}`
).should('be.visible');
cy.findByText('$459.00/month').should('be.visible');
});

it('disables the Cluster Type selection without the LKE-E account capability', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const KubeClusterSpecs = React.memo((props: Props) => {
data: kubernetesHighAvailabilityTypesData,
isError: isErrorKubernetesTypes,
isLoading: isLoadingKubernetesTypes,
} = useKubernetesTypesQuery();
} = useKubernetesTypesQuery(cluster.tier === 'enterprise');

const matchesColGapBreakpointDown = useMediaQuery(
theme.breakpoints.down(theme.breakpoints.values.lg)
Expand All @@ -78,12 +78,17 @@ export const KubeClusterSpecs = React.memo((props: Props) => {
(type) => type.id === 'lke-ha'
);

const lkeEnterpriseType = kubernetesHighAvailabilityTypesData?.find(
(type) => type.id === 'lke-e'
);

const region = regions?.find((r) => r.id === cluster.region);
const displayRegion = region?.label ?? cluster.region;

const highAvailabilityPrice = cluster.control_plane.high_availability
? getDCSpecificPriceByType({ regionId: region?.id, type: lkeHAType })
: undefined;
const enterprisePrice = lkeEnterpriseType?.price.monthly ?? undefined;

const kubeSpecsLeft = [
`Version ${cluster.k8s_version}`,
Expand All @@ -107,6 +112,7 @@ export const KubeClusterSpecs = React.memo((props: Props) => {
</>
) : (
`$${getTotalClusterPrice({
enterprisePrice: enterprisePrice,
highAvailabilityPrice: highAvailabilityPrice
? Number(highAvailabilityPrice)
: undefined,
Expand Down
Loading