diff --git a/interceptor/forward_wait_func.go b/interceptor/forward_wait_func.go index c31315277..2bfdbeb68 100644 --- a/interceptor/forward_wait_func.go +++ b/interceptor/forward_wait_func.go @@ -37,13 +37,9 @@ func newDeployReplicasForwardWaitFunc( for { select { case event := <-eventCh: - deployment := event.Object.(*appsv1.Deployment) - if err != nil { - log.Printf( - "Error getting deployment %s after change was triggered (%s)", - deployName, - err, - ) + deployment, ok := event.Object.(*appsv1.Deployment) + if !ok { + log.Println("Didn't get a deployment back in event") } if moreThanPtr(deployment.Spec.Replicas, 0) { return nil diff --git a/pkg/k8s/deployment_cache.go b/pkg/k8s/deployment_cache.go index 77a0c64f4..e8690919b 100644 --- a/pkg/k8s/deployment_cache.go +++ b/pkg/k8s/deployment_cache.go @@ -57,7 +57,12 @@ func NewK8sDeploymentCache( evt := <-ch ret.broadcaster.Action(evt.Type, evt.Object) ret.rwm.Lock() - depl := evt.Object.(*appsv1.Deployment) + depl, ok := evt.Object.(*appsv1.Deployment) + // if we didn't get back a deployment in the event, + // something is wrong that we can't fix, so just continue + if !ok { + continue + } ret.latestEvts[depl.GetObjectMeta().GetName()] = evt ret.rwm.Unlock() }