<p>I'm writing a custom controller for Kubernetes in Go with the help of <a href="https://github.com/kubernetes/client-go/" rel="nofollow noreferrer">client-go</a>.
It is based on the <a href="https://github.com/kubernetes/sample-controller" rel="nofollow noreferrer">sample-controller</a> and working great so far.</p>

<p>The <code>SharedIndexInformer</code> has the option to periodically resync all objects. (<a href="https://github.com/kubernetes/client-go/blob/203d909765c952c466d36786ec7adf13d40f2281/tools/cache/shared_informer.go#L170" rel="nofollow noreferrer">Parameter <code>resyncPeriod</code></a> is set to 30 seconds in the <a href="https://github.com/kubernetes/sample-controller/blob/d90ced32cf661b9821ecb20b08502ad62377a035/main.go#L63" rel="nofollow noreferrer">sample-controller</a>.)</p>

<p><em>Is there a way to force a resync immediately?</em></p>

<p>The code which seems to handle the periodic resync seems to call <a href="https://github.com/kubernetes/client-go/blob/203d909765c952c466d36786ec7adf13d40f2281/tools/cache/reflector.go#L332" rel="nofollow noreferrer"><code>store.Resync()</code></a>.
I've tried calling <code>fooInformer.Informer().GetStore().Resync()</code>. The call succeeds, but the resync is not happening. What did I miss?</p>

<hr>

<p>I'm using <code>client-go</code> <code>v0.17.2</code> and the server is EKS <code>v1.14.9-eks-c0eccc</code>.</p>

Leonhard Wimmer
<p>Upon calling <code>fooInformer.Informer().GetStore().Resync()</code> you are using <code>Resync</code> function/method of the Store type defined in: client-go/tools/cache/store.go</p>

<p>And there we can see the following:</p>

<p>In the Store type definition:</p>

<pre><code>// Resync is meaningless in the terms appearing here but has
// meaning in some implementations that have non-trivial
// additional behavior (e.g., DeltaFIFO).
Resync() error
</code></pre>

<p>And in the Resync definition further below:</p>

<pre><code>// Resync is meaningless for one of these
func (c *cache) Resync() error {
return nil
}
</code></pre>

<p>Unless you actually have some other class to do the Resync, this is supposed to really do nothing.</p>

<p>That is why </p>

<blockquote>
  <p>The call succeeds, but the resync is not happening.</p>
</blockquote>

<p>Hope that helps!</p>
