Skip to content
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

[v14] Update updater inventory reporting after removal #43452

Merged
merged 5 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions lib/automaticupgrades/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ limitations under the License.
package automaticupgrades

import (
"bytes"
"context"
"os"
"os/exec"
"strconv"
"strings"

log "github.com/sirupsen/logrus"

"github.com/gravitational/teleport/lib/automaticupgrades/version"
)

const (
Expand Down Expand Up @@ -76,11 +78,14 @@ func GetUpgraderVersion(ctx context.Context) string {
out, err := exec.CommandContext(ctx, teleportUpgradeScript, "version").Output()
if err != nil {
log.WithError(err).Debug("Failed to exec /usr/sbin/teleport-upgrade version command.")
} else {
if version := strings.TrimSpace(string(out)); version != "" {
return version
}
return ""
}
ver, err := version.EnsureSemver(string(bytes.TrimSpace(out)))
if err != nil {
log.WithError(err).Debug("Unexpected teleport-upgrade version.")
return ""
}
return ver
}
return os.Getenv(EnvUpgraderVersion)
}
3 changes: 3 additions & 0 deletions lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,9 @@ func NewTeleport(cfg *servicecfg.Config) (*TeleportProcess, error) {

upgraderKind := os.Getenv(automaticupgrades.EnvUpgrader)
upgraderVersion := automaticupgrades.GetUpgraderVersion(process.GracefulExitContext())
if upgraderVersion == "" {
upgraderKind = ""
}

// Instances deployed using the AWS OIDC integration are automatically updated
// by the proxy. The instance heartbeat should properly reflect that.
Expand Down
Loading