Skip to content

Commit

Permalink
add Progressing=True when operand resources apply errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sallyom committed Apr 12, 2020
1 parent c7e20f5 commit 8871a52
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/operator/targetcontroller/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (c *TargetController) syncKubeStorageVersionMigrator(spec *operatorv1.KubeS
if result.Error != nil {
syncErr = fmt.Errorf("%q (%T): %v", result.File, result.Type, result.Error)
manageOperatorStatusDegraded(syncErr, operatorStatus)
manageOperatorStatusProgressing(nil, syncErr, operatorStatus, generation)
return syncErr
}
}
Expand All @@ -42,7 +43,7 @@ func (c *TargetController) syncKubeStorageVersionMigrator(spec *operatorv1.KubeS
}

manageOperatorStatusAvailable(deployment, operatorStatus)
manageOperatorStatusProgressing(deployment, operatorStatus, generation)
manageOperatorStatusProgressing(deployment, syncErr, operatorStatus, generation)
manageOperatorStatusDegraded(syncErr, operatorStatus)

// TODO this is changing too early and it was before too.
Expand Down Expand Up @@ -106,11 +107,18 @@ func manageOperatorStatusAvailable(deployment *appsv1.Deployment, status *operat
}
}

func manageOperatorStatusProgressing(deployment *appsv1.Deployment, status *operatorv1.KubeStorageVersionMigratorStatus, generation int64) {
func manageOperatorStatusProgressing(deployment *appsv1.Deployment, err error, status *operatorv1.KubeStorageVersionMigratorStatus, generation int64) {
// If the deployment is up to date and the operatorConfig are up to date, then we are no longer progressing
var progressingMessages []string
if err != nil {
if deployment == nil {
progressingMessages = append(progressingMessages, fmt.Sprintf("syncing openshift-kube-storage-version-migrator resources: %v", err.Error()))
} else {
progressingMessages = append(progressingMessages, fmt.Sprintf("deployment/migrator.openshift-kube-storage-version-migrator: %v", err.Error()))
}
}
if deployment != nil && deployment.ObjectMeta.Generation != deployment.Status.ObservedGeneration {
progressingMessages = append(progressingMessages, fmt.Sprintf("deployment/migrator.openshift-kube-storage-version-migrator:: observed generation is %d, desired generation is %d.", deployment.Status.ObservedGeneration, deployment.ObjectMeta.Generation))
progressingMessages = append(progressingMessages, fmt.Sprintf("deployment/migrator.openshift-kube-storage-version-migrator: observed generation is %d, desired generation is %d.", deployment.Status.ObservedGeneration, deployment.ObjectMeta.Generation))
}
if generation != status.ObservedGeneration {
progressingMessages = append(progressingMessages, fmt.Sprintf("kubestorageversionmigrators/cluster: observed generation is %d, desired generation is %d.", status.ObservedGeneration, generation))
Expand Down

0 comments on commit 8871a52

Please sign in to comment.