Code change:
the said: However the are different, it does not allow to set spec and metadata, but other changes are not ignored. And updates to other parts are not validated.
/cc for some suggestions.
/assign
Made a pull request:
Is the documentation wrong or the implementation? I think there was a longer discussion about the correct behaviour in the PR, but haven't found it yet.
It strange that other parts rather than metadata and spec can be modified and they are not validated. So I think the implementation is wrong, at least.
We should follow the design doc, I think.
/sig api-machinery
/priority important-soon
I agree the current behaviour is wrong. Added some comments to Especially, worries me whether we really have to right /status behaviour. Not really related to the given issue. But as we are touching the /status behaviour, we should clarify that as well.
[MILESTONENOTIFIER] Milestone Issue Needs Approval Action required: This issue must have the label applied by a SIG maintainer. If the label is not applied within 3 days, the issue will be moved out of the v1.11 milestone. <details<summaryIssue Labels</summary- : Issue will be escalated to these SIGs if needed. : Escalate to the issue owners and SIG owner; move out of milestone after several unsuccessful escalation attempts. : Fixes a bug discovered during the current release. </details<details<summaryHelp</summary<ul<li<a href=""Additional instructions</a</li<li<a href=""Commands for setting labels</a</li</ul</details

Related discussion:
text: } func (a statusStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { <ins> // update is only allowed to set status </ins> newCustomResourceObject := obj.(*unstructured.Unstructured) <del> oldCustomResourceObject := old.(*unstructured.Unstructured) </del> newCustomResource := newCustomResourceObject.UnstructuredContent() <del> oldCustomResource := oldCustomResourceObject.UnstructuredContent() // update is not allowed to set spec and metadata _, ok1 := newCustomResource["spec"] _, ok2 := oldCustomResource["spec"] switch { case ok2: newCustomResource["spec"] = oldCustomResource["spec"] case ok1: delete(newCustomResource, "spec") } </del> <ins> status, ok := newCustomResource["status"] </ins> <del> newCustomResourceObject.SetAnnotations(oldCustomResourceObject.GetAnnotations()) newCustomResourceObject.SetFinalizers(oldCustomResourceObject.GetFinalizers()) newCustomResourceObject.SetGeneration(oldCustomResourceObject.GetGeneration()) newCustomResourceObject.SetLabels(oldCustomResourceObject.GetLabels()) newCustomResourceObject.SetOwnerReferences(oldCustomResourceObject.GetOwnerReferences()) newCustomResourceObject.SetSelfLink(oldCustomResourceObject.GetSelfLink()) </del> <ins> // copy old object into new object oldCustomResourceObject := old.(*unstructured.Unstructured) // overridding the resourceVersion in metadata is safe here, we have already checked that // new object and old object have the same resourceVersion. *newCustomResourceObject = *oldCustomResourceObject.DeepCopy() // set status newCustomResource = newCustomResourceObject.UnstructuredContent() if ok { newCustomResource["status"] = status } else { delete(newCustomResource, "status") } </ins> } // ValidateUpdate is the default update validation for an end user updating status.