Delete function to add an object to the queue in case of deleting a resource
(old interface{})
| 256 | |
| 257 | // Delete function to add an object to the queue in case of deleting a resource |
| 258 | func (c *Controller) Delete(old interface{}) { |
| 259 | c.collectors.RecordEventReceived("delete", c.resource) |
| 260 | |
| 261 | if _, ok := old.(*csiv1.SecretProviderClassPodStatus); ok { |
| 262 | return |
| 263 | } |
| 264 | |
| 265 | if options.ReloadOnDelete == "true" { |
| 266 | if !c.resourceInIgnoredNamespace(old) && c.resourceInSelectedNamespaces(old) && secretControllerInitialized.Load() && configmapControllerInitialized.Load() { |
| 267 | c.enqueue(handler.ResourceDeleteHandler{ |
| 268 | Resource: old, |
| 269 | Collectors: c.collectors, |
| 270 | Recorder: c.recorder, |
| 271 | EnqueueTime: time.Now(), |
| 272 | }) |
| 273 | } else { |
| 274 | c.collectors.RecordSkipped("ignored_or_not_selected") |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | switch object := old.(type) { |
| 279 | case *v1.Namespace: |
| 280 | c.removeSelectedNamespaceFromCache(*object) |
| 281 | return |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | // enqueue adds an item to the queue and records metrics |
| 286 | func (c *Controller) enqueue(item interface{}) { |
nothing calls this directly
no test coverage detected