Skip to content

Commit

Permalink
upcoming: [M3-8031] – Add Disk Encryption info banner to Kubernetes l…
Browse files Browse the repository at this point in the history
…anding page (linode#10546)
  • Loading branch information
dwiley-akamai authored Jun 11, 2024
1 parent 2fa3151 commit 2692d92
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 6 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10546-tests-1717604850412.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Add assertions regarding Disk Encryption info banner to lke-landing-page.spec.ts ([#10546](https://github.com/linode/manager/pull/10546))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Add Disk Encryption info banner to Kubernetes landing page ([#10546](https://github.com/linode/manager/pull/10546))
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,70 @@ import {
mockGetClusterPools,
mockGetKubeconfig,
} from 'support/intercepts/lke';
import { kubernetesClusterFactory, nodePoolFactory } from 'src/factories';
import {
accountFactory,
kubernetesClusterFactory,
nodePoolFactory,
} from 'src/factories';
import { getRegionById } from 'support/util/regions';
import { readDownload } from 'support/util/downloads';
import { ui } from 'support/ui';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { mockGetAccount } from 'support/intercepts/account';

describe('LKE landing page', () => {
it('does not display a Disk Encryption info banner if the LDE feature is disabled', () => {
// Mock feature flag -- @TODO LDE: Remove feature flag once LDE is fully rolled out
mockAppendFeatureFlags({
linodeDiskEncryption: makeFeatureFlagData(false),
}).as('getFeatureFlags');
mockGetFeatureFlagClientstream().as('getClientStream');

// Mock responses
const mockAccount = accountFactory.build({
capabilities: ['Linodes', 'Disk Encryption'],
});

mockGetAccount(mockAccount).as('getAccount');

// Intercept request
cy.visitWithLogin('/kubernetes/clusters');
cy.wait('@getAccount');

// Check if banner is visible
cy.findByText('Disk encryption is now standard on Linodes.').should(
'not.exist'
);
});

it('displays a Disk Encryption info banner if the LDE feature is enabled', () => {
// Mock feature flag -- @TODO LDE: Remove feature flag once LDE is fully rolled out
mockAppendFeatureFlags({
linodeDiskEncryption: makeFeatureFlagData(true),
}).as('getFeatureFlags');
mockGetFeatureFlagClientstream().as('getClientStream');

// Mock responses
const mockAccount = accountFactory.build({
capabilities: ['Linodes', 'Disk Encryption'],
});

mockGetAccount(mockAccount).as('getAccount');

// Intercept request
cy.visitWithLogin('/kubernetes/clusters');
cy.wait('@getAccount');

// Check if banner is visible
cy.contains('Disk encryption is now standard on Linodes.').should(
'be.visible'
);
});

/*
* - Confirms that LKE clusters are listed on landing page.
*/
Expand Down
28 changes: 23 additions & 5 deletions packages/manager/src/components/DiskEncryption/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,38 @@ export const DISK_ENCRYPTION_GENERAL_DESCRIPTION = (
</>
);

export const DISK_ENCRYPTION_DESCRIPTION_NODE_POOL_REBUILD_CAVEAT =
'Encrypt Linode data at rest to improve security. The disk encryption setting for Linodes added to a node pool will not be changed after rebuild.';
const DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_DOCS_LINK =
'https://www.linode.com/docs/products/compute/compute-instances/guides/local-disk-encryption/';

export const DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_COPY = (
<>
Disk encryption is now standard on Linodes.{' '}
<Link to={DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_DOCS_LINK}>
Learn how
</Link>{' '}
to update and protect your clusters.
</>
);

export const DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_BANNER_KEY =
'disk-encryption-update-protect-clusters-banner';

export const DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY =
'Disk encryption is not available in the selected region.';

export const DISK_ENCRYPTION_BACKUPS_CAVEAT_COPY =
'Virtual Machine Backups are not encrypted.';

// Guidance
export const DISK_ENCRYPTION_NODE_POOL_GUIDANCE_COPY =
'To enable disk encryption, delete the node pool and create a new node pool. New node pools are always encrypted.';

export const UNENCRYPTED_STANDARD_LINODE_GUIDANCE_COPY =
'Rebuild this Linode to enable or disable disk encryption.';

// Caveats
export const DISK_ENCRYPTION_DESCRIPTION_NODE_POOL_REBUILD_CAVEAT =
'Encrypt Linode data at rest to improve security. The disk encryption setting for Linodes added to a node pool will not be changed after rebuild.';

export const DISK_ENCRYPTION_BACKUPS_CAVEAT_COPY =
'Virtual Machine Backups are not encrypted.';

export const DISK_ENCRYPTION_IMAGES_CAVEAT_COPY =
'Virtual Machine Images are not encrypted.';
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import * as React from 'react';
import { useHistory } from 'react-router-dom';

import { CircleProgress } from 'src/components/CircleProgress';
import {
DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_BANNER_KEY,
DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_COPY,
} from 'src/components/DiskEncryption/constants';
import { useIsDiskEncryptionFeatureEnabled } from 'src/components/DiskEncryption/utils';
import { DismissibleBanner } from 'src/components/DismissibleBanner/DismissibleBanner';
import { DocumentTitleSegment } from 'src/components/DocumentTitle';
import { ErrorState } from 'src/components/ErrorState/ErrorState';
import { Hidden } from 'src/components/Hidden';
Expand All @@ -15,6 +21,7 @@ import { TableHead } from 'src/components/TableHead';
import { TableRow } from 'src/components/TableRow';
import { TableSortCell } from 'src/components/TableSortCell';
import { TransferDisplay } from 'src/components/TransferDisplay/TransferDisplay';
import { Typography } from 'src/components/Typography';
import { useOrder } from 'src/hooks/useOrder';
import { usePagination } from 'src/hooks/usePagination';
import { useKubernetesClustersQuery } from 'src/queries/kubernetes';
Expand Down Expand Up @@ -92,6 +99,10 @@ export const KubernetesLanding = () => {
filter
);

const {
isDiskEncryptionFeatureEnabled,
} = useIsDiskEncryptionFeatureEnabled();

const openUpgradeDialog = (
clusterID: number,
clusterLabel: string,
Expand Down Expand Up @@ -149,6 +160,17 @@ export const KubernetesLanding = () => {
return (
<>
<DocumentTitleSegment segment="Kubernetes Clusters" />
{isDiskEncryptionFeatureEnabled && (
<DismissibleBanner
preferenceKey={DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_BANNER_KEY}
sx={{ margin: '1rem 0 1rem 0' }}
variant="info"
>
<Typography>
{DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_COPY}
</Typography>
</DismissibleBanner>
)}
<LandingHeader
docsLink="https://www.linode.com/docs/kubernetes/deploy-and-manage-a-cluster-with-linode-kubernetes-engine-a-tutorial/"
entity="Cluster"
Expand Down

0 comments on commit 2692d92

Please sign in to comment.