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-8245] – Update "Add Node Pools" description in LKE Create flow #10578

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 description for Add Node Pools section in LKE Create flow ([#10578](https://github.com/linode/manager/pull/10578))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const ADD_NODE_POOLS_DESCRIPTION =
'Add groups of Linodes to your cluster. You can have a maximum of 250 Linodes per node pool. Node Pool data is encrypted at rest.';
dwiley-akamai marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import { KubeNodePoolResponse, LinodeTypeClass, Region } from '@linode/api-v4';
import Grid from '@mui/material/Unstable_Grid2';
import * as React from 'react';

import { CircleProgress } from 'src/components/CircleProgress';
import { useIsDiskEncryptionFeatureEnabled } from 'src/components/DiskEncryption/utils';
import { ErrorState } from 'src/components/ErrorState/ErrorState';
import { ExtendedType, extendType } from 'src/utilities/extendType';
import { useRegionsQuery } from 'src/queries/regions/regions';
import { doesRegionSupportFeature } from 'src/utilities/doesRegionSupportFeature';
import { extendType } from 'src/utilities/extendType';

import { ADD_NODE_POOLS_DESCRIPTION } from '../ClusterList/constants';
import { KubernetesPlansPanel } from '../KubernetesPlansPanel/KubernetesPlansPanel';

import type {
KubeNodePoolResponse,
LinodeTypeClass,
Region,
} from '@linode/api-v4';
import type { ExtendedType } from 'src/utilities/extendType';

const DEFAULT_PLAN_COUNT = 3;

export interface NodePoolPanelProps {
Expand All @@ -23,15 +33,11 @@ export interface NodePoolPanelProps {
typesLoading: boolean;
}

export const NodePoolPanel: React.FunctionComponent<NodePoolPanelProps> = (
props
) => {
export const NodePoolPanel = (props: NodePoolPanelProps) => {
return <RenderLoadingOrContent {...props} />;
};

const RenderLoadingOrContent: React.FunctionComponent<NodePoolPanelProps> = (
props
) => {
const RenderLoadingOrContent = (props: NodePoolPanelProps) => {
const { typesError, typesLoading } = props;

if (typesError) {
Expand All @@ -45,7 +51,7 @@ const RenderLoadingOrContent: React.FunctionComponent<NodePoolPanelProps> = (
return <Panel {...props} />;
};

const Panel: React.FunctionComponent<NodePoolPanelProps> = (props) => {
const Panel = (props: NodePoolPanelProps) => {
const {
addNodePool,
apiError,
Expand All @@ -57,6 +63,12 @@ const Panel: React.FunctionComponent<NodePoolPanelProps> = (props) => {
types,
} = props;

const {
isDiskEncryptionFeatureEnabled,
} = useIsDiskEncryptionFeatureEnabled();

const regions = useRegionsQuery().data ?? [];

const [typeCountMap, setTypeCountMap] = React.useState<Map<string, number>>(
new Map()
);
Expand All @@ -81,17 +93,27 @@ const Panel: React.FunctionComponent<NodePoolPanelProps> = (props) => {
setSelectedType(planId);
};

const regionSupportsDiskEncryption = doesRegionSupportFeature(
selectedRegionId ?? '',
regions,
'Disk Encryption'
);

return (
<Grid container direction="column">
<Grid>
<KubernetesPlansPanel
copy={
isDiskEncryptionFeatureEnabled && regionSupportsDiskEncryption
? ADD_NODE_POOLS_DESCRIPTION
: 'Add groups of Linodes to your cluster. You can have a maximum of 100 Linodes per node pool.'
}
getTypeCount={(planId) =>
typeCountMap.get(planId) ?? DEFAULT_PLAN_COUNT
}
types={extendedTypes.filter(
(t) => t.class !== 'nanode' && t.class !== 'gpu'
)} // No Nanodes or GPUs in clusters
copy="Add groups of Linodes to your cluster. You can have a maximum of 100 Linodes per node pool."
error={apiError}
hasSelectedRegion={hasSelectedRegion}
header="Add Node Pools"
Expand Down
Loading