Skip to content

Commit 9b39390

Browse files
committed
Allow subclassing of KubeConfigRestClient
1 parent 0cd90c8 commit 9b39390

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

transports/via-kubeconfig.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ const isVerbose = Deno.args.includes('--verbose');
3838

3939
export class KubeConfigRestClient implements RestClient {
4040
constructor(
41-
private ctx: KubeConfigContext,
42-
private httpClient: unknown,
41+
protected ctx: KubeConfigContext,
42+
protected httpClient: unknown,
4343
) {
4444
this.defaultNamespace = ctx.defaultNamespace || 'default';
4545
}
4646
defaultNamespace?: string;
4747

4848
static async forInCluster() {
49-
return KubeConfigRestClient.forKubeConfig(
49+
return this.forKubeConfig(
5050
await KubeConfig.getInClusterConfig());
5151
}
5252

5353
static async forKubectlProxy() {
54-
return KubeConfigRestClient.forKubeConfig(
54+
return this.forKubeConfig(
5555
KubeConfig.getSimpleUrlConfig({
5656
baseUrl: 'http://localhost:8001',
5757
}));
@@ -61,7 +61,7 @@ export class KubeConfigRestClient implements RestClient {
6161
path?: string,
6262
contextName?: string,
6363
): Promise<KubeConfigRestClient> {
64-
return KubeConfigRestClient.forKubeConfig(path
64+
return this.forKubeConfig(path
6565
? await KubeConfig.readFromPath(path)
6666
: await KubeConfig.getDefaultConfig(), contextName);
6767
}
@@ -90,7 +90,7 @@ export class KubeConfigRestClient implements RestClient {
9090
}
9191
}
9292

93-
return new KubeConfigRestClient(ctx, httpClient);
93+
return new this(ctx, httpClient);
9494
}
9595

9696
async performRequest(opts: RequestOptions): Promise<any> {

0 commit comments

Comments
 (0)