Inject Host header to k8s client requests (#887)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2020-09-16 20:54:36 +03:00
1 parent ec4d859ef7
commit c2afd026cc
6 files changed
+118 -32

No files matched your search

+6 -2
View File
@@ -11,7 +11,7 @@ export class KubeconfigManager {
protected configDir = app.getPath("temp")
protected tempFile: string;
constructor(protected cluster: Cluster, protected contextHandler: ContextHandler) {
constructor(protected cluster: Cluster, protected contextHandler: ContextHandler, protected port: number) {
this.init();
}
@@ -28,6 +28,10 @@ export class KubeconfigManager {
return this.tempFile;
}
protected resolveProxyUrl() {
return `http://127.0.0.1:${this.port}/${this.cluster.id}`
}
/**
* Creates new "temporary" kubeconfig that point to the kubectl-proxy.
* This way any user of the config does not need to know anything about the auth etc. details.
@@ -42,7 +46,7 @@ export class KubeconfigManager {
clusters: [
{
name: contextName,
server: await contextHandler.resolveAuthProxyUrl(),
server: this.resolveProxyUrl(),
skipTLSVerify: undefined,
}
],