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

Add create/edit/duplicate hardware profile page #3604

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

DaoDaoNoCode
Copy link
Member

@DaoDaoNoCode DaoDaoNoCode commented Dec 20, 2024

JIRA: RHOAIENG-16255

Description

Added the page to create/edit/duplicate hardware profile, which allows you to add/edit/remove node selectors and tolerations. The work for the identifiers(node resources) is implemented in #3565 so this PR doesn't include that part.

On create:
Screenshot 2024-12-20 at 2 47 25 PM

On update:
Screenshot 2024-12-20 at 2 48 00 PM
Screenshot 2024-12-20 at 2 48 08 PM

On duplicate:
All the other fields will get duplicated except the name description fields
Screenshot 2024-12-20 at 4 09 08 PM

Node selector modal:
Screenshot 2024-12-20 at 2 48 34 PM
Screenshot 2024-12-20 at 2 48 45 PM

Toleration modal:
Screenshot 2024-12-20 at 2 49 05 PM
Screenshot 2024-12-20 at 2 49 18 PM

Added last modified annotation:
Screenshot 2024-12-20 at 2 49 52 PM

How Has This Been Tested?

  1. Create a hardware profile
  2. Fill in data like name, descriptions, node selectors and tolerations
  3. Click create
  4. Edit that hardware profile
  5. Make sure everything is pre-filled correctly when editing
  6. Try to edit/remove the node selectors table and tolerations table
  7. Update the hardware profile
  8. Expand to make sure the update takes effect

Test Impact

Added cypress tests for the create/edit page

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

@DaoDaoNoCode
Copy link
Member Author

@vconzola Could you check the screenshots? Thanks!

@DaoDaoNoCode DaoDaoNoCode changed the title Add create/edit hardware profile page Add create/edit/duplicate hardware profile page Dec 20, 2024
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 97.28097% with 9 lines in your changes missing coverage. Please review.

Project coverage is 85.45%. Comparing base (e16863a) to head (1e00112).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...areProfiles/manage/ManageHardwareProfileFooter.tsx 82.85% 6 Missing ⚠️
...ages/hardwareProfiles/HardwareProfilesTableRow.tsx 57.14% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3604      +/-   ##
==========================================
+ Coverage   85.02%   85.45%   +0.43%     
==========================================
  Files        1403     1415      +12     
  Lines       32213    32499     +286     
  Branches     9032     9122      +90     
==========================================
+ Hits        27389    27772     +383     
+ Misses       4824     4727      -97     
Files with missing lines Coverage Δ
frontend/src/api/k8s/hardwareProfiles.ts 100.00% <100.00%> (+11.53%) ⬆️
...nd/src/pages/hardwareProfiles/HardwareProfiles.tsx 100.00% <100.00%> (+12.50%) ⬆️
.../pages/hardwareProfiles/HardwareProfilesRoutes.tsx 100.00% <ø> (ø)
...pages/hardwareProfiles/HardwareProfilesToolbar.tsx 100.00% <100.00%> (ø)
frontend/src/pages/hardwareProfiles/const.ts 100.00% <100.00%> (ø)
.../hardwareProfiles/manage/ManageHardwareProfile.tsx 100.00% <100.00%> (ø)
...reProfiles/manage/ManageHardwareProfileWrapper.tsx 100.00% <100.00%> (ø)
...dwareProfiles/manage/ManageNodeResourceSection.tsx 100.00% <100.00%> (ø)
...dwareProfiles/manage/ManageNodeSelectorSection.tsx 100.00% <100.00%> (ø)
...ardwareProfiles/manage/ManageTolerationSection.tsx 100.00% <100.00%> (ø)
... and 18 more

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e16863a...1e00112. Read the comment docs.

@vconzola
Copy link

vconzola commented Jan 2, 2025

@DaoDaoNoCode A couple comments...

  • The heading for the node selectors section should be "Node selectors", not "Node resources".
  • Once the tables are not empty, change the location of the Add buttons to the right of the section headings as noted in my recent comment in PR Node resource table and modals #3565

Otherwise, lgtm.

@DaoDaoNoCode
Copy link
Member Author

@vconzola Just saw your comments in another PR and was about to ask you for the button positions 😄 thanks, I will update them.

Copy link
Contributor

openshift-ci bot commented Jan 2, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign gkrumbach07 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@DaoDaoNoCode DaoDaoNoCode force-pushed the jira-rhoaieng-16255 branch 3 times, most recently from 56d6c3d to 39a71f6 Compare January 6, 2025 21:59
@pnaik1
Copy link
Contributor

pnaik1 commented Jan 8, 2025

@DaoDaoNoCode , I am unsure if this is related to your PR or has been discussed earlier, but while adding node resource only the cpu and memory resource identifier will have the units dropdown??

Screenshot 2025-01-08 at 7 11 27 PM

what if I want a scenario like this to have unit dropdown??
Screenshot 2025-01-08 at 7 09 29 PM
to add GIB unit

@pnaik1
Copy link
Contributor

