Skip to content

Commit

Permalink
feat: pull request and merge request workflow (#98)
Browse files Browse the repository at this point in the history
* feat(pr-workflow): add crd and controller for event handling

* chore: update manifests

---------

Co-authored-by: spoukke <sacha.bernheim@hey.com>
  • Loading branch information
2 people authored and Thibaut-Padok committed May 2, 2023
1 parent 2108e54 commit 83b6e6c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions internal/controllers/terraformlayer/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,16 @@ func GetExponentialBackOffTime(DefaultRequeueAfter time.Duration, attempts int)
var x float64 = float64(attempts)
return time.Duration(int32(math.Exp(x))) * DefaultRequeueAfter
}

func ignorePredicate() predicate.Predicate {
return predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
// Ignore updates to CR status in which case metadata.Generation does not change
return e.ObjectOld.GetGeneration() != e.ObjectNew.GetGeneration()
},
DeleteFunc: func(e event.DeleteEvent) bool {
// Evaluates to false if the object has been confirmed deleted.
return !e.DeleteStateUnknown
},
}
}

0 comments on commit 83b6e6c

Please sign in to comment.