<p>I'm using <a href="https://external-secrets.io/v0.6.0-rc1/" rel="nofollow noreferrer">External Secrets</a> to sync my secrets from azure.  And now I need a programmatic way to trigger the sync.  With <code>kubectl</code> the command is</p>
<pre class="lang-bash prettyprint-override"><code>kubectl annotate es my-es force-sync=$(date +%s) --overwrite
</code></pre>
<p>So, I try to use k8s js sdk to do this.  I can success fully get the External Secret</p>
<pre class="lang-js prettyprint-override"><code>await crdApi.getNamespacedCustomObject(&quot;external-secrets.io&quot;, &quot;v1beta1&quot;, &quot;default&quot;, &quot;externalsecrets&quot;, &quot;my-es&quot;)
</code></pre>
<p>However, when I try to update it with <code>patchNamespacedCustomObject</code>, it always tells me <code>&quot;the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml&quot;</code></p>
<p>Here's my code</p>
<pre class="lang-js prettyprint-override"><code>const kc = new k8s.KubeConfig();
kc.loadFromString(kubeConfig);

const crdApi = kc.makeApiClient(k8s.CustomObjectsApi);

let patch = [{
    &quot;op&quot;: &quot;replace&quot;,
    &quot;path&quot;: &quot;/metadata/annotations&quot;,
    &quot;value&quot;: {
        &quot;force-sync&quot;: &quot;1663315075&quot;
    }
}];

await crdApi.patchNamespacedCustomObject(&quot;external-secrets.io&quot;, &quot;v1beta1&quot;, &quot;default&quot;, &quot;externalsecrets&quot;, &quot;my-es&quot;, patch);


</code></pre>
<p>I am referring their patch example <a href="https://github.com/kubernetes-client/javascript/blob/master/examples/patch-example.js" rel="nofollow noreferrer">here</a></p>

Bomin
<pre class="lang-java prettyprint-override"><code>const options = {
  &quot;headers&quot;: {
    &quot;Content-type&quot;: k8s.PatchUtils.PATCH_FORMAT_JSON_PATCH
  }
};
</code></pre>
<p>is still required.</p>
