<p>According to <a href="https://book.kubebuilder.io/cronjob-tutorial/webhook-implementation.html" rel="nofollow noreferrer">Kubebuilder documentation</a>, it is possible to implement immutable fields for a given CRD:</p>
<blockquote>
<p>We separate out ValidateCreate from ValidateUpdate to allow behavior
like making certain fields immutable, so that they can only be set on
creation.</p>
</blockquote>
<p>Would some of you have some examples or code samples about implementing this?</p>

Fabrice Jammes
<p>Using the Kubebuilder example:</p>
<pre class="lang-golang prettyprint-override"><code>func (r *CronJob) ValidateUpdate(old runtime.Object) error {
    oldCronJob, _ := old.(*CronJob)
    if r.Spec.ImmutableField != oldCronJob.Spec.ImmutableField {
        // accumulate errors
    }
    ...
    // return all errors
}
</code></pre>
