mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add try-catch and make createProxyKubeconfig sync
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
ccebefd6d0
commit
4e731753d2
@ -33,7 +33,11 @@ export class KubeconfigManager {
|
|||||||
getPath() {
|
getPath() {
|
||||||
// create proxy kubeconfig if it is removed
|
// create proxy kubeconfig if it is removed
|
||||||
if (this.tempFile && !fs.pathExistsSync(this.tempFile)) {
|
if (this.tempFile && !fs.pathExistsSync(this.tempFile)) {
|
||||||
this.tempFile = this.createProxyKubeconfig();
|
try {
|
||||||
|
this.tempFile = this.createProxyKubeconfig();
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(`Failed to created temp config for auth-proxy`, { err });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.tempFile;
|
return this.tempFile;
|
||||||
@ -77,7 +81,7 @@ export class KubeconfigManager {
|
|||||||
// write
|
// write
|
||||||
const configYaml = dumpConfigYaml(proxyConfig);
|
const configYaml = dumpConfigYaml(proxyConfig);
|
||||||
|
|
||||||
fs.ensureDir(path.dirname(tempFile));
|
fs.ensureDirSync(path.dirname(tempFile));
|
||||||
fs.writeFileSync(tempFile, configYaml, { mode: 0o600 });
|
fs.writeFileSync(tempFile, configYaml, { mode: 0o600 });
|
||||||
logger.debug(`Created temp kubeconfig "${contextName}" at "${tempFile}": \n${configYaml}`);
|
logger.debug(`Created temp kubeconfig "${contextName}" at "${tempFile}": \n${configYaml}`);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user