diff --git a/src/common/kube-helpers.ts b/src/common/kube-helpers.ts index 9442ef8891..1387d1aa1b 100644 --- a/src/common/kube-helpers.ts +++ b/src/common/kube-helpers.ts @@ -7,6 +7,12 @@ import logger from "../main/logger"; import commandExists from "command-exists"; import { ExecValidationNotFoundError } from "./custom-errors"; +export type KubeConfigValidationOpts = { + validateCluster?: boolean; + validateUser?: boolean; + validateExec?: boolean; +}; + export const kubeConfigDefaultPath = path.join(os.homedir(), ".kube", "config"); function resolveTilde(filePath: string) { @@ -154,11 +160,11 @@ export function getNodeWarningConditions(node: V1Node) { * Validates Context, User and Cluster sructs in given kubeconfig. Additionally this will validate * the command passed to the exec substructure. */ -export function validateKubeConfig (config: KubeConfig, contextName: string, validationOpts?: { validateCluster?: boolean, validateUser?: boolean, validateExec?: boolean}) { +export function validateKubeConfig (config: KubeConfig, contextName: string, validationOpts?: KubeConfigValidationOpts) { // we only receive a single context, cluster & user object here so lets validate them as this // will be called when we add a new cluster to Lens - const opts = validationOpts || {}; - const { validateUser = true, validateCluster = true, validateExec = true } = opts; + + const { validateUser = true, validateCluster = true, validateExec = true } = validationOpts || {}; const contextObject = config.getContextObject(contextName);