Skip to content

Commit

Permalink
refactor binding reconciliation functions (openshift#1687)
Browse files Browse the repository at this point in the history
* refactor binding reconciliation functions

* address comments
  • Loading branch information
kibbles-n-bytes authored and Ville Aikas committed Jan 31, 2018
1 parent 5699360 commit 36b5de9
Show file tree
Hide file tree
Showing 5 changed files with 708 additions and 1,082 deletions.
23 changes: 23 additions & 0 deletions pkg/controller/controller.go
Expand Up @@ -19,6 +19,7 @@ package controller
import (
"encoding/json"
"fmt"
"net/http"
"sync"
"time"

Expand Down Expand Up @@ -622,3 +623,25 @@ func (c *controller) reconciliationRetryDurationExceeded(operationStartTime *met
}
return true
}

// shouldStartOrphanMitigation returns whether an error with the given status
// code indicates that orphan migitation should start.
func shouldStartOrphanMitigation(statusCode int) bool {
is2XX := (statusCode >= 200 && statusCode < 300)
is5XX := (statusCode >= 500 && statusCode < 600)

return (is2XX && statusCode != http.StatusOK) ||
statusCode == http.StatusRequestTimeout ||
is5XX
}

// ReconciliationAction reprents a type of action the reconciler should take
// for a resource.
type ReconciliationAction string

const (
reconcileAdd ReconciliationAction = "Add"
reconcileUpdate ReconciliationAction = "Update"
reconcileDelete ReconciliationAction = "Delete"
reconcilePoll ReconciliationAction = "Poll"
)

0 comments on commit 36b5de9

Please sign in to comment.