mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-25 00:21:10 +02:00
feat: remove the machine config on reset
This wil remove the machine config on a reset so that a new machine configwill be downloaded and used on a reboot. Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This commit is contained in:
parent
ac54a3cb86
commit
ad79e8dfcf
@ -26,6 +26,7 @@ import (
|
|||||||
"github.com/talos-systems/talos/internal/pkg/upgrade"
|
"github.com/talos-systems/talos/internal/pkg/upgrade"
|
||||||
"github.com/talos-systems/talos/pkg/archiver"
|
"github.com/talos-systems/talos/pkg/archiver"
|
||||||
"github.com/talos-systems/talos/pkg/chunker/stream"
|
"github.com/talos-systems/talos/pkg/chunker/stream"
|
||||||
|
"github.com/talos-systems/talos/pkg/constants"
|
||||||
"github.com/talos-systems/talos/pkg/userdata"
|
"github.com/talos-systems/talos/pkg/userdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -104,16 +105,21 @@ func (r *Registrator) Upgrade(ctx context.Context, in *proto.UpgradeRequest) (da
|
|||||||
|
|
||||||
// Reset initiates a Talos upgrade
|
// Reset initiates a Talos upgrade
|
||||||
func (r *Registrator) Reset(ctx context.Context, in *empty.Empty) (data *proto.ResetReply, err error) {
|
func (r *Registrator) Reset(ctx context.Context, in *empty.Empty) (data *proto.ResetReply, err error) {
|
||||||
// stop kubelet
|
// Stop the kubelet.
|
||||||
if _, err = r.Stop(ctx, &proto.StopRequest{Id: "kubelet"}); err != nil {
|
if _, err = r.Stop(ctx, &proto.StopRequest{Id: "kubelet"}); err != nil {
|
||||||
return data, err
|
return data, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// kubeadm Reset
|
// Run `kubeadm reset`.
|
||||||
if err = upgrade.Reset(); err != nil {
|
if err = upgrade.Reset(); err != nil {
|
||||||
return data, err
|
return data, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the machine config.
|
||||||
|
if err = os.Remove(constants.UserDataPath); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &proto.ResetReply{}, err
|
return &proto.ResetReply{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user