Skip to content

Commit

Permalink
upgrade-agent: set explicit k8s version
Browse files Browse the repository at this point in the history
`kubeadm upgrade plan` takes an optional positional argument for the
target Kubernetes version [1], which is documented as

> To skip the internet check, pass in the optional [version] parameter

In light of RFC 015, we should not do an "internet check" for latest
versions, but stick to the version we're actually targeting with the
upgrade. Thus, we explicitly pass the version as an argument.

[1]: https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-upgrade/#cmd-upgrade-plan
  • Loading branch information
burgerdev committed Dec 11, 2023
1 parent 60fc73e commit a53017e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions upgrade-agent/internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ func (s *Server) ExecuteUpdate(ctx context.Context, updateRequest *upgradeproto.
return nil, status.Errorf(codes.Internal, "unable to install the kubeadm binary: %s", err)
}

upgradeCmd := exec.CommandContext(ctx, "kubeadm", "upgrade", "plan")
upgradeCmd := exec.CommandContext(ctx, "kubeadm", "upgrade", "plan", updateRequest.WantedKubernetesVersion)
if out, err := upgradeCmd.CombinedOutput(); err != nil {
return nil, status.Errorf(codes.Internal, "unable to execute kubeadm upgrade plan: %s: %s", err, string(out))
return nil, status.Errorf(codes.Internal, "unable to execute kubeadm upgrade plan %s: %s: %s", updateRequest.WantedKubernetesVersion, err, string(out))
}

applyCmd := exec.CommandContext(ctx, "kubeadm", "upgrade", "apply", "--yes", updateRequest.WantedKubernetesVersion)
Expand Down

0 comments on commit a53017e

Please sign in to comment.