@@ -187,7 +187,20 @@ func newIngressController(config *Configuration) *GenericController {
187
187
ic .syncQueue .Enqueue (obj )
188
188
},
189
189
DeleteFunc : func (obj interface {}) {
190
- delIng := obj .(* extensions.Ingress )
190
+ delIng , ok := obj .(* extensions.Ingress )
191
+ if ! ok {
192
+ // If we reached here it means the ingress was deleted but its final state is unrecorded.
193
+ tombstone , ok := obj .(cache.DeletedFinalStateUnknown )
194
+ if ! ok {
195
+ glog .Errorf ("couldn't get object from tombstone %#v" , obj )
196
+ return
197
+ }
198
+ delIng , ok = tombstone .Obj .(* extensions.Ingress )
199
+ if ! ok {
200
+ glog .Errorf ("Tombstone contained object that is not an Ingress: %#v" , obj )
201
+ return
202
+ }
203
+ }
191
204
if ! class .IsValid (delIng , ic .cfg .IngressClass , ic .cfg .DefaultIngressClass ) {
192
205
glog .Infof ("ignoring delete for ingress %v based on annotation %v" , delIng .Name , class .IngressKey )
193
206
return
@@ -223,7 +236,20 @@ func newIngressController(config *Configuration) *GenericController {
223
236
}
224
237
},
225
238
DeleteFunc : func (obj interface {}) {
226
- sec := obj .(* api.Secret )
239
+ sec , ok := obj .(* api.Secret )
240
+ if ! ok {
241
+ // If we reached here it means the secret was deleted but its final state is unrecorded.
242
+ tombstone , ok := obj .(cache.DeletedFinalStateUnknown )
243
+ if ! ok {
244
+ glog .Errorf ("couldn't get object from tombstone %#v" , obj )
245
+ return
246
+ }
247
+ sec , ok = tombstone .Obj .(* api.Secret )
248
+ if ! ok {
249
+ glog .Errorf ("Tombstone contained object that is not a Secret: %#v" , obj )
250
+ return
251
+ }
252
+ }
227
253
key := fmt .Sprintf ("%v/%v" , sec .Namespace , sec .Name )
228
254
ic .sslCertTracker .DeleteAll (key )
229
255
},
0 commit comments