pnaik1 commented Jan 8, 2025

  • The name already exists text doesn't appear when existing hardware profile name is typed
Screenshot 2025-01-08 at 7 39 58 PM

@dpanshug
Copy link
Contributor

dpanshug commented Jan 8, 2025

@DaoDaoNoCode , I am unsure if this is related to your PR or has been discussed earlier, but while adding node resource only the cpu and memory resource identifier will have the units dropdown??

Screenshot 2025-01-08 at 7 11 27 PM what if I want a scenario like this to have unit dropdown?? Screenshot 2025-01-08 at 7 09 29 PM to add GIB unit

@pnaik1 its good that you asked, @Gkrumbach07 can you clarify on this? Earlier we only discussed having unit dropdowns for CPU and Memory identifier, but in the mocks we can see units with other identifiers also.

@vconzola
Copy link

vconzola commented Jan 8, 2025

@dpanshug Where in the mocks do you see units on identifiers other than CPU and memory? They shouldn't be there. If you can point me to the mockups where I show this, I'll update them.

@dpanshug
Copy link
Contributor

dpanshug commented Jan 8, 2025

@dpanshug Where in the mocks do you see units on identifiers other than CPU and memory? They shouldn't be there. If you can point me to the mockups where I show this, I'll update them.

@vconzola here if you see identifier value is samsung.com/gddr7

Screenshot 2025-01-08 at 9 10 52 PM

@vconzola
Copy link

vconzola commented Jan 8, 2025

@dpanshug Ugh! So this is a bit of a problem. I guess I assumed because the label is RAM, you could tell it's a memory resource. But the label is just a label, right, so you ignore it? Is there any way for you to tell from the identifier what type of resource something is? Because for something like memory, without units, the numerical values are kind of meaningless.

I originally had a "Resource type" dropdown field as part of the form, but @Gkrumbach07 decided we didn't need it. Maybe we need to bring it back?

@DaoDaoNoCode
Copy link
Member Author

@vconzola hi, the identifier is unique and cannot be changeable, so for the preset RAM label and memory identifier, you should be able to change the label to Memory or anything you like, but the identifier should always be memory and that's what we will use in the workbench. For all the other identifiers other than cpu and memory, we don't need a unit.

@vconzola
Copy link

vconzola commented Jan 8, 2025

@DaoDaoNoCode That's not how @Gkrumbach07 explained it to me. (At least that's not what I understood.) The idea is that if a type of RAM is used that has a unique identifier (e.g., samsung.com/gddr7) that will replace the memory identifier, not be a new identifier.

@Gkrumbach07
Copy link
Member

Ok I did a quick search and while technically not required, cpu and memory are not required but highly recommended. Therefore I was wrong in thinking that the we needed a cpu and memory identifier. We should still set those as the defaults, but have no restriction on having them change any aspect of it. I guess also deleting them?

So @vconzola

  • you are right, they should be a able to change the identifier for the cpu and memory entries
  • do you still want to prevent deleting of those two. becuase they technically would be able to if they change the identifier to something other than cpu or ram. As that is what we check for to stop them from deleting

@vconzola
Copy link

vconzola commented Jan 8, 2025

@Gkrumbach07 My gut tells me we should not allow deleting resources with cpu or ram identifiers. But will that create a conflict if a user adds a new resource (e.g. samsung.com/mem) that's also a memory resource instead of editing the existing resource with ram identifier?

@Gkrumbach07
Copy link
Member

My gut tells me we should not allow deleting resources with cpu or ram identifiers. But will that create a conflict if a user adds a new resource (e.g. samsung.com/mem) that's also a memory resource instead of editing the existing resource with ram identifier?

@vconzola So the issue is as follows

  • user opens form with prefilled memory and cpu identifiers
  • user cannot delete those
  • user edits memory identifier to something else
  • now they can delete it

we can still block them from deleting, but if we allow changing the identifier, they have a work around to deleting it. For ultimate flexibility we can allow them to delete all but maybe adding a special warning if they try to delete cpu or ram

@vconzola
Copy link

vconzola commented Jan 8, 2025

allow them to delete all but maybe adding a special warning if they try to delete cpu or ram

@Gkrumbach07 I like that idea. Any idea what happens if they don't have a cpu or ram identifier? That will help inform what the warning should say.

@DaoDaoNoCode
Copy link
Member Author

@pnaik1 OK, after discussion on Slack https://redhat-internal.slack.com/archives/C07C0FNHVPT/p1736352212866699, we will let k8s throw the error when submitting if there is a duplicated k8s name. As for the display name, we allow duplication, and will show a popover next to the name in the table to indicate the k8s name on the cluster for users to better tell different hardware profiles, just like other k8s resources.
As for the unit and default CPU/Memory stuff, we will need to think of a better solution to deal with all the situations instead of arbitrarily creating cpu and memory identifiers and don't allow users to remove or edit (cc @Gkrumbach07). More discussions will be needed offline, and I will post the final decision here in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants