controller: Move SyncAt annotation to API
This commit is contained in:
parent
fce046f440
commit
61d49cab5e
|
@ -11,3 +11,8 @@ type Source interface {
|
|||
// GetInterval returns the interval at which the source is updated.
|
||||
GetInterval() metav1.Duration
|
||||
}
|
||||
|
||||
const (
|
||||
// SyncAtAnnotation is the timestamp corresponding to an on-demand source sync.
|
||||
SyncAtAnnotation string = "source.fluxcd.io/syncAt"
|
||||
)
|
||||
|
|
|
@ -24,6 +24,8 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
|
||||
"sigs.k8s.io/controller-runtime/pkg/event"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
)
|
||||
|
||||
type SourceChangePredicate struct {
|
||||
|
@ -43,8 +45,8 @@ func (SourceChangePredicate) Update(e event.UpdateEvent) bool {
|
|||
}
|
||||
|
||||
// handle force sync
|
||||
if val, ok := e.MetaNew.GetAnnotations()[ForceSyncAnnotation]; ok {
|
||||
if valOld, okOld := e.MetaOld.GetAnnotations()[ForceSyncAnnotation]; okOld {
|
||||
if val, ok := e.MetaNew.GetAnnotations()[sourcev1.SyncAtAnnotation]; ok {
|
||||
if valOld, okOld := e.MetaOld.GetAnnotations()[sourcev1.SyncAtAnnotation]; okOld {
|
||||
if val != valOld {
|
||||
return true
|
||||
}
|
||||
|
@ -56,10 +58,6 @@ func (SourceChangePredicate) Update(e event.UpdateEvent) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
const (
|
||||
ForceSyncAnnotation string = "source.fluxcd.io/syncAt"
|
||||
)
|
||||
|
||||
type GarbageCollectPredicate struct {
|
||||
predicate.Funcs
|
||||
Scheme *runtime.Scheme
|
||||
|
|
Loading…
Reference in New Issue