<p>I want to add Annotation as expiry time in a Kubernetes resource (rbac definition object).</p>
<p>How to add annotation as the expiry time.</p>
<p>Pseudo code is something like below,</p>
<pre class="lang-yaml prettyprint-override"><code> annotations:
   expiry-time: {{ current date + 1 hour }}
</code></pre>
<p>How to add this custom annotation? What's the language of code needs to be added for custom annotation?</p>

Rad4
<p>If you are using *nix shell like bash you can use the <a href="https://man7.org/linux/man-pages/man1/date.1.html" rel="nofollow noreferrer"><code>date</code></a> command 🔧 and the <a href="https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/" rel="nofollow noreferrer"><code>kubectl patch</code></a> command 🧰.</p>
<pre class="lang-sh prettyprint-override"><code>kubectl patch &lt;k8s-resource&gt; &lt;resource-name&gt; -p \
 &quot;{\&quot;metadata\&quot;:{\&quot;annotations\&quot;:{\&quot;expiry-time\&quot;:\&quot;`date -d '1 hour' '+%m-%d-%Y-%H:%M:%S'`\&quot;}}}&quot;
</code></pre>
<p>If you are on Mac you can substitute the <code>date</code> command with this:</p>
<pre class="lang-sh prettyprint-override"><code>date -v+1d '+%m/%d/%Y -%H:%M:%S'
</code></pre>
<p>✌️☮️</p>
