From 442423285df2dbdc73f91e8ebe25067073581e74 Mon Sep 17 00:00:00 2001 From: Sergei Zhekpisov <205766156+szhekpisov-katanox@users.noreply.github.com> Date: Tue, 9 Jun 2026 16:49:02 +0100 Subject: [PATCH 1/2] feat: add k3d binary to image for --cluster=k3d support --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0989032b..e8df333b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,8 @@ RUN go mod download RUN apt-get update && apt-get install -y curl RUN curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.31.0/kind-linux-${TARGETARCH} && \ chmod +x ./kind +RUN curl -Lo ./k3d https://github.com/k3d-io/k3d/releases/download/v5.9.0/k3d-linux-${TARGETARCH} && \ + chmod +x ./k3d # Copy source code - only what's needed COPY cmd/ ./cmd/ @@ -38,6 +40,7 @@ FROM gcr.io/distroless/static-debian12 AS final # Copy necessary binaries from the build stage COPY --from=build /argocd-diff-preview/kind /usr/local/bin/kind +COPY --from=build /argocd-diff-preview/k3d /usr/local/bin/k3d COPY --from=build /argocd-diff-preview/argocd-diff-preview . # Copy docker from the docker image From eb3d0ceccb4d2890e9cef15eadb31d6811c4c7c9 Mon Sep 17 00:00:00 2001 From: Sergei Zhekpisov <205766156+szhekpisov-katanox@users.noreply.github.com> Date: Wed, 10 Jun 2026 11:45:13 +0100 Subject: [PATCH 2/2] fix: merge kubeconfig explicitly after k3d cluster create k3d's end-of-create kubeconfig merge is best-effort: if it fails, k3d logs a warning and still exits 0, and we discard its output on success. The tool then dies later with 'No kubeconfig file found' and no clue why. Run 'k3d kubeconfig merge --kubeconfig-merge-default' explicitly after create so a failed merge surfaces its actual error, and log the create output at debug level. --- pkg/k3d/k3d.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/k3d/k3d.go b/pkg/k3d/k3d.go index e9f10de6..ea1a6875 100644 --- a/pkg/k3d/k3d.go +++ b/pkg/k3d/k3d.go @@ -60,6 +60,14 @@ func CreateCluster(clusterName, k3dOptions string, wait time.Duration) (time.Dur log.Error().Msgf("❌ Failed to create cluster with options: %s", k3dOptions) } return time.Since(startTime), fmt.Errorf("failed to create cluster: %s", output) + } else { + log.Debug().Msgf("k3d cluster create output: %s", output) + } + + // k3d's end-of-create kubeconfig merge is best-effort: on failure it only + // logs a warning and still exits 0. Merge explicitly so a failure surfaces. + if output, err := runCommand("k3d", "kubeconfig", "merge", clusterName, "--kubeconfig-merge-default"); err != nil { + return time.Since(startTime), fmt.Errorf("failed to write kubeconfig: %s", output) } duration := time.Since(startTime)