Skip to content

tls-server-name is not populated for listing requests. #887

@tigrato

Description

@tigrato

Describe the bug
tls-server-name is not set on requests other than WebSockets.

This PR #820 added support for tls-server-name, however running listNamespacedPod the tls-server-name doesn't seem to be configured causing the request to fail.
The request calls this function

javascript/src/config.ts

Lines 148 to 167 in 4ea2b0f

public async applyToRequest(opts: request.Options): Promise<void> {
const cluster = this.getCurrentCluster();
const user = this.getCurrentUser();
await this.applyOptions(opts);
if (cluster && cluster.skipTLSVerify) {
opts.strictSSL = false;
}
if (user && user.username) {
opts.auth = {
password: user.password,
username: user.username,
};
}
}
public loadFromString(config: string, opts?: Partial<ConfigOptions>): void {
const obj = yaml.load(config) as any;

that does not define the tls-server-name property.

** Client Version **
e.g. 0.17.1

** Server Version **
e.g. 1.24.3

To Reproduce
Steps to reproduce the behavior:

Run the following command against any cluster that requires tls-server-name and it will fail.

** Example Code**

const k8s = require('@kubernetes/client-node');

const kc = new k8s.KubeConfig();
kc.loadFromDefault();

const k8sApi = kc.makeApiClient(k8s.CoreV1Api);

k8sApi.listNamespacedPod('default')
    .then((res) => {
	console.log(res.body);
    });

Expected behavior
The request should be successful

Environment (please complete the following information):

  • OS: macOS & Linux
  • NodeJS Version: 18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions