Skip to content

Commit

Permalink
upcoming: [M3-8847] - Update Region Select for LKE-Enterprise (#11348)
Browse files Browse the repository at this point in the history
## Description 📝
LKE-Enterprise will not be available in all regions. It will be available in limited DCs initially, then expanded to all core DCs. We want to clearly communicate to users why they cannot select the same DCs for LKE-E as we offer for LKE. 

## Changes  🔄
- Filter region select by the `Kubernetes Enterprise` capability if LKE-E is selected & show tooltip

## How to test 🧪

### Prerequisites

(How to setup test environment)

- Ensure you have the LKE-E customer tag on your account (see Project Tracker)
- Point to the development environment

### Verification steps

(How to verify changes)

- [ ] Go to http://localhost:3000/kubernetes/create
- [ ] When LKE standard cluster type is selected, all regions with the Kubernetes capability are displayed.
- [ ] When the LKE enterprise cluster type is selected, regions are filtered display only those with the Kubernetes Enterprise capability.
  - [ ] A tooltip is displayed next to the region select that explains the reason for the limited list.
- [ ] When the lkeEnterprise feature is disabled, no region tooltip is visible.
- [ ] Confirm test coverage passes

```
yarn cy:run -s "cypress/e2e/core/kubernetes/lke-create.spec.ts"
```
  • Loading branch information
hana-akamai authored Dec 4, 2024
1 parent 83a4776 commit 6f6d303
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/api-v4/src/regions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type Capabilities =
| 'Distributed Plans'
| 'GPU Linodes'
| 'Kubernetes'
| 'Kubernetes Enterprise'
| 'Linodes'
| 'Managed Databases'
| 'Metadata'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Update Region Select for LKE-Enterprise ([#11348](https://github.com/linode/manager/pull/11348))
30 changes: 30 additions & 0 deletions packages/manager/cypress/e2e/core/kubernetes/lke-create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,18 @@ describe('LKE Cluster Creation with LKE-E', () => {
capabilities: ['Kubernetes Enterprise'],
})
).as('getAccount');
mockGetRegions([
regionFactory.build({
capabilities: ['Linodes', 'Kubernetes'],
id: 'us-east',
label: 'Newark, US',
}),
regionFactory.build({
capabilities: ['Linodes', 'Kubernetes', 'Kubernetes Enterprise'],
id: 'us-iad',
label: 'Washington, DC',
}),
]).as('getRegions');

cy.visitWithLogin('/kubernetes/clusters');

Expand Down Expand Up @@ -904,6 +916,24 @@ describe('LKE Cluster Creation with LKE-E', () => {
// Confirm HA section is hidden since LKE-E includes HA by default
cy.findByText('HA Control Plane').should('not.exist');

cy.wait(['@getRegions']);

// Confirm unsupported regions are not displayed
ui.regionSelect.find().click().type('Newark, NJ');
ui.autocompletePopper.find().within(() => {
cy.findByText('Newark, NJ (us-east)').should('not.exist');
});

// Select a supported region
ui.regionSelect.find().clear().type('Washington, DC{enter}');

// Confirm that there is a tooltip explanation for the region dropdown options
ui.tooltip
.findByText(
'Only regions that support Kubernetes Enterprise are listed.'
)
.should('be.visible');

// TODO: finish the rest of this test in subsequent PRs
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const RegionSelect = <
}}
sx={(theme) => ({
[theme.breakpoints.up('md')]: {
width: '416px',
maxWidth: tooltipText ? '458px' : '416px',
},
})}
textFieldProps={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,22 @@ export const CreateCluster = () => {
<StyledFieldWithDocsStack>
<Stack>
<RegionSelect
currentCapability={
isLkeEnterpriseLAFeatureEnabled &&
selectedTier === 'enterprise'
? 'Kubernetes Enterprise'
: 'Kubernetes'
}
textFieldProps={{
helperText: <RegionHelperText mb={2} />,
helperTextPosition: 'top',
}}
currentCapability="Kubernetes"
tooltipText={
isLkeEnterpriseLAFeatureEnabled &&
selectedTier === 'enterprise'
? 'Only regions that support Kubernetes Enterprise are listed.'
: undefined
}
disableClearable
errorText={errorMap.region}
onChange={(e, region) => setSelectedRegionId(region.id)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const getLinodeCreateResolver = (
}

const regions = await queryClient.ensureQueryData(regionQueries.regions);

const selectedRegion = regions.find((r) => r.id === values.region);

const hasSelectedAnEURegion = isEURegion(
Expand Down
5 changes: 2 additions & 3 deletions packages/ui/src/components/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ export const TextField = (props: TextFieldProps) => {
{helperText && helperTextPosition === 'top' && (
<FormHelperText
sx={{
marginBottom: theme.spacing(),
marginTop: theme.spacing(),
marginTop: 0,
}}
data-qa-textfield-helper-text
>
Expand Down Expand Up @@ -371,7 +370,7 @@ export const TextField = (props: TextFieldProps) => {
sx={{
marginTop: 0,
...(Boolean(tooltipText) && {
width: '415px',
width: '416px',
}),
...props.sx,
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/foundations/themes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ export const lightTheme: ThemeOptions = {
},
fontSize: '0.875rem',
lineHeight: 1.25,
maxWidth: 415,
maxWidth: 416,
},
},
},
Expand Down

0 comments on commit 6f6d303

Please sign in to comment.