mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-03-03 01:20:21 +00:00
Fixing a few issues with concatenating urls
This commit is contained in:
@@ -29,15 +29,8 @@ NOTE: never trust a file downloaded from the internet. Make sure to review the c
|
||||
kubectl apply -f https://raw.githubusercontent.com/herbrandson/k8dash/master/kubernetes-k8dash.yaml
|
||||
```
|
||||
|
||||
To access k8dash from your local workstation you must create a secure channel to your Kubernetes cluster. Run the following command:
|
||||
To access k8dash, you must make it publicly visible. If you have an ingress server setup, you can accomplish by adding a route like the following
|
||||
|
||||
``` bash
|
||||
kubectl proxy
|
||||
```
|
||||
|
||||
You can then access the ui at [http://localhost:8001/api/v1/namespaces/kube-system/services/http:k8dash:/proxy/](http://localhost:8001/api/v1/namespaces/kube-system/services/http:k8dash:/proxy/)
|
||||
|
||||
Alternatively, if you have an ingress server setup, you can simply add a route like the following
|
||||
|
||||
``` yaml
|
||||
kind: Ingress
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import log from '../utils/log';
|
||||
|
||||
const {host} = window.location;
|
||||
const nonHashedUrl = window.location.href.replace(window.location.hash, '');
|
||||
const {host, href, hash, search} = window.location;
|
||||
const nonHashedUrl = href.replace(hash, '').replace(search, '');
|
||||
const BASE_HTTP_URL = host === 'localhost:4653' ? 'http://localhost:4654' : nonHashedUrl;
|
||||
const BASE_WS_URL = BASE_HTTP_URL.replace('http', 'ws');
|
||||
|
||||
@@ -37,8 +37,8 @@ export async function request(path, params, autoLogoutOnAuthError = true) {
|
||||
const token = getToken();
|
||||
if (token) opts.headers.Authorization = `Bearer ${token}`;
|
||||
|
||||
const fullUrl = window.url.resolve(BASE_HTTP_URL, path);
|
||||
const response = await fetch(fullUrl, opts);
|
||||
const url = combinePath(BASE_HTTP_URL, path);
|
||||
const response = await fetch(url, opts);
|
||||
|
||||
if (!response.ok) {
|
||||
const {status, statusText} = response;
|
||||
@@ -86,8 +86,8 @@ function connectStream(path, cb, onFail, isJson) {
|
||||
'base64.binary.k8s.io',
|
||||
];
|
||||
|
||||
const fullUrl = window.url.resolve(BASE_WS_URL, path);
|
||||
const socket = new WebSocket(fullUrl, protocols);
|
||||
const url = combinePath(BASE_WS_URL, path);
|
||||
const socket = new WebSocket(url, protocols);
|
||||
socket.onmessage = onMessage;
|
||||
socket.onclose = onClose;
|
||||
socket.onerror = onError;
|
||||
@@ -179,3 +179,9 @@ function push(results, cb) {
|
||||
const items = Object.values(results);
|
||||
cb(items);
|
||||
}
|
||||
|
||||
function combinePath(base, path) {
|
||||
if (base.endsWith('/')) base = base.slice(0, -1); // eslint-disable-line no-param-reassign
|
||||
if (path.startsWith('/')) path = path.slice(1); // eslint-disable-line no-param-reassign
|
||||
return `${base}/${path}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user