mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-24 14:01:16 +02:00
Also: * Linux 6.6.14 + XDP enablement * etcd 3.5.12 Various other bumps for the tools, utilities, and Go modules. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package docker
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io"
|
|
"strings"
|
|
|
|
"github.com/docker/docker/api/types/container"
|
|
|
|
"github.com/siderolabs/talos/pkg/provision"
|
|
)
|
|
|
|
// CrashDump produces debug information to help with debugging failures.
|
|
func (p *provisioner) CrashDump(ctx context.Context, cluster provision.Cluster, out io.Writer) {
|
|
containers, err := p.listNodes(ctx, cluster.Info().ClusterName)
|
|
if err != nil {
|
|
fmt.Fprintf(out, "error listing containers: %s\n", err)
|
|
|
|
return
|
|
}
|
|
|
|
for _, ctr := range containers {
|
|
name := ctr.Names[0][1:]
|
|
fmt.Fprintf(out, "%s\n%s\n\n", name, strings.Repeat("=", len(name)))
|
|
|
|
logs, err := p.client.ContainerLogs(ctx, ctr.ID, container.LogsOptions{
|
|
ShowStdout: true,
|
|
ShowStderr: true,
|
|
Tail: "1000",
|
|
})
|
|
if err != nil {
|
|
fmt.Fprintf(out, "error querying container logs: %s\n", err)
|
|
|
|
continue
|
|
}
|
|
|
|
_, _ = io.Copy(out, logs) //nolint:errcheck
|
|
}
|
|
}
|