-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[teleport-update] use new updater to reload and verify Teleport #51734
Conversation
// Setup is safe to run concurrently with other Updater commands. | ||
func (u *Updater) Setup(ctx context.Context, restart bool) error { | ||
// Setup teleport-updater configuration and sync systemd. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was tempted to include the linking / reverting logic here as well, but I think it introduces complexity that may be undesirable:
- The
LocalInstaller
logic would be split between versions, which may be difficult to reason about for future changes. E.g., we would not be able to change the format of the installation within a single version. - Reverting logic would move to the new version, and never execute until it's installed.
lib/autoupdate/agent/updater.go
Outdated
// ExecSetup execs teleport-update to verify and reload the installation. | ||
ExecSetup func(ctx context.Context, restart bool) error | ||
// SetupConfig installs the Teleport updater service using the running installation. | ||
SetupConfig func(ctx context.Context) error | ||
// TeardownConfig removes all traces of the updater and all managed installations. | ||
TeardownConfig func(ctx context.Context) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those names are not very explicit about what those functions are doing, especially the *Config
part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ExecSetup execs teleport-update to verify and reload the installation. | |
ExecSetup func(ctx context.Context, restart bool) error | |
// SetupConfig installs the Teleport updater service using the running installation. | |
SetupConfig func(ctx context.Context) error | |
// TeardownConfig removes all traces of the updater and all managed installations. | |
TeardownConfig func(ctx context.Context) error | |
// VerifyAndReload execs teleport-update to verify and reload the installation. | |
VerifyAndReload func(ctx context.Context, restart bool) error | |
// SetupUpdater installs the Teleport updater service using the running installation. | |
SetupUpdater func(ctx context.Context) error | |
// Teardown removes all traces of the updater and all managed installations. | |
Teardown func(ctx context.Context) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Made these names more descriptive and added better godoc.
(Note that ExecSetup
re-execs the binary with the setup
subcommand, while the others just execute Namespace
methods.)
if ok := revertConfig(ctx); ok { | ||
u.Log.WarnContext(ctx, "Teleport updater encountered a configuration error and successfully reverted the installation.") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also log if the revert failed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revertConfig
is a local function that always logs when it returns false.
9024972
to
2a15809
Compare
@vapopov looking for a second review whenever you have a chance 🙂 |
2a15809
to
515726c
Compare
This PR moves the healthcheck and agent restart logic into the copy of
teleport-update
that is being installed byteleport-update update
. This ensures that any bugs are caught on the leading-edge of the update process, so that a broken version ofteleport-update
is less likely to be installed and prevent future updates.The
teleport-update
binary will be used to enable, disable, and trigger automatic Teleport agent updates. The new auto-updates system manages a local installation of the cluster-specified version of Teleport stored in/opt/teleport
.RFD: #47126
Goal (internal): https://github.com/gravitational/cloud/issues/10289