Skip to content

Commit

Permalink
minor fixes for addon upgrades (harvester#4300)
Browse files Browse the repository at this point in the history
* minor changes for how addon upgrade path is processed to ensure correct timestamps for conditions

* change value of AddonOperationFailed condition to OperationFailed
  • Loading branch information
ibrokethecloud authored Jul 28, 2023
1 parent 28a1da7 commit 4fa5c09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/harvesterhci.io/v1beta1/addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type AddonOperation string
var (
AddonOperationInProgress condition.Cond = "InProgress"
AddonOperationCompleted condition.Cond = "Completed"
AddonOperationFailed condition.Cond = "Failed"
AddonOperationFailed condition.Cond = "OperationFailed"
DefaultJobBackOffLimit = int32(5)
)

Expand Down
10 changes: 8 additions & 2 deletions pkg/controller/master/addon/addon_processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ func (h *Handler) processAddonUpgrades(a *harvesterv1.Addon) (*harvesterv1.Addon
}

if needed {
// set InProgress condition as this is needed to ensure that the in progress time stamp is setup before
// triggering the helm chart upgrade
if aObj.Status.Status != harvesterv1.AddonUpdating && !harvesterv1.AddonOperationInProgress.IsTrue(aObj) {
markInProgressCondition(aObj)
return h.addon.UpdateStatus(aObj)
}

hc, _, err := h.getAddonHelmChart(aObj)
if err != nil {
return aObj, err
Expand All @@ -246,9 +253,8 @@ func (h *Handler) processAddonUpgrades(a *harvesterv1.Addon) (*harvesterv1.Addon
return aObj, err
}

if aObj.Status.Status != harvesterv1.AddonUpdating || !harvesterv1.AddonOperationInProgress.IsTrue(aObj) {
if aObj.Status.Status != harvesterv1.AddonUpdating && harvesterv1.AddonOperationInProgress.IsTrue(aObj) {
aObj.Status.Status = harvesterv1.AddonUpdating
markInProgressCondition(aObj)
return h.addon.UpdateStatus(aObj)
}
}
Expand Down

0 comments on commit 4fa5c09

Please sign in to comment.