@@ -24,6 +24,7 @@ import (
2424
2525 corev1 "k8s.io/api/core/v1"
2626 "k8s.io/apimachinery/pkg/api/equality"
27+ "k8s.io/apimachinery/pkg/api/meta"
2728 "k8s.io/apimachinery/pkg/util/runtime"
2829 "k8s.io/apimachinery/pkg/util/wait"
2930 "k8s.io/client-go/tools/cache"
@@ -135,10 +136,6 @@ func (c *bufferController) configureEventHandlers() {
135136 oldQuota := oldObj .(* corev1.ResourceQuota )
136137 newQuota := newObj .(* corev1.ResourceQuota )
137138
138- if oldQuota .ResourceVersion == newQuota .ResourceVersion {
139- c .enqueueNamespace (newObj )
140- return
141- }
142139 // Reconcile only on Status changes (Status.Hard and Status.Used)
143140 if equality .Semantic .DeepEqual (oldQuota .Status .Hard , newQuota .Status .Hard ) &&
144141 equality .Semantic .DeepEqual (oldQuota .Status .Used , newQuota .Status .Used ) {
@@ -157,6 +154,19 @@ func (c *bufferController) configureEventHandlers() {
157154 c .enqueueBuffersReferencingPodTemplate (obj )
158155 },
159156 UpdateFunc : func (oldObj , newObj interface {}) {
157+ oldMeta , err := meta .Accessor (oldObj )
158+ if err != nil {
159+ klog .Errorf ("CapacityBuffer controller: failed to get meta for object, err: %v" , err )
160+ return
161+ }
162+ newMeta , err := meta .Accessor (newObj )
163+ if err != nil {
164+ klog .Errorf ("CapacityBuffer controller: failed to get meta for object, err: %v" , err )
165+ return
166+ }
167+ if oldMeta .GetGeneration () == newMeta .GetGeneration () {
168+ return
169+ }
160170 c .enqueueBuffersReferencingPodTemplate (newObj )
161171 },
162172 DeleteFunc : func (obj interface {}) {
0 commit comments