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: <ins> /* Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package customresource import ( "context" "reflect" "testing" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) func TestPrepareForUpdate(t *testing.T) { strategy := statusStrategy{} tcs := []struct { old      *unstructured.Unstructured obj      *unstructured.Unstructured expected *unstructured.Unstructured }{ { // changes to spec are ignored old: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": "old", }, }, obj: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": "new", }, }, expected: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": "old", }, }, }, { // changes to other places are also ignored old: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": "old", }, }, obj: &unstructured.Unstructured{ Object: map[string]interface{}{ "new": "new", }, }, expected: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": "old", }, }, }, { // delete status old: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec":   "old", "status": "old", }, }, obj: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": "old", }, }, expected: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": "old", }, }, }, { // update status old: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec":   "old", "status": "old", }, }, obj: &unstructured.Unstructured{ Object: map[string]interface{}{ "status": "new", }, }, expected: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec":   "old", "status": "new", }, }, }, { // update status and other parts old: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec":   "old", "status": "old", }, }, obj: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec":   "new", "new":    "new", "status": "new", }, }, expected: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec":   "old", "status": "new", }, }, }, } for index, tc := range tcs { strategy.PrepareForUpdate(context.TODO(), tc.obj, tc.old) if !reflect.DeepEqual(tc.obj, tc.expected) { t.Errorf("test %d failed: expected: %v, got %v", index, tc.expected, tc.obj) } } } </ins>