-
Notifications
You must be signed in to change notification settings - Fork 605
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
Update user settings hook to use bridge call to create ConfigMap #7327
Update user settings hook to use bridge call to create ConfigMap #7327
Conversation
/unassign @rhamilto @jhadvig |
1b8b14c
to
ffbbf90
Compare
/retest |
ffbbf90
to
8b786e7
Compare
/retest |
a1115d4
to
957112e
Compare
}; | ||
// Use JSON Merge Patch instead of normal JSON Patch because JSON Patch calls | ||
// fail if there is no data defined. | ||
const response = await coFetchJSON(url, 'PATCH', { |
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.
will it make sense to put this in try catch and return response or throw err there
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.
Unfortunately coFetchJSON
doesn't return a response, it returns already the parsed content. I can switch to coFetch and handle status code checking and response.json() myself. I will try that.
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.
Changed to coFetch
, please take a look
bcbd77a
to
b06c1a7
Compare
I'm not happy with the unit tests yet. I currently rework them, I don't expect a change in the hook. |
|
Settings saved and loaded as expected for kubeadmin user in local dev. |
b06c1a7
to
5b51ea1
Compare
@invincibleJai Can you please double check the unit tests, hope you are fine with them. @christianvogt Fixed the get/set user settings script as well. Works now fine with other users. Also added the option to fetch other user settings from other usernames. ➜ contrib/oc-get-user-settings.sh
Get ConfigMap "user-settings-kubeadmin" from namespace "openshift-console-user-settings" and save it to "user-settings.yaml"
...
➜ contrib/oc-get-user-settings.sh developer
Get ConfigMap "user-settings-12341234-1234-1234-1234-123412341234" from namespace "openshift-console-user-settings" and save it to "user-settings.yaml"
... edit: Added also an example to git and a second option to define the filename. What do you think? |
5b51ea1
to
eae18bd
Compare
/retest |
eae18bd
to
0b9aabb
Compare
@invincibleJai Updated all tests, I'm happy now, wdyt? Did you see a missing case? Tests also require some minimal tweaks in the hook. |
/hold cancel |
Thanks @jerolimov this looks good to me , looks like we covered all. |
/lgtm Verified the changes, works as expected |
/test e2e-gcp-console |
user-settings-example.yaml
Outdated
apiVersion: v1 | ||
kind: ConfigMap | ||
data: | ||
console.communityProvidersWarning: "true" | ||
console.guidedTour: '{"dev":{"completed":true}}' |
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.
Do we need this sample?
What's the intended use?
Might be better to simply have a comment in the useUserSettings
hook.
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.
Removed the example
0b9aabb
to
28a0976
Compare
Just removed the example |
/lgtm |
/retest |
28a0976
to
566c873
Compare
566c873
to
10980db
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, invincibleJai, jerolimov 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 |
And another rebase was required after #7051 was merged. Will create a new PR for the scripts. |
Fixes:
https://issues.redhat.com/browse/ODC-4755https://issues.redhat.com/browse/ODC-5189This PR is based on #7095 which must be merged first (the go part).
It keep this to make it also easier to test the frontend change. A review here should focus on the TS change.
Analysis / Root cause:
Based on the User Settings for OpenShift Console enhancement proposal we want to create a
ConfigMap
for each individual user in the namespaceopenshift-console-user-settings
Currently you need create this namespace yourself, see Test Setup below. This namespace will be automatically created by the console-operator, see PR openshift/console-operator#479
Solution Description:
Because the user could not create a ConfigMap here, we create a new
ConfigMap
,Role
andRoleBinding
with the service account role over the bridge. This code provides 3 new endpoints to create, get and delete the user settings. (The second and third API calls primary for debugging / development.) The console will fetch the ConfigMap over the known k8sWatch API.Screen shots / Gifs for design review:
Irrelevant
Unit test coverage report:
Updated
user-settings.spec.ts
anduseUserSettings.spec.ts
:Test setup:
This PR require some additional RBAC rules.
1a Create namespace:
Until https://github.com/openshift/console-operator/pull/486/files is merged and available on your cluster you need to add this as well:
1b Create Role:
1c Create RoleBinding:
You can checkout 7095, build the backend with
./build-backend.sh
and switch back to this PR.AddPage.tsx
:Browser conformance: