-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Type of question
How to implement a specific feature
Question
What did you do?
Hello, I have a specific use case where I need to build my operator in a manner that allows it to handle pod deletion immediately while pooling creation events for a certain period of time ( pods are gated once they're created with a webhook).
I tried to use SyncPeriod to achieve this, but it seems like it isn't triggering the reconcile function each $period of time, I have learned that in the later versions this option has been moved from manager.Options
to manager.Options.Cache
does that mean that this option refreshes the cache instead of initiating the reconciliation each period of time ? if that's the case what are the approaches that I can follow to achieve the behavior that I am looking for ( periodic reconciliation ).
Here is how I am specifying it :
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Cache: cache.Options{
SyncPeriod: func() *time.Duration {
d := 5 * time.Minute
return &d
}(),
},
}
I appreciate any help with this !
What did you expect to see?
Reconcile function triggered each period of time ( 5 minutes in this case )
What did you see instead? Under which circumstances?
Reconciliation is still triggered based on events and no periodic triggering
Environment
Operator type:
/language go
Kubernetes cluster type: "vanila", one node cluster managed with kubeadm
$ operator-sdk version
:
$ go version
go1.23.0 linux/amd64
$ kubectl version
: Client Version: v1.30.13 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3