diff --git a/extensions/kind/src/create-cluster.ts b/extensions/kind/src/create-cluster.ts index 041840f1ab7..49620948397 100644 --- a/extensions/kind/src/create-cluster.ts +++ b/extensions/kind/src/create-cluster.ts @@ -19,7 +19,7 @@ import * as extensionApi from '@podman-desktop/api'; import * as fs from 'node:fs'; import * as path from 'node:path'; import * as os from 'node:os'; -import { runCliCommand } from './util'; +import { getKindPath, runCliCommand } from './util'; import mustache from 'mustache'; import { parseAllDocuments } from 'yaml'; @@ -112,6 +112,9 @@ export async function createCluster( // ok we need to write the file await fs.promises.writeFile(tmpFilePath, kindClusterConfig, 'utf8'); + // update PATH to include kind + env.PATH = getKindPath(); + // now execute the command to create the cluster try { await runCliCommand(kindCli, ['create', 'cluster', '--config', tmpFilePath], { env, logger }, token); diff --git a/extensions/kind/src/extension.ts b/extensions/kind/src/extension.ts index 11d4ef666eb..c7fb5a6fd64 100644 --- a/extensions/kind/src/extension.ts +++ b/extensions/kind/src/extension.ts @@ -17,7 +17,7 @@ ***********************************************************************/ import * as extensionApi from '@podman-desktop/api'; -import { detectKind, runCliCommand } from './util'; +import { detectKind, getKindPath, runCliCommand } from './util'; import { KindInstaller } from './kind-installer'; import type { CancellationToken, Logger } from '@podman-desktop/api'; import { window } from '@podman-desktop/api'; @@ -121,10 +121,11 @@ async function updateClusters(provider: extensionApi.Provider, containers: exten await extensionApi.containerEngine.stopContainer(cluster.engineId, cluster.id); }, delete: async (logger): Promise => { - const env = process.env; + const env = Object.assign({}, process.env); if (cluster.engineType === 'podman') { env['KIND_EXPERIMENTAL_PROVIDER'] = 'podman'; } + env.PATH = getKindPath(); await runCliCommand(kindCli, ['delete', 'cluster', '--name', cluster.name], { env, logger }); }, }; diff --git a/extensions/kind/src/util.ts b/extensions/kind/src/util.ts index 883f84c89cd..1446d66a771 100644 --- a/extensions/kind/src/util.ts +++ b/extensions/kind/src/util.ts @@ -49,7 +49,7 @@ export interface RunOptions { logger?: extensionApi.Logger; } -const macosExtraPath = '/usr/local/bin:/opt/homebrew/bin:/opt/local/bin'; +const macosExtraPath = '/usr/local/bin:/opt/homebrew/bin:/opt/local/bin:/opt/podman/bin'; export function getKindPath(): string { const env = process.env;