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

Bug 1908687: Use localstorage fallback when running a local bridge #7586

Merged
merged 4 commits into from Jan 13, 2021

Conversation

jerolimov
Copy link
Member

@jerolimov jerolimov commented Dec 17, 2020

Fixes:
https://issues.redhat.com/browse/CONSOLE-2510
https://bugzilla.redhat.com/show_bug.cgi?id=1908687

Analysis / Root cause:
With the new user settings feature its hard for console developers who shares and switch between many clusters.

The settings could confuse other developers on the same cluster / user. And they are often missed when switching to another cluster.

Solution Description:

  • This PR introduce a new bridge cli option --user-settings-location=configmap|localstorage.
  • It was automatically set to localstorage in the oc-enviconment.sh script. So its automatically active for all console developers which runs a local bridge.
  • The flag is available in frontend as SERVER_FLAGS.userSettingsLocation
  • The user settings hook(s) automatically check this flags and use the localStorage if the flag is set to localstorage.

It's possible to override this settings with cli option like bin/bridge --user-settings-location=configmap

Screen shots / Gifs for design review:

Unit test coverage report:

Test setup:

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added the component/backend Related to backend label Dec 17, 2020
@openshift-ci-robot openshift-ci-robot added the component/shared Related to console-shared label Dec 17, 2020
@jerolimov
Copy link
Member Author

/assign @jhadvig @christianvogt
/cc @invincibleJai

@jerolimov jerolimov changed the title Use localstorage fallback when running a local bridge Bug 1908687: Use localstorage fallback when running a local bridge Dec 17, 2020
@openshift-ci-robot openshift-ci-robot added bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Dec 17, 2020
@openshift-ci-robot
Copy link
Contributor

@jerolimov: This pull request references Bugzilla bug 1908687, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1908687: Use localstorage fallback when running a local bridge

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.

@jerolimov
Copy link
Member Author

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. and removed bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. labels Dec 17, 2020
@openshift-ci-robot
Copy link
Contributor

@jerolimov: This pull request references Bugzilla bug 1908687, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

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.

@jerolimov
Copy link
Member Author

/retest

2 similar comments
@jerolimov
Copy link
Member Author

/retest

@jerolimov
Copy link
Member Author

/retest

@jerolimov
Copy link
Member Author

/cc @christianvogt

@christianvogt
Copy link
Contributor

/lgtm
/approve

@jerolimov it would be good to allow the dev to maybe specify a fixed user name. While logging in as kubeadmin, the configmap name is consistent, when using consoledeveloper, the configmap name gets concatenated with the user UID which differs on each dev cluster.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 7, 2021
@christianvogt
Copy link
Contributor

fyi @spadgett

@@ -122,7 +122,8 @@ func main() {

fLoadTestFactor := fs.Int("load-test-factor", 0, "DEV ONLY. The factor used to multiply k8s API list responses for load testing purposes.")

fDevCatalogCategories := fs.String("developer-catalog-categories", "", "Allow catalog categories customization. (JSON as string)")
fDevCatalogCategories := fs.String("developer-catalog-categories", "", "DEV ONLY. Allow catalog categories customization. (JSON as string)")
Copy link
Member

Choose a reason for hiding this comment

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

Is this flag really dev-only? I thought this was used in production (set by the operator).

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. I removed this again.

@@ -122,7 +122,8 @@ func main() {

fLoadTestFactor := fs.Int("load-test-factor", 0, "DEV ONLY. The factor used to multiply k8s API list responses for load testing purposes.")

fDevCatalogCategories := fs.String("developer-catalog-categories", "", "Allow catalog categories customization. (JSON as string)")
fDevCatalogCategories := fs.String("developer-catalog-categories", "", "DEV ONLY. Allow catalog categories customization. (JSON as string)")
fUserSettings := fs.String("user-settings", "configmap", "DEV ONLY. Define if the user settings should be stored in a shared ConfigMap or in users browser (configmap | localstorage).")
Copy link
Member

@spadgett spadgett Jan 11, 2021

Choose a reason for hiding this comment

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

We should add validation when reading the flag.

Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe user-settings-location?

Copy link
Member Author

@jerolimov jerolimov Jan 12, 2021

Choose a reason for hiding this comment

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

Added a validation to pkg/serverconfig/validate.go

Renamed everything to userSettingsLocation or user-settings-location

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 12, 2021

@jerolimov: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/kubevirt-plugin bf7e424 link /test kubevirt-plugin

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.

@jerolimov
Copy link
Member Author

/retest

@spadgett Thanks for the review. I applied all your requests. Can you please check again.

@christianvogt @invincibleJai I also added this commit f206ace to do NOT append the user uid (or kubeadmin) if this -user-settings-location configmap is used.

It's not beautiful because I added the localStorage getItem/setItem key to the method signature. But I also don't want check the SERVER_FLAGS twice. This also enables me to remove the redux dependency from useUserSettingsLocalStorage. Wdyt?

@invincibleJai
Copy link
Member

/lgtm

Thanks @jerolimov , verified both in cluster and off cluster seems to work as expected. can update description as well to use bin/bridge --user-settings-location=configmap

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2021
@openshift-ci-robot
Copy link
Contributor

@jerolimov: This pull request references Bugzilla bug 1908687, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1908687: Use localstorage fallback when running a local bridge

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.

@christianvogt
Copy link
Contributor

nice
I like how my pinned nav items and other setting stick with me in local dev

/approve

/assign @spadgett

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2021
Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2021
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, invincibleJai, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 13, 2021
@openshift-merge-robot openshift-merge-robot merged commit 3d36cd1 into openshift:master Jan 13, 2021
@openshift-ci-robot
Copy link
Contributor

@jerolimov: All pull requests linked via external trackers have merged:

Bugzilla bug 1908687 has been moved to the MODIFIED state.

In response to this:

Bug 1908687: Use localstorage fallback when running a local bridge

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/backend Related to backend component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants