Repository: kubernetes
Issue: Inappropriate HTTP 500 Internal Server Error: `failed to create typed patch object (general/admin-api; /v1, Kind=Service): .spec.topologyKeys: field not declared in schema`
Labels: kind/bug,sig/api-machinery,triage/accepted

### What happened?

Executive Summary: `PATCH` endpoint doesn't honor or match `POST` endpoint `fieldValidation` and fails with 500 Internal Server Error instead of appropriately with 400 Bad Request or `Warning` header.

We're upgrading from K8S 1.20 to 1.28.(4) EKS and naturally encountering things that don't work.
Case in point here - Service topologyKeys that are gone.

While generating a patch on a Service resource the endpoint returned a 500 error unexpectedly: `failed to create typed patch object (general/admin-api; /v1, Kind=Service): .spec.topologyKeys: field not declared in schema`


### What did you expect to happen?

The `PATCH` endpoint needs to honor `fieldValidation` and either fail with 400 Bad Request or post `Warning` headers, same as `POST`, instead of failing with 500 Internal Server Error.

### How can we reproduce it (as minimally and precisely as possible)?

Here are the dumps of the logs for resource in question (the format is Python's repr). You can see the resource on the server and attempted patch and the response.

```
2023-12-25T20:21:09.132988 kubernator.k8s DEBUG k8s.py:356 Applying resource v1/Service/admin-api.general (dump only)
2023-12-25T20:21:09.604235 kubernator.k8s TRACE app.py:51 Current resource v1/Service/admin-api.general: {'kind': 'Service', 'apiVersion': 'v1', 'metadata': {'name': 'admin-api', 'namespace': 'general', 'uid': '503d8929-ae35-42e9-942e-8f8a3fce57d8', 'resourceVersion': '13163925', 'creationTimestamp': '2023-12-24T18:21:29Z', 'managedFields': [{'manager': 'kubernator', 'operation': 'Update', 'apiVersion': 'v1', 'time': '2023-12-24T18:21:29Z', 'fieldsType': 'FieldsV1', 'fieldsV1': {'f:spec': {'f:internalTrafficPolicy': {}, 'f:ports': {'.': {}, 'k:{"port":9086,"protocol":"TCP"}': {'.': {}, 'f:name': {}, 'f:port': {}, 'f:protocol': {}, 'f:targetPort': {}}}, 'f:selector': {}, 'f:sessionAffinity': {}, 'f:type': {}}}}]}, 'spec': {'ports': [{'name': 'http', 'protocol': 'TCP', 'port': 9086, 'targetPort': 9086}], 'selector': {'application': 'admin-api'}, 'clusterIP': '172.20.101.121', 'clusterIPs': ['172.20.101.121'], 'type': 'ClusterIP', 'sessionAffinity': 'None', 'ipFamilies': ['IPv4'], 'ipFamilyPolicy': 'SingleStack', 'internalTrafficPolicy': 'Cluster'}, 'status': {'loadBalancer': {}}}
2023-12-25T20:21:09.604736 kubernator.k8s TRACE app.py:51 Attempting to retrieve a normalized patch for resource v1/Service/admin-api.general: {'apiVersion': 'v1', 'kind': 'Service', 'metadata': {'name': 'admin-api', 'namespace': 'general'}, 'spec': {'selector': {'application': 'admin-api'}, 'ports': [{'name': 'http', 'protocol': 'TCP', 'port': 9086, 'targetPort': 9086}], 'topologyKeys': ['kubernetes.io/hostname', 'topology.kubernetes.io/zone', 'topology.kubernetes.io/region', '*']}}

...

2023-12-25T20:21:10.096186 kubernator CRITICAL app.py:489 Kubernator terminated with an error: (500)
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({'Audit-Id': '367a9876-91cb-4398-8b16-0595386068be', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '53190751-7653-410e-bfc2-1b4d719bb176', 'X-Kubernetes-Pf-Prioritylevel-Uid': '6471b8cf-26e3-407f-9af6-cbea34b51740', 'Date': 'Mon, 25 Dec 2023 17:21:09 GMT', 'Content-Length': '217'})
HTTP response body: b'{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"failed to create typed patch object (general/admin-api; /v1, Kind=Service): .spec.topologyKeys: field not declared in schema","code":500}\n'

```



### Anything else we need to know?

I will be providing a standalone reproducible case with Kubernator with minikube.

### Kubernetes version

<details>
1.28.4 EKS
</details>


### Cloud provider

<details>
AWS
</details>


### OS version

<details>

N/A

</details>


### Install tools

<details>

</details>


### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>