Allow using custom https.Agent instance (#5564)

* Allow using custom https.Agent instance

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Use .constructor(agentOptions)

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Revert

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
chh authored and GitHub committed 2022-06-07 20:06:58 +08:00
1 parent b31112c36c
commit 1b7dd717a5
1 file changed
+11
+11
View File
@@ -169,6 +169,13 @@ export interface IRemoteKubeApiConfig {
clientCertificateData?: string;
clientKeyData?: string;
};
/**
* Custom instance of https.agent to use for the requests
*
* @remarks the custom agent replaced default agent, options skipTLSVerify,
* clientCertificateData, clientKeyData and caData are ignored.
*/
agent?: Agent;
}
export function forCluster<
@@ -240,6 +247,10 @@ export function forRemoteCluster<
reqInit.agent = new Agent(agentOptions);
}
if (config.agent) {
reqInit.agent = config.agent;
}
const token = config.user.token;
const request = new KubeJsonApi({
serverAddress: config.cluster.server,