From 675aef0a7cab74e645d426e42e1e1da42b2e59c2 Mon Sep 17 00:00:00 2001 From: Aaron Paterson Date: Tue, 25 Aug 2026 18:08:30 +0000 Subject: [PATCH] Say which half of the CNI manifest lookup failed The manifest ships beside the plugin binary, so finding it needs both the plugin that the running executable belongs to and the resources directory of that installation. One message covered the absence of either, naming neither the executable it looked for nor what was installed, and a run that hit it left nothing to tell the two apart. Each half now reports what it was looking for. --- .../Support/K8sHelper+Bootstrap.swift | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Sources/ContainerK8s/Support/K8sHelper+Bootstrap.swift b/Sources/ContainerK8s/Support/K8sHelper+Bootstrap.swift index 964f9b72f..85f08318e 100644 --- a/Sources/ContainerK8s/Support/K8sHelper+Bootstrap.swift +++ b/Sources/ContainerK8s/Support/K8sHelper+Bootstrap.swift @@ -105,10 +105,19 @@ extension K8sHelper { private static func loadKindnetManifest(log: Logger) async throws -> String { let pluginLoader = try await Utility.createPluginLoader(log: log) - guard let plugin = pluginLoader.findPlugin(forExecutable: CommandLine.executablePath), - let resourceURL = plugin.resourceURL - else { - throw ContainerizationError(.internalError, message: "unable to locate k8s plugin installation or resources") + let executable = CommandLine.executablePath + guard let plugin = pluginLoader.findPlugin(forExecutable: executable) else { + let installed = pluginLoader.findPlugins().map(\.name).sorted() + throw ContainerizationError( + .internalError, + message: "no installed plugin runs \(executable); installed plugins: \(installed.isEmpty ? "none" : installed.joined(separator: ", "))" + ) + } + guard let resourceURL = plugin.resourceURL else { + throw ContainerizationError( + .internalError, + message: "the \(plugin.name) plugin installed at \(plugin.binaryURL.path) carries no resources directory" + ) } let url = resourceURL.appendingPathComponent("kindnet.yaml") guard let contents = try? String(contentsOf: url, encoding: .utf8) else {