Skip to content

Commit

Permalink
add image check for upgrade support
Browse files Browse the repository at this point in the history
Signed-off-by: zwwhdls <[email protected]>
  • Loading branch information
zwwhdls committed Oct 14, 2024
1 parent 39dbbdc commit 67159bd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/fuse/grace/grace.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,17 @@ type podUpgrade struct {
}

func (p *podUpgrade) canUpgrade(ctx context.Context, conn net.Conn) (bool, error) {
// check mount pod now support upgrade or not
if !p.recreate && !util.SupportUpgradeBinary(p.ce, p.pod.Spec.Containers[0].Image) {
sendMessage(conn, fmt.Sprintf("FAIL mount pod now do not support binary upgrade, image: %s", p.pod.Spec.Containers[0].Image))
return false, nil
}
if p.recreate && !util.SupportUpgradeRecreate(p.ce, p.pod.Spec.Containers[0].Image) {
sendMessage(conn, fmt.Sprintf("FAIL mount pod now do not support recreate upgrade, image: %s", p.pod.Spec.Containers[0].Image))
return false, nil
}

// if the last upgrade event is within 10min, return false
now := time.Now()
events, err := p.client.GetEvents(ctx, p.pod)
if err != nil {
Expand Down

0 comments on commit 67159bd

Please sign in to comment.