Skip to content

Commit eedf5ea

Browse files
author
Forrest Babcock
committed
fixes missing expectedGeneration by using the actualDaemonSet (was dep) instead of the desiredDaemonSet (was daemonSet)
1 parent 58b329f commit eedf5ea

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

pkg/operator/nodecadaemon.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,16 @@ func (c *NodeCADaemonController) processNextWorkItem() bool {
8080
}
8181
defer c.queue.Done(obj)
8282

83-
klog.V(4).Infof("get event from workqueue")
83+
klog.V(4).Infof("get event from workqueue: %s", obj)
84+
85+
// the workqueueKey we reference here is different than the one we use in eventHandler
86+
// use that to identify we are processing an item that was added back to the queue
87+
// can remove if not useful but curious why this didn't seem to be working for the
88+
// caches not synced error
89+
if obj == workqueueKey {
90+
klog.V(2).Infof("NodeCADaemonController processing requeued item %s", obj)
91+
}
92+
8493
if err := c.sync(); err != nil {
8594
c.queue.AddRateLimited(workqueueKey)
8695
klog.Errorf("NodeCADaemonController: unable to sync: %s, requeuing", err)

pkg/resource/nodecadaemon.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/openshift/library-go/pkg/operator/resource/resourceread"
1919
"github.com/openshift/library-go/pkg/operator/v1helpers"
2020

21-
"github.com/openshift/cluster-image-registry-operator/bindata"
21+
assets "github.com/openshift/cluster-image-registry-operator/bindata"
2222
"github.com/openshift/cluster-image-registry-operator/pkg/defaults"
2323
)
2424

@@ -70,27 +70,26 @@ func (ds *generatorNodeCADaemonSet) Create() (runtime.Object, error) {
7070
}
7171

7272
func (ds *generatorNodeCADaemonSet) Update(o runtime.Object) (runtime.Object, bool, error) {
73-
daemonSet := ds.expected()
73+
desiredDaemonSet := ds.expected()
7474

7575
_, opStatus, _, err := ds.operatorClient.GetOperatorState()
7676
if err != nil {
7777
return nil, false, err
7878
}
79-
80-
dep, updated, err := resourceapply.ApplyDaemonSet(
79+
actualDaemonSet, updated, err := resourceapply.ApplyDaemonSet(
8180
context.TODO(),
8281
ds.client,
8382
ds.recorder,
84-
daemonSet,
85-
resourcemerge.ExpectedDaemonSetGeneration(daemonSet, opStatus.Generations),
83+
desiredDaemonSet,
84+
resourcemerge.ExpectedDaemonSetGeneration(desiredDaemonSet, opStatus.Generations),
8685
)
8786
if err != nil {
8887
return o, updated, err
8988
}
9089

9190
if updated {
9291
updateStatusFn := func(newStatus *operatorv1.OperatorStatus) error {
93-
resourcemerge.SetDaemonSetGeneration(&newStatus.Generations, daemonSet)
92+
resourcemerge.SetDaemonSetGeneration(&newStatus.Generations, actualDaemonSet)
9493
return nil
9594
}
9695

@@ -100,11 +99,11 @@ func (ds *generatorNodeCADaemonSet) Update(o runtime.Object) (runtime.Object, bo
10099
updateStatusFn,
101100
)
102101
if err != nil {
103-
return dep, updated, err
102+
return actualDaemonSet, updated, err
104103
}
105104
}
106105

107-
return dep, updated, nil
106+
return actualDaemonSet, updated, nil
108107
}
109108

110109
func (ds *generatorNodeCADaemonSet) Delete(opts metav1.DeleteOptions) error {

0 commit comments

Comments
 (0)