mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-20 22:21:13 +02:00
This PR introduces a new strategy for upgrades. Instead of attempting to zap the partition table, create a new one, and then format the partitions, this change will only update the `vmlinuz`, and `initramfs.xz` being used to boot. It introduces an A/B style upgrade process, which will allow for easy rollbacks. One deviation from our original intention with upgrades is that this change does not completely reset a node. It falls just short of that and does not reset the partition table. This forces us to keep the current partition scheme in mind as we make changes in the future, because an upgrade assumes a specific partition scheme. We can improve upgrades further in the future, but this will at least make them more dependable. Finally, one more feature in this PR is the ability to keep state. This enables single node clusters to upgrade since we keep the etcd data around. Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
59 lines
1.4 KiB
Go
59 lines
1.4 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 firecracker
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"github.com/talos-systems/talos/internal/pkg/provision"
|
|
"github.com/talos-systems/talos/internal/pkg/tail"
|
|
)
|
|
|
|
// CrashDump produces debug information to help with debugging failures.
|
|
func (p *provisioner) CrashDump(ctx context.Context, cluster provision.Cluster, out io.Writer) {
|
|
state, ok := cluster.(*state)
|
|
if !ok {
|
|
fmt.Fprintf(out, "error inspecting firecracker state, %#+v\n", cluster)
|
|
return
|
|
}
|
|
|
|
statePath, err := state.StatePath()
|
|
if err != nil {
|
|
fmt.Fprintf(out, "error getting cluster state path: %s", err)
|
|
return
|
|
}
|
|
|
|
logFiles, err := filepath.Glob(filepath.Join(statePath, "*.log"))
|
|
if err != nil {
|
|
fmt.Fprintf(out, "error finding log paths: %s\n", err)
|
|
return
|
|
}
|
|
|
|
for _, logFile := range logFiles {
|
|
name := filepath.Base(logFile)
|
|
|
|
fmt.Fprintf(out, "%s\n%s\n\n", name, strings.Repeat("=", len(name)))
|
|
|
|
f, err := os.Open(logFile)
|
|
if err != nil {
|
|
fmt.Fprintf(out, "error opening file: %s\n", err)
|
|
continue
|
|
}
|
|
|
|
if err = tail.SeekLines(f, 5000); err != nil {
|
|
fmt.Fprintf(out, "error seeking to the tail: %s\n", err)
|
|
}
|
|
|
|
_, _ = io.Copy(out, f) //nolint: errcheck
|
|
|
|
f.Close() //nolint: errcheck
|
|
}
|
|
}
|