44 "context"
55 "errors"
66 "fmt"
7- "strings"
8- "time"
9-
107 appsv1 "k8s.io/api/apps/v1"
118 corev1 "k8s.io/api/core/v1"
129 apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -17,6 +14,7 @@ import (
1714 corev1listers "k8s.io/client-go/listers/core/v1"
1815 "k8s.io/client-go/tools/cache"
1916 "k8s.io/client-go/util/workqueue"
17+ "strings"
2018
2119 operatorv1 "github.com/openshift/api/operator/v1"
2220 openshiftconfigclientv1 "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"
@@ -293,7 +291,7 @@ func (c *Controller) updateOperatorStatus(ctx context.Context, previousStatus *o
293291 // Update is done when all pods have been updated to the latest revision
294292 // and the deployment controller has reported NewReplicaSetAvailable
295293 workloadIsBeingUpdated := ! workloadAtHighestGeneration || ! hasDeploymentProgressed (workload .Status )
296- workloadIsBeingUpdatedTooLong , err := isUpdatingTooLong (previousStatus , * deploymentProgressingCondition .Type )
294+ workloadIsBeingUpdatedTooLong := v1helpers . IsUpdatingTooLong (previousStatus , * deploymentProgressingCondition .Type )
297295 if ! workloadAtHighestGeneration {
298296 deploymentProgressingCondition = deploymentProgressingCondition .
299297 WithStatus (operatorv1 .ConditionTrue ).
@@ -356,13 +354,6 @@ func (c *Controller) updateOperatorStatus(ctx context.Context, previousStatus *o
356354 return nil
357355}
358356
359- // isUpdatingTooLong determines if updating operands takes too long.
360- // it returns true if the progressing condition has been set to True for at least 15 minutes
361- func isUpdatingTooLong (operatorStatus * operatorv1.OperatorStatus , progressingConditionType string ) (bool , error ) {
362- progressing := v1helpers .FindOperatorCondition (operatorStatus .Conditions , progressingConditionType )
363- return progressing != nil && progressing .Status == operatorv1 .ConditionTrue && time .Now ().After (progressing .LastTransitionTime .Add (15 * time .Minute )), nil
364- }
365-
366357// hasDeploymentProgressed returns true if the deployment reports NewReplicaSetAvailable
367358// via the DeploymentProgressing condition
368359func hasDeploymentProgressed (status appsv1.DeploymentStatus ) bool {
0 commit comments