k8s-controller-core-resource
k8s-controller-core-resource copied to clipboard
ObjectCreated and ObjectDeleted work, ObjectUpdated doesnt.
This function is never called from the controller.
// if the item doesn't exist then it was deleted and we need to fire off the handler's
// ObjectDeleted method. but if the object does exist that indicates that the object
// was created (or updated) so run the ObjectCreated method
//
// after both instances, we want to forget the key from the queue, as this indicates
// a code path of successful queue key processing
if !exists {
c.logger.Infof("Controller.processNextItem: object deleted detected: %s", keyRaw)
c.handler.ObjectDeleted(item)
c.queue.Forget(key)
} else {
c.logger.Infof("Controller.processNextItem: object created detected: %s", keyRaw)
c.handler.ObjectCreated(item)
c.queue.Forget(key)
}