forked from rancher-sandbox/rancher-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rancher-sandbox#7142 from rancher-sandbox/diagnost…
…ics-wsl-kubeconfig-wsl-helper Add diagnostic to verify kubeConfig
- Loading branch information
Showing
4 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { DiagnosticsCategory, DiagnosticsChecker } from './types'; | ||
|
||
import WindowsIntegrationManager from '@pkg/integrations/windowsIntegrationManager'; | ||
import Logging from '@pkg/utils/logging'; | ||
|
||
const console = Logging.diagnostics; | ||
|
||
async function verifyKubeConfigSymlink(): Promise<boolean> { | ||
const integrationManager = WindowsIntegrationManager.getInstance(); | ||
|
||
try { | ||
await integrationManager.verifyAllDistrosKubeConfig(); | ||
|
||
return true; | ||
} catch (error: any) { | ||
console.error(`Error verifying kubeconfig symlinks: ${ error.message }`); | ||
|
||
return false; | ||
} | ||
} | ||
|
||
/** | ||
* CheckKubeConfigSymlink checks the symlinked kubeConfig in WSL integration | ||
* enabled distro for non-rancher desktop configuration. | ||
*/ | ||
const CheckKubeConfigSymlink: DiagnosticsChecker = { | ||
id: 'VERIFY_WSL_INTEGRATION_KUBECONFIG', | ||
category: DiagnosticsCategory.Kubernetes, | ||
applicable() { | ||
return Promise.resolve(true); | ||
}, | ||
async check() { | ||
return Promise.resolve({ | ||
description: 'Rancher Desktop cannot automatically convert the provided kubeconfig file to a symlink' + | ||
' due to existing configurations within that file. To resolve this issue, you will need to ' + | ||
'manually create the symlink to ensure existing configurations are preserved and to prevent ' + | ||
'any loss of configuration.', | ||
passed: await verifyKubeConfigSymlink(), | ||
fixes: [], | ||
}); | ||
}, | ||
}; | ||
|
||
export default CheckKubeConfigSymlink; |