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(KFLUXUI-175): give up SpaceBindingRequest and enjoy RoleBinding #110

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

Conversation

testcara
Copy link
Contributor

@testcara testcara commented Feb 11, 2025

Fixes

KFLUXUI-175

Description

Konflux is migrating off workspace api and also the related SpaceBindingRequest.
For Konflux UI, we need to enjoy the shared Konflux cluster role and rolebinding for the namespace access and permission checks.

For the details:

We use k8swatch the konflux-public-info configmap to get the roles. then create/delete the rolebindings to the shared konflux clusterRole to support the UI actions.

More, the status of the user access list are removed.

Type of change

  • Feature
  • Bugfix
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Screen shots / Gifs for design review

In the recording, i did the following actions for testing:

  1. try to filter users -> PASS, filters work well.
  2. grant permission to user1 -> PASS, granting works for single username
  3. edit permission to user1 -> PASS, edit permission works well
  4. grant permission to user1 -> PASS, it reports error as expected.
  5. grant permission to multiple users -> PASS, granting works well for multiple usernames
  6. revoke permission to user1 -> PASS, the user is gone from the access lit.
Screen.Recording.2025-02-12.at.21.38.46.mov

How to test or reproduce?

Just enjoy the use access page as previous.
You can visit access list, grant access, edit access, revoke access like before.

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

return (
<TableData className={column.className}>
{roleMapLoading && column.className === rbTableColumnClasses.role ? (
<Skeleton />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We give up spinner and enjoy the skeleton here.

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 86.84211% with 25 lines in your changes missing coverage. Please review.

Project coverage is 80.14%. Comparing base (591f649) to head (80cbdb0).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...components/UserAccess/UserAccessForm/form-utils.ts 48.71% 20 Missing ⚠️
src/components/UserAccess/RBListRow.tsx 92.00% 2 Missing ⚠️
src/components/UserAccess/UserAccessListView.tsx 77.77% 2 Missing ⚠️
src/components/UserAccess/UserAccessListPage.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
+ Coverage   80.10%   80.14%   +0.04%     
==========================================
  Files         577      546      -31     
  Lines       21495    21203     -292     
  Branches     5064     5320     +256     
==========================================
- Hits        17219    16994     -225     
+ Misses       4252     4184      -68     
- Partials       24       25       +1     
Flag Coverage Δ
unittests 80.14% <86.84%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/components/UserAccess/RBListHeader.tsx 100.00% <100.00%> (ø)
src/components/UserAccess/RevokeAccessModal.tsx 96.29% <100.00%> (ø)
...nents/UserAccess/UserAccessForm/EditAccessPage.tsx 100.00% <100.00%> (+100.00%) ⬆️
...nts/UserAccess/UserAccessForm/PermissionsTable.tsx 100.00% <100.00%> (ø)
...mponents/UserAccess/UserAccessForm/RoleSection.tsx 100.00% <100.00%> (ø)
...s/UserAccess/UserAccessForm/UserAccessFormPage.tsx 82.97% <100.00%> (-0.75%) ⬇️
...ents/UserAccess/UserAccessForm/UsernameSection.tsx 97.56% <100.00%> (+3.22%) ⬆️
src/components/UserAccess/index.ts 0.00% <ø> (ø)
src/components/UserAccess/user-access-actions.ts 95.23% <100.00%> (+0.23%) ⬆️
src/hooks/useKonfluxPublicInfo.ts 100.00% <100.00%> (ø)
... and 13 more

... and 36 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 591f649...80cbdb0. Read the comment docs.


return (
<>
<FormSection title="Assign role">
<DropdownField
className="role-section"
name="role"
placeholder="Select role"
placeholder={roleMapLoading ? 'Loading...' : 'Select role'}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As suggested, we remove the spinner disable the drop-down with 'Loading' before the roleMap is ready.

import React from 'react';
import { useK8sWatchResource } from '../k8s';
import { ConfigMapGroupVersionKind, ConfigMapModel } from '../models';
import { KonfluxPublicInfo, KonfluxPublicInfoConfigMap } from '../types/konfluxPublicInfo';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As suggested, the separate hook for konflux public info and related types has been created.

<Alert variant={AlertVariant.info} title="Username not validated" isInline>
Konflux is no longer validating the username except for its format. Please make sure that
the usernames are correct before proceeding.
</Alert>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As suggested by ux team, they consider Info Alert without close button is better.

@testcara testcara force-pushed the KFLUXUI-175 branch 2 times, most recently from 4894b58 to 55a1203 Compare February 11, 2025 09:06
@testcara
Copy link
Contributor Author

@sahil143 , hi, Sahil, I refreshed the PR with your latest suggestions and added comments in the target review place.
BTW, I am really sorry. I did something accidentally when I tried to rebase the PR to latest main branch, which closed the original PR and could not be reopened. Hope it does not bring too much inconvenience to you.

@testcara
Copy link
Contributor Author

testcara commented Feb 12, 2025

The ux related parts of the PR follows the page https://docs.google.com/document/d/1Iu5s0pkUZnLSHElpI2-iATo2RctUsEkq4_PBj3yuD_M/edit?tab=t.0.
Although the doc has not been signed off by the stakeholders, but i guess it is till fine to review and merge.

@testcara testcara force-pushed the KFLUXUI-175 branch 2 times, most recently from 3683ee6 to 070ab1e Compare February 12, 2025 13:08
@testcara
Copy link
Contributor Author

FYI, The recording is the latest one. I also explained test points for it. Hope it is useful to review. Thank you so much.

Key Points:
1. We watch the konflux-public-info configmap to get the roles.
2. For editing role, we create one one then delete obsoleted one.
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.

1 participant