-
Notifications
You must be signed in to change notification settings - Fork 361
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-8020] – Add "Disk Encryption" section to Linode Rebuild modal #10549
upcoming: [M3-8020] – Add "Disk Encryption" section to Linode Rebuild modal #10549
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diff generated by linter
const determineEncryptDiskDisabledReason = ({ | ||
isLKELinode, | ||
linodeIsInDistributedRegion, | ||
regionSupportsDiskEncryption, | ||
}: { | ||
isLKELinode: boolean | undefined; | ||
linodeIsInDistributedRegion: boolean | undefined; | ||
regionSupportsDiskEncryption: boolean; | ||
}) => { | ||
if (isLKELinode) { | ||
return ENCRYPT_DISK_DISABLED_REBUILD_LKE_REASON; | ||
} | ||
|
||
if (linodeIsInDistributedRegion) { | ||
return ENCRYPT_DISK_DISABLED_REBUILD_DISTRIBUTED_REGION_REASON; | ||
} | ||
|
||
if (!regionSupportsDiskEncryption) { | ||
return DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY; | ||
} | ||
|
||
return ''; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I preferred this over the initial commit's nested ternaries
const encryptDiskDisabledReason = isLKELinode
? ENCRYPT_DISK_DISABLED_REBUILD_LKE_REASON
: linodeIsInDistributedRegion
? ENCRYPT_DISK_DISABLED_REBUILD_DISTRIBUTED_REGION_REASON
: !regionSupportsDiskEncryption
? DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY
: '';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much nicer indeed :D - switch statement is also a good option for readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR! well tested and documented
Was able to confirm:
- for a non-LKE linode in Newark, the "Encrypt Disk" checkbox in the Rebuild modal should be enabled and you should be able to successfully rebuild it ✅
- for an LKE linode, the "Encrypt Disk" checkbox in the Rebuild modal should be disabled with tooltip text reading: The Encrypt Disk setting cannot be changed for a Linode attached to a node pool. ✅
- for a linode in a Distributed region, the "Encrypt Disk" checkbox in the Rebuild modal should be disabled with tooltip text reading: The Encrypt Disk setting cannot be changed for distributed instances. ✅
and confirmed it is also still disabled in unsupported regions (ex: London)
const determineEncryptDiskDisabledReason = ({ | ||
isLKELinode, | ||
linodeIsInDistributedRegion, | ||
regionSupportsDiskEncryption, | ||
}: { | ||
isLKELinode: boolean | undefined; | ||
linodeIsInDistributedRegion: boolean | undefined; | ||
regionSupportsDiskEncryption: boolean; | ||
}) => { | ||
if (isLKELinode) { | ||
return ENCRYPT_DISK_DISABLED_REBUILD_LKE_REASON; | ||
} | ||
|
||
if (linodeIsInDistributedRegion) { | ||
return ENCRYPT_DISK_DISABLED_REBUILD_DISTRIBUTED_REGION_REASON; | ||
} | ||
|
||
if (!regionSupportsDiskEncryption) { | ||
return DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY; | ||
} | ||
|
||
return ''; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much nicer indeed :D - switch statement is also a good option for readability
@@ -51,11 +57,24 @@ export const LinodeRebuildDialog = (props: Props) => { | |||
const unauthorized = isReadOnly; | |||
const disabled = hostMaintenance || unauthorized; | |||
|
|||
// LDE-related checks | |||
const isEncrypted = linode?.disk_encryption === 'enabled' ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isEncrypted = linode?.disk_encryption === 'enabled' ? true : false; | |
const isEncrypted = Boolean(linode?.disk_encryption === 'enabled' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing this to my attention, upon second look we should be fine with just the equality check
Coverage Report: ✅ |
Good job catching this edge case. I was able to follow the Verification Steps and did not notice find any issues with functionality or the UI. Approved ✅. |
Description 📝
Add "Disk Encryption" section to Linode Rebuild modal.
Note
I came across an existing edge case where it is possible that a field absent from the Rebuild dialog can still cause the Rebuild request to fail silently. See M3-8237.
Changes 🔄
isLKELinode
,linodeIsInDistributedRegion
, andisInRebuildFlow
props toAccessPanel.tsx
RebuildFromImage
&RebuildFromStackScript
Target release date 🗓️
6/24
Preview 📷
Screenshots
Standard Linode in a region that supports LDE:
Linode in Distributed region:
LKE Linode:
How to test 🧪
Prerequisites
linode_disk_encryption
tag on your accountVerification steps
Without the tag and/or with the LDE flag in our dev tool toggled off, you should not see any LDE-related things in the UI. Otherwise,
Secure this Linode using data at rest encryption. The disk encryption setting for Linodes added to a node pool will not be changed after rebuild.
The Encrypt Disk setting cannot be changed for a Linode attached to a node pool.
Distributed Compute Instances are secured using disk encryption.
The Encrypt Disk setting cannot be changed for distributed instances.
The last two cases can be easily tested by adjusting this code block as needed and turning the MSW on:
manager/packages/manager/src/mocks/serverHandlers.ts
Lines 768 to 778 in 0e2d367
Things should work when rebuilding from an image, a Community StackScript, and an Account StackScript.
Rebuilding an encrypted linode --> the "Encrypt Disk" checkbox should be checked already in the modal to reflect the current configuration
There should be no adverse effects observed if you switch to the prod environment and turn the feature flag off.
As an Author I have considered 🤔