mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> Fix cluster tests Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> Address review comments Apply store sync data without sync Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> Small fixes Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> Set 15 min interval to refresh metadata Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> Cleanup Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> Revert todo comment Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
33 lines
858 B
TypeScript
33 lines
858 B
TypeScript
import request, { RequestPromiseOptions } from "request-promise-native"
|
|
import { Cluster } from "../cluster";
|
|
|
|
export type ClusterDetectionResult = {
|
|
value: string | number | boolean
|
|
accuracy: number
|
|
}
|
|
|
|
export class BaseClusterDetector {
|
|
cluster: Cluster
|
|
key: string
|
|
|
|
constructor(cluster: Cluster) {
|
|
this.cluster = cluster
|
|
}
|
|
|
|
detect(): Promise<ClusterDetectionResult> {
|
|
return null
|
|
}
|
|
|
|
protected async k8sRequest<T = any>(path: string, options: RequestPromiseOptions = {}): Promise<T> {
|
|
const apiUrl = this.cluster.kubeProxyUrl + path;
|
|
return request(apiUrl, {
|
|
json: true,
|
|
timeout: 30000,
|
|
...options,
|
|
headers: {
|
|
Host: `${this.cluster.id}.${new URL(this.cluster.kubeProxyUrl).host}`, // required in ClusterManager.getClusterForRequest()
|
|
...(options.headers || {}),
|
|
},
|
|
})
|
|
}
|
|
} |