Skip to content

Commit

Permalink
DeleteFunc could recieve a DeletedFinalStateUnknown
Browse files Browse the repository at this point in the history
It's possibel the DeleteFunc could recieve an object of type
DeleteFinalStateUnknown.
https://godoc.org/k8s.io/client-go/tools/cache#DeletedFinalStateUnknown

If we do recieve one, just ignore it.
  • Loading branch information
markmandel committed Feb 26, 2018
1 parent 1f6d2f2 commit ee0ec34
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/gameservers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ func NewController(
// track pod deletions, for when GameServers are deleted
kubeInformerFactory.Core().V1().Pods().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
DeleteFunc: func(obj interface{}) {
pod := obj.(*corev1.Pod)
if stablev1alpha1.GameServerRolePodSelector.Matches(labels.Set(pod.ObjectMeta.Labels)) {
// Could be a DeletedFinalStateUnknown, in which case, just ignore it
pod, ok := obj.(*corev1.Pod)
if ok && stablev1alpha1.GameServerRolePodSelector.Matches(labels.Set(pod.ObjectMeta.Labels)) {
if owner := metav1.GetControllerOf(pod); owner != nil {
c.workerqueue.Enqueue(cache.ExplicitKey(pod.ObjectMeta.Namespace + "/" + owner.Name))
}
Expand Down

0 comments on commit ee0ec34

Please sign in to comment.