-
Notifications
You must be signed in to change notification settings - Fork 164
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
frontend: Add websocket multiplexer #2563
base: main
Are you sure you want to change the base?
Conversation
Backend Code coverage changed from 61.1% to 61.2%. Change: .1% 😃. Coverage report
|
a3b5f1f
to
e23dd95
Compare
Backend Code coverage changed from 61.1% to 61.1%. Change: 0% 😃. Coverage report
|
e23dd95
to
af50857
Compare
Backend Code coverage changed from 61.0% to 61.2%. Change: .2% 😃. Coverage report
|
Hi, I've tried the test case that you've described and it doesn't work for me. It enters some kind of loop and keeps rerendering pod-creation-loop.mp4Another thing I've tried is setting allowed namespaces (default and store) in setting Then went to pods page and it connects to the first namespace twice, but should connect to both default and store |
So websocket connection can be of 4 types
|
*/ | ||
export function useWebSockets<T>({ | ||
connections, | ||
export function useWebSocket<T extends KubeObjectInterface>({ |
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'll still need to have useWebSockets hook for listening to multiple connections
if (token) { | ||
const encodedToken = btoa(token).replace(/=/g, ''); | ||
protocols.push(`base64url.bearer.authorization.k8s.io.${encodedToken}`); | ||
class WebSocketManager { |
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.
some tests for this logic are needed
af50857
to
8484f79
Compare
Backend Code coverage changed from 61.1% to 61.2%. Change: .1% 😃. Coverage report
|
8484f79
to
146c4db
Compare
Backend Code coverage changed from 61.0% to 61.1%. Change: .1% 😃. Coverage report
|
146c4db
to
6055579
Compare
Backend Code coverage changed from 61.0% to 61.2%. Change: .2% 😃. Coverage report
|
This adds a single websocket connection from frontend to backend and sends lists of messages to the backend. With the help of messages backend creates multiple websocket connection to k8s API and returns back the data. This solves the issue for limiting of websocket connection in frontend in case of multi cluster setup. Signed-off-by: Kautilya Tripathi <[email protected]>
Now websocket has clear type that is needs to sends. This also fixes panic of websocket in various edge cases. Signed-off-by: Kautilya Tripathi <[email protected]>
6055579
to
091b60a
Compare
Backend Code coverage changed from 61.0% to 61.1%. Change: .1% 😃. Coverage report
|
This adds a single websocket connection from frontend to backend and sends lists of messages to the backend. With the help of messages backend creates multiple websocket connection to k8s API and returns back the data.
This solves the issue for limiting of websocket connection in frontend in case of multi cluster setup.
Fixes: #2515
Testing
cd frontend && npm start
cd backend && go run ./cmd -dev -enable-dynamic-clusters
kubectl run nginx --image=nginx
TODO