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

feat: [LKEAPIFW-428] LKE clusters should have IP ACL integration on CM (part 1) #10968

Merged
merged 40 commits into from
Oct 22, 2024

Conversation

talmai
Copy link
Contributor

@talmai talmai commented Sep 19, 2024

Description 📝

Enables creation of LKE clusters with IP ACLS; enables updates of already migrated clusters

Changes 🔄

  • Adds new UI components
  • adds respective library calls
  • some style cleanup

*** tests will be in separate PRs: #11131 and #11132

Target release date 🗓️

Oct 28th release

Preview 📷

Cluster creation:

Cluster summary:

IPACL enabled IPACL not enabled
Screenshot 2024-09-04 at 14 47 05 Screenshot 2024-10-08 at 18 28 48

New IPACL Drawer:

Cluster migrated (IPACL enabled/not enabled) Cluster not yet migrated
Screenshot 2024-09-04 at 14 47 05 Screenshot 2024-10-08 at 18 28 48

How to test 🧪

Spin up this branch, update to reach alpha's apinext backend. Once all set, attempt to create new clusters with ipacls and then update them.

For release testing: you should also be able to create clusters in the prod env, but for creating clusters without IPACL, see Talmai's comment (and use the prod env)

Prerequisites

See how to test

Verification steps

  • Create a Cluster with IPACL enabled (toggled on). Confirm button on summary page lists number of IPs added
  • Create a Cluster with IPACL disabled (toggled off). Confirm button on summary page says 'Enable'. If you added any IPs, confirm they show up in the drawer
  • Create a Cluster that does not have IPACL. Confirm button on summary page says 'Enable' (it will take several seconds to load) and that drawer matches the screenshot for 'Cluster not yet migrated'. Update/toggle IPACL, confirm flow now follows a cluster with IPACL enabled
    • See Talmai's comment for how to create these clusters. I'v also just been creating clusters on alpha (but not on this branch/using the develop branch), and then going back to this branch
    • general spotcheck of Kubernetes with both the APL flag on and off

As an Author I have considered 🤔

Check all that apply

  • ✅ 👀 Doing a self review
  • ✅ ❔ Our contribution guidelines
  • ✅ 🤏 Splitting feature into small PRs
  • [NO see comment] ➕ Adding a changeset
  • [NO ] 🧪 Providing/Improving test coverage
  • ✅ 🔐 Removing all sensitive information from the code and PR description
  • [NO] 🚩 Using a feature flag to protect the release
  • ✅ 👣 Providing comprehensive reproduction steps
  • [NO] 📑 Providing or updating our documentation
  • [NO] 🕛 Scheduling a pair reviewing session
  • [N/A] 📱 Providing mobile support
  • [N/A] ♿ Providing accessibility support

@talmai talmai requested a review from a team as a code owner September 19, 2024 06:05
@talmai talmai requested review from bnussman-akamai and coliu-akamai and removed request for a team September 19, 2024 06:05
@bnussman-akamai bnussman-akamai added the LKE Related to Linode Kubernetes Engine offerings label Sep 19, 2024
@jcallahan-akamai
Copy link
Contributor

Thanks for the contribution @talmai. Would you please move this to Draft until it's ready to be reviewed?

@bnussman-akamai bnussman-akamai marked this pull request as draft September 19, 2024 16:07
@abailly-akamai abailly-akamai self-requested a review October 1, 2024 13:18
@talmai talmai force-pushed the feature/lkeapifw-428 branch from 7b7310e to 4cd457e Compare October 1, 2024 15:27
@talmai talmai force-pushed the feature/lkeapifw-428 branch from 8870af0 to 265a3ca Compare October 2, 2024 20:06
@talmai talmai marked this pull request as ready for review October 2, 2024 20:19
@talmai
Copy link
Contributor Author

talmai commented Oct 2, 2024

Can someone help me get the changeset together? I keep hitting the following error:

toliveir@bos-mpdj0 manager % yarn changeset
yarn run v1.22.22
$ node scripts/changelog/changeset.mjs

======================================================

Failed to get pull request number.
Please open a pull request for the current branch and let's try this again!

➔ Error: Pull request number not found.

======================================================

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
toliveir@bos-mpdj0 manager % yarn changeset
yarn run v1.22.22
$ node scripts/changelog/changeset.mjs

======================================================

Failed to get pull request number.
Please open a pull request for the current branch and let's try this again!

➔ Error: Pull request number not found.

======================================================

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@abailly-akamai abailly-akamai removed their request for review October 2, 2024 20:36
@coliu-akamai
Copy link
Contributor

coliu-akamai commented Oct 2, 2024

Just pushed up a changeset! (I had to run the gh repo set-default command and set linode/manager as the default repo - not sure what could have caused this)
edit: forgot one for the api-v4 package, so just pushed up another changeset for that too

Giving a quick glance over the files - seems like there are a few new components and flows. Will there be test coverage added later/is there a ticket for it already?

Copy link

github-actions bot commented Oct 2, 2024

Coverage Report:
Base Coverage: 87.08%
Current Coverage: 87.01%

@jdamore-linode
Copy link
Contributor

Hi @talmai! I'm seeing a test has failed repeatedly in lke-create.spec.ts against this branch. Would you mind taking a quick look? We can disregard if it's unrelated to your PRs changes.

yarn && yarn build && yarn start:manager:ci, then in another console:

yarn cy:run -s "cypress/e2e/core/kubernetes/lke-create.spec.ts"

(You might have to follow our Cypress first time setup docs, but feel free to reach out on Slack if you have any questions or run into any trouble)

@coliu-akamai
Copy link
Contributor

Thanks Talmai! Overall this is looking really solid! 🎉
Will also reach out to Daniel to set up a UX review

✅ Tested the following flows so far:

  • Creating LKE clusters with only IPv4 IPs, only IPv6s, both, and having IP ACL disabled (and then later enabled via drawer)
  • Validation/API error handling for nonsense IPs for both the create flow and the drawer
  • Adding/updating/removing IPs in the drawer
  • Enabling/disabling IP ACL in the drawer

Still need to go through the code, had a few questions/comments with what I tested:

  • Should there be error handling for when I enter the same IP twice? This will say two IP addresses in the cluster summary's IPACL section, but the IPs are the same:
  • There's some extra spacing at the bottom of the HA Control Plane on the Create flow now (in comparison to the top of the section):
  • On prod, because there's no IP ACL section yet, there's an extra divider:
  • in the drawer, the API error appears in the IP section but in the create flow, the error appears at the top of the page - wondering if there should be consistency? (and wondering how other pages/drawers handle this - will need to check)

  • In the Create flow: if I type a bad IP, then flip off the Enable IPACL toggle, and try to create a cluster, the bad IP will still get sent to the backend and trigger an error - wondering if toggling off 'Enable ACL' should clear the IPs that might still exist there

Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Let me know when you need a final review!

packages/manager/src/queries/kubernetes.ts Outdated Show resolved Hide resolved
packages/manager/src/queries/kubernetes.ts Outdated Show resolved Hide resolved
@@ -58,3 +59,28 @@ export const createKubeClusterSchema = object().shape({
.of(nodePoolSchema)
.min(1, 'Please add at least one node pool.'),
});

export const ipv4Address = string().test({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout. Nice job using validation here. Looks clean and seems to work work well with react hook form

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This poor form 😭

It really needs the react-hook-form treatment.

This looks good for now, but hopefully we can find some time in the future to refactor this page.

Copy link
Member

@bnussman-akamai bnussman-akamai Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do wonder if it would make sense to just not use MultipleIPInput at all for cases like this (in the future. we can leave it for now unless you want to do more work 😅 ). I do think abstractions are good, but I feel like building the same thing without the abstraction is also fine. MultipeIPInput just seems a bit rigid and doesn't enable us to be as flexible. For example, I wonder if react-hook-form's useFieldArray could be used for the IPs (similar to packages/manager/src/features/Linodes/LinodeCreate/VPC/VPCRanges.tsx) if we weren't locked into using MultipleIPInput .

Most of that is me thing thinking out-loud, but what you did here seems fair to me.

Copy link
Contributor

@coliu-akamai coliu-akamai Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅 I'm gonna leave as is for now since I still need to finish the e2e tests, but will hopefully revisit this down the line! Maybe this could be part of the work for transitioning ClusterCreate to react-hook-form, since that also uses MultipleIPInput

update: [M3-8777]

Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coliu-akamai Fantastic job taking over a large PR that should have been broken down in the first place. Should have been flagged right away and rejected in its current shape. It's really hard to digest and ended up taking far more time it would have taken to make several small PRs.

I am going to spend some extra time with the UI in the coming days but so far I have not caught any issue with the UI & functionality. Left some minor comments and will get back to this, with fresh eyes a bit later.

Screenshot 2024-10-21 at 10 14 28

Screenshot 2024-10-21 at 10 35 31

packages/api-v4/src/kubernetes/kubernetes.ts Show resolved Hide resolved

export interface ControlPlaneACLOptions {
enabled?: boolean;
'revision-id'?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems quite unusual for the API to introduce a hyphened id property. It doesn't usually play very well with downstream consumers...

Comment on lines +135 to +138
forVPCIPv4Ranges || isLinkStyled ? (
<StyledLinkButtonBox sx={{ marginTop: isLinkStyled ? '8px' : '12px' }}>
<LinkButton onClick={addNewInput}>{buttonText}</LinkButton>
</StyledLinkButtonBox>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just pass SX ?

const payload: KubernetesControlPlaneACLPayload = {
acl: {
enabled: acl.enabled,
'revision-id': acl['revision-id'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comment above.. not this PR's fault, but... why

packages/validation/src/firewalls.schema.ts Show resolved Hide resolved
packages/validation/src/firewalls.schema.ts Show resolved Hide resolved
packages/manager/src/queries/kubernetes.ts Outdated Show resolved Hide resolved
@coliu-akamai
Copy link
Contributor

@abailly-akamai

  • double checked regarding the drawer - we're wanting to allow people to update IPs and tag it with a revision ID independent of enabling ACL
  • created internal ticket for LKE summary mobile/smaller views! [M3-8764]

Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great on my end - I did not find functionality issues after the second pass, tho I may still miss some context on the feature as a whole. Thanks for taking this to the finish line @coliu-akamai

@coliu-akamai coliu-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Oct 22, 2024
@coliu-akamai coliu-akamai merged commit 8b9d956 into linode:develop Oct 22, 2024
23 checks passed
Copy link

cypress bot commented Oct 22, 2024

Cloud Manager E2E    Run #6715

Run Properties:  status check passed Passed #6715  •  git commit 8b9d956cb1: feat: [LKEAPIFW-428] LKE clusters should have IP ACL integration on CM (part 1) ...
Project Cloud Manager E2E
Branch Review develop
Run status status check passed Passed #6715
Run duration 29m 04s
Commit git commit 8b9d956cb1: feat: [LKEAPIFW-428] LKE clusters should have IP ACL integration on CM (part 1) ...
Committer Talmai Oliveira
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 5
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 438
View all changes introduced in this branch ↗︎

@@ -30,12 +29,8 @@ export const KubernetesClusterDetail = () => {
const id = Number(clusterID);
const location = useLocation();
const showAPL = useGetAPLAvailability();
const kubernetesClusterBetaQuery = useKubernetesClusterBetaQuery(id);
Copy link

@j-zimnowoda j-zimnowoda Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@talmai , why this was removed ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we consolidated the logic for this query with the already existing kubernetesClusterQuery so that we'd only need one query key. The functionality should still exist, it's just been moved. Apologies if this caused any confusion!

see here for reasoning/discussion for the change, and here for the file changes (lines 112-118)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! LKE Related to Linode Kubernetes Engine offerings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants