Skip to content

Commit

Permalink
Merge pull request kubevirt#8617 from crazytaxii/main
Browse files Browse the repository at this point in the history
Return directly when key function executes failed
  • Loading branch information
kubevirt-bot authored Oct 28, 2022
2 parents 2327f1f + 214f4b5 commit 085bb0d
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ func (c *DisruptionBudgetController) enqueueVirtualMachine(obj interface{}) {
key, err := controller.KeyFunc(vmi)
if err != nil {
logger.Object(vmi).Reason(err).Error("Failed to extract key from virtualmachineinstance.")
return
}
c.Queue.Add(key)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/virt-controller/watch/drain/evacuation/evacuation.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (c *EvacuationController) enqueueNode(obj interface{}) {
key, err := controller.KeyFunc(node)
if err != nil {
logger.Object(node).Reason(err).Error("Failed to extract key from node.")
return
}
c.Queue.Add(key)
}
Expand Down Expand Up @@ -240,6 +241,7 @@ func (c *EvacuationController) enqueueVirtualMachine(obj interface{}) {
key, err := controller.KeyFunc(vmi)
if err != nil {
logger.Object(vmi).Reason(err).Error("Failed to extract key from virtualmachineinstance.")
return
}
c.Queue.Add(key)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/virt-controller/watch/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,7 @@ func (c *MigrationController) enqueueMigration(obj interface{}) {
key, err := controller.KeyFunc(migration)
if err != nil {
logger.Object(migration).Reason(err).Error("Failed to extract key from migration.")
return
}
c.Queue.Add(key)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/virt-controller/watch/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (c *NodeController) enqueueNode(obj interface{}) {
key, err := controller.KeyFunc(node)
if err != nil {
logger.Object(node).Reason(err).Error("Failed to extract key from node.")
return
}
c.Queue.Add(key)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/virt-controller/watch/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ func (c *PoolController) enqueuePool(obj interface{}) {
key, err := controller.KeyFunc(pool)
if err != nil {
logger.Object(pool).Reason(err).Error("Failed to extract key from pool.")
return
}

// Delay prevents pool from being reconciled too often
Expand Down
3 changes: 2 additions & 1 deletion pkg/virt-controller/watch/replicaset.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ func (c *VMIReplicaSet) enqueueReplicaSet(obj interface{}) {
key, err := controller.KeyFunc(rs)
if err != nil {
logger.Object(rs).Reason(err).Error(failedRsKeyExtraction)
return
}
c.Queue.Add(key)
}
Expand All @@ -603,7 +604,7 @@ func max(x int, y int) int {
return y
}

//limit
// limit
func limit(x int, burstReplicas uint) int {
replicas := int(burstReplicas)
if x <= 0 {
Expand Down
1 change: 1 addition & 0 deletions pkg/virt-controller/watch/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,7 @@ func (c *VMController) enqueueVm(obj interface{}) {
key, err := controller.KeyFunc(vm)
if err != nil {
logger.Object(vm).Reason(err).Error(failedExtractVmkeyFromVmErrMsg)
return
}
c.Queue.Add(key)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/virt-controller/watch/vmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,7 @@ func (c *VMIController) enqueueVirtualMachine(obj interface{}) {
key, err := controller.KeyFunc(vmi)
if err != nil {
logger.Object(vmi).Reason(err).Error("Failed to extract key from virtualmachine.")
return
}
c.Queue.Add(key)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ func (c *WorkloadUpdateController) enqueueKubeVirt(obj interface{}) {
key, err := controller.KeyFunc(kv)
if err != nil {
logger.Object(kv).Reason(err).Error("Failed to extract key from KubeVirt.")
return
}
c.queue.AddAfter(key, defaultThrottleIntervalSeconds)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/virt-operator/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ func (c *KubeVirtController) enqueueKubeVirt(obj interface{}) {
key, err := controller.KeyFunc(kv)
if err != nil {
logger.Object(kv).Reason(err).Error("Failed to extract key from KubeVirt.")
return
}
c.delayedQueueAdder(key, c.queue)
}
Expand Down

0 comments on commit 085bb0d

Please sign in to comment.