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
Enhancement doc to customize default pre-pinned resources on navigation #1285
Enhancement doc to customize default pre-pinned resources on navigation #1285
Conversation
/cc @jerolimov |
/assign @spadgett |
c025edb
to
3d6c007
Compare
3d6c007
to
35f201c
Compare
35f201c
to
043aadc
Compare
ff115f8
to
427776b
Compare
427776b
to
4931427
Compare
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.
Just two nits and the recommendation to split the risk issues from the mitigations:
4931427
to
77bb7e3
Compare
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 don't have much feedback to add here right now, will continue the API review on the API PR and then I'd like to see this updated once we've cleared things up there, but otherwise, looks sensible
77bb7e3
to
4530d6c
Compare
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.
Lgtm!
/cc @JoelSpeed @spadgett
1012e8d
to
ca77510
Compare
If the `pinnedResources` list is non-empty, only the listed items will be shown if the user hasn't already customized the navigation items. | ||
If the `group`, `version` or `resource` is incorrect, the resource to be pinned will be ignored. | ||
|
||
Note: The Administrator perspective (id="admin") doesn't support pinned resources at the moment and can be excluded via CEL validation. |
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.
What about unrecognized perspectives / perspectives contributed by plugins?
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.
So, should we update the CEL to allow adding pinnedResources only to the "dev" perspective?
cc @jerolimov
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.
If I'm correct, all other perspectives then admin supports pinned resources. All would use https://github.com/openshift/console/blob/master/frontend/packages/console-app/src/components/nav/PerspectiveNav.tsx
We just disable deny to configure it for the admin perspective.
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.
Hm, I don't see a way to pin resources to the "All Clusters" perspective for ACM/MCE when I test it in the UI. We should double check this.
@jerolimov We should also test that we don't have a race condition here:
We perform API discovery asynchronously, and the cached resources won't always match the current on initial console load. Also on first load there will be no cached resources, which could hide links to some resources when a user first uses the console. Really we should react when the models change.
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.
Hm, I don't see a way to pin resources to the "All Clusters" perspective for ACM/MCE when I test it in the UI. We should double check this.
I have updated this to:
Note: The Administrator perspective (id="admin") and "All Clusters" perspective for ACM/MCE (id="acm") doesn't support pinned resources at the moment and can be excluded via CEL validation.
@jerolimov We should also test that we don't have a race condition here:
We perform API discovery asynchronously, and the cached resources won't always match the current on initial console load. Also on the first load there will be no cached resources, which could hide links to some resources when a user first uses the console. Really we should react when the models change.
We tested this by clearing the local storage and then refreshed the page and here's a small recording of that, please let us know if there's any other way to test this:
Screen.Recording.2022-12-13.at.7.51.39.PM.mov
|
||
If the `pinnedResources` list is empty, the default pinned resources contributed by the console UI extension plugin will be shown. | ||
If the `pinnedResources` list is non-empty, only the listed items will be shown if the user hasn't already customized the navigation items. | ||
If the `group`, `version` or `resource` is incorrect, the resource to be pinned will be ignored. |
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.
What do you mean by "incorrect"? Do you mean the resource doesn't exist on the cluster?
Have we considered how this will work with multi-cluster in 4.13 where console talks to different clusters that might have different sets of resources?
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.
Pinned resources aren't shown when the CRD (model) isn't found. So switching should not be an issue.
And isn't the customization configuration per cluster? Is the index and Server flags reloaded when Switching a cluster?
We should def. test this.
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.
When switching between clusters the invalid resources should disappear. We will test this
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.
The console customization comes from the hub since that is where the console is running. We don't read console configuration from the spoke clusters.
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 would clarify in the enhancement what you mean by "incorrect" here.
### Risks and Mitigations | ||
|
||
**Risk 1:** A cluster admin configures an invalid combination of API/Group/Version | ||
Mitigation: Invalid combination of group, version and resource will not be shown to users. The cluster admin interface can show them with a warning. |
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.
Where is the warning displayed?
I'd probably only show the warning to admins who have permission to fix the problem.
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.
we have added a regex to validate if the values entered for resource, version, and group are correct
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.
We can show the warning just in the "console cluster configuration" UI, where the admin can configure it.
We now the available CRDs there and can show configured entries that will not shown to the user because there is no CRD/resource available.
Like this:
perspectives:
id: dev
pinnedResources:
- resource: Secret
- resource: Pipelinee # wrong with two e
The UI could show:
- (S) Secret
- (P) Pipelinee
⚠️ with a tooltip "Missing CRD, this pinned resource might not be shown."
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.
@lokanandaprabhu please take care of invalid configurations in the UI and show them anyway with such a warning.
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.
This gets a bit tricky since we do API discovery in the background, but I wouldn't show a permanent warning to users who don't have a way to fix the problem. Normal users won't be able to edit this config. It would be better to hide the nav item IMO.
I guess there is the case where the user pins a custom resource themselves and then the CRD is removed, but we don't have a way to tell, correct?
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.
when the user pins a custom resource themselves and the CRD is removed, the pinned resource is no longer shown on the navigation.
After discussing this with @jerolimov, we would show a warning alert icon on the customization form for the unrecognized resource, on the navigation the user would only see the recognized ones.
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.
After discussing this with @jerolimov, we would show a warning alert icon on the customization form for the unrecognized resource, on the navigation the user would only see the recognized ones.
Sounds good to me.
We should clarify again what we mean by "incorrect" here. "Missing" might be a better term.
Mitigation: Invalid combination of group, version and resource will not be shown to users. The cluster admin interface can show them with a warning. | ||
|
||
**Risk 3:** Currently, also if the user have not customized the pinned resources, the default settings are saved in user settings. After the update we can not determinate if the user touched them or not. | ||
Mitigation: For existing users where the saved pinned resources matches exactly the default pinned resources (from the perspective), the UI will show the customized default pinned resource (changed by the cluster admin). |
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.
Won't this only catch the first time an admin changes the pinned resources? For instance, if the admin adds deployments one week and config maps the next... The config maps won't get added since the previous user setting was not the default (even if the user didn't customize anything).
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.
We have three buckets with pinned resources per perspective
- Pinned resources from the perspective
- Pinned resources from the customization
- Pinned resources from the user settings
We should NOT save pinned resources until the user changes them manually (Add/Remove/Reorder). Unluckily we do this at the moment. So would recommend changing this, and then we need also to migrate the old data.
I hope we can do this while loading the data the first time like this:
- If the user has pinned resources in the user settings:
- If these from the user settings are "deep" equal to the pinned resources from the perspective => delete the PR from user settings.
- Otherwise use the pinned resources from the user settings.
- If there are pinned resources in the customization use them
- Fallback to the pinned resources from the plugin definition.
We could also think about a more explicit migration, but I would keep it simple here and just compare both lists. As long as the user settings contains pinned resource = Secret+ConfigMap I would expect that the user doesn't touched them.
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.
@jerolimov's proposal here looks reasonable to me. We should update the enhancement to cover this.
ca77510
to
413cff8
Compare
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.
No major concerns. Thanks @debsmita1
|
||
If the `pinnedResources` list is empty, the default pinned resources contributed by the console UI extension plugin will be shown. | ||
If the `pinnedResources` list is non-empty, only the listed items will be shown if the user hasn't already customized the navigation items. | ||
If the `group`, `version` or `resource` is incorrect, the resource to be pinned will be ignored. |
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 would clarify in the enhancement what you mean by "incorrect" here.
If the `pinnedResources` list is non-empty, only the listed items will be shown if the user hasn't already customized the navigation items. | ||
If the `group`, `version` or `resource` is incorrect, the resource to be pinned will be ignored. | ||
|
||
Note: The Administrator perspective (id="admin") and "All Clusters" perspective for ACM/MCE (id="acm") doesn't support pinned resources at the moment and can be excluded via CEL validation. |
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 don't think other perspectives contributed by plugins will get pinned resources by default. We should clarify that here. Basically at the moment, we should only allow this for the dev perspective (unless I'm mistaken).
### Risks and Mitigations | ||
|
||
**Risk 1:** A cluster admin configures an invalid combination of API/Group/Version | ||
Mitigation: Invalid combination of group, version and resource will not be shown to users. The cluster admin interface can show them with a warning. |
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.
After discussing this with @jerolimov, we would show a warning alert icon on the customization form for the unrecognized resource, on the navigation the user would only see the recognized ones.
Sounds good to me.
We should clarify again what we mean by "incorrect" here. "Missing" might be a better term.
Mitigation: Invalid combination of group, version and resource will not be shown to users. The cluster admin interface can show them with a warning. | ||
|
||
**Risk 3:** Currently, also if the user have not customized the pinned resources, the default settings are saved in user settings. After the update we can not determinate if the user touched them or not. | ||
Mitigation: For existing users where the saved pinned resources matches exactly the default pinned resources (from the perspective), the UI will show the customized default pinned resource (changed by the cluster admin). |
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.
@jerolimov's proposal here looks reasonable to me. We should update the enhancement to cover this.
413cff8
to
3789aa9
Compare
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.
/lgtm
/hold
@JoelSpeed did you have any other concerns before we merge? Feel free to remove the hold if not.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jerolimov, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@debsmita1: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/lgtm |
JIRA:
https://issues.redhat.com/browse/ODC-7181
Epic:
https://issues.redhat.com/browse/ODC-5012