Repository: kubernetes
Issue: failed to create patch: unable to find api field in struct Probe for the json field "grpc"
Labels: kind/bug,sig/apps,needs-triage

### What happened?

When running `helm upgrade ...` for a certain release, the following error has occurs:
```
$ helm upgrade --debug --install <REDACTED>
history.go:53: [debug] getting history for release <REDACTED>
upgrade.go:121: [debug] preparing upgrade for <REDACTED>
upgrade.go:428: [debug] reusing the old release's values
upgrade.go:129: [debug] performing update for <REDACTED>
upgrade.go:296: [debug] creating upgraded release for <REDACTED>
client.go:173: [debug] checking 6 resources for changes
client.go:436: [debug] Looks like there are no changes for Service "<REDACTED>"
client.go:205: [debug] error updating the resource "<REDACTED>":
 	 failed to create patch: unable to find api field in struct Probe for the json field "grpc"
 upgrade.go:355: [debug] warning: Upgrade "<REDACTED>" failed: failed to create patch: unable to find api field in struct Probe for the json field "grpc"
 ##[error]history.go:53: [debug] getting history for release <REDACTED>
upgrade.go:121: [debug] preparing upgrade for <REDACTED>
upgrade.go:428: [debug] reusing the old release's values
upgrade.go:129: [debug] performing update for <REDACTED>
upgrade.go:296: [debug] creating upgraded release for <REDACTED>
client.go:173: [debug] checking 6 resources for changes
client.go:436: [debug] Looks like there are no changes for Service "<REDACTED>"
client.go:205: [debug] error updating the resource "<REDACTED>":
	 failed to create patch: unable to find api field in struct Probe for the json field "grpc"
upgrade.go:355: [debug] warning: Upgrade "<REDACTED>" failed: failed to create patch: unable to find api field in struct Probe for the json field "grpc"
Error: UPGRADE FAILED: failed to create patch: unable to find api field in struct Probe for the json field "grpc"
helm.go:94: [debug] failed to create patch: unable to find api field in struct Probe for the json field "grpc"
helm.sh/helm/v3/pkg/kube.(*Client).Update
	/home/circleci/helm.sh/helm/pkg/kube/client.go:218
helm.sh/helm/v3/pkg/action.(*Upgrade).performUpgrade
	/home/circleci/helm.sh/helm/pkg/action/upgrade.go:310
helm.sh/helm/v3/pkg/action.(*Upgrade).Run
	/home/circleci/helm.sh/helm/pkg/action/upgrade.go:130
main.newUpgradeCmd.func2
	/home/circleci/helm.sh/helm/cmd/helm/upgrade.go:154
github.com/spf13/cobra.(*Command).execute
	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842
github.com/spf13/cobra.(*Command).ExecuteC
	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950
github.com/spf13/cobra.(*Command).Execute
	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main
	/home/circleci/helm.sh/helm/cmd/helm/helm.go:93
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1373
UPGRADE FAILED
main.newUpgradeCmd.func2
	/home/circleci/helm.sh/helm/cmd/helm/upgrade.go:156
github.com/spf13/cobra.(*Command).execute
	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842
github.com/spf13/cobra.(*Command).ExecuteC
	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950
github.com/spf13/cobra.(*Command).Execute
	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main
	/home/circleci/helm.sh/helm/cmd/helm/helm.go:93
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1373

2024-12-01T16:36:53.8872455Z Error: UPGRADE FAILED: failed to create patch: unable to find api field in struct Probe for the json field "grpc"
2024-12-01T16:36:53.8882936Z helm.go:94: [debug] failed to create patch: unable to find api field in struct Probe for the json field "grpc"
2024-12-01T16:36:53.8883982Z helm.sh/helm/v3/pkg/kube.(*Client).Update
2024-12-01T16:36:53.8884509Z 	/home/circleci/helm.sh/helm/pkg/kube/client.go:218
2024-12-01T16:36:53.8884968Z helm.sh/helm/v3/pkg/action.(*Upgrade).performUpgrade
2024-12-01T16:36:53.8885425Z 	/home/circleci/helm.sh/helm/pkg/action/upgrade.go:310
2024-12-01T16:36:53.8885874Z helm.sh/helm/v3/pkg/action.(*Upgrade).Run
2024-12-01T16:36:53.8886315Z 	/home/circleci/helm.sh/helm/pkg/action/upgrade.go:130
2024-12-01T16:36:53.8886733Z main.newUpgradeCmd.func2
2024-12-01T16:36:53.8887154Z 	/home/circleci/helm.sh/helm/cmd/helm/upgrade.go:154
2024-12-01T16:36:53.8887599Z github.com/spf13/cobra.(*Command).execute
2024-12-01T16:36:53.8888049Z 	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842
2024-12-01T16:36:53.8888497Z github.com/spf13/cobra.(*Command).ExecuteC
2024-12-01T16:36:53.8888948Z 	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950
2024-12-01T16:36:53.8889382Z github.com/spf13/cobra.(*Command).Execute
2024-12-01T16:36:53.8889825Z 	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
2024-12-01T16:36:53.8890231Z main.main
2024-12-01T16:36:53.8890638Z 	/home/circleci/helm.sh/helm/cmd/helm/helm.go:93
2024-12-01T16:36:53.8891035Z runtime.main
2024-12-01T16:36:53.8891429Z 	/usr/local/go/src/runtime/proc.go:203
2024-12-01T16:36:53.8891825Z runtime.goexit
2024-12-01T16:36:53.8892223Z 	/usr/local/go/src/runtime/asm_amd64.s:1373
2024-12-01T16:36:53.8892633Z UPGRADE FAILED
2024-12-01T16:36:53.8893026Z main.newUpgradeCmd.func2
2024-12-01T16:36:53.8893464Z 	/home/circleci/helm.sh/helm/cmd/helm/upgrade.go:156
2024-12-01T16:36:53.8893917Z github.com/spf13/cobra.(*Command).execute
2024-12-01T16:36:53.8894386Z 	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842
2024-12-01T16:36:53.8894933Z github.com/spf13/cobra.(*Command).ExecuteC
2024-12-01T16:36:53.8895407Z 	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950
2024-12-01T16:36:53.8895846Z github.com/spf13/cobra.(*Command).Execute
2024-12-01T16:36:53.8896265Z 	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
2024-12-01T16:36:53.8896669Z main.main
2024-12-01T16:36:53.8897065Z 	/home/circleci/helm.sh/helm/cmd/helm/helm.go:93
2024-12-01T16:36:53.8897469Z runtime.main
2024-12-01T16:36:53.8897823Z 	/usr/local/go/src/runtime/proc.go:203
2024-12-01T16:36:53.8898178Z runtime.goexit
2024-12-01T16:36:53.8898541Z 	/usr/local/go/src/runtime/asm_amd64.s:1373
2024-12-01T16:36:53.8976539Z ##[section]Finishing: helm upgrade
```

I suspect the issue is coming from the `kubectl patch` command which helm uses, as you can see in the error message:
`failed to create patch`

This only happens when there's a deployment's pod spec with a *Probe (startupProbe, readinessProbe, etc...), with the `grpc` attribute, but the `grpc.service` attribute is an empty string.
When I put something in the service, this works fine.
e.g:
This works:
```yaml
readinessProbe:
  grpc:
    port: 8080
    service: "readiness"
```
These don't work:
```yaml
readinessProbe:
  grpc:
    port: 8080
    service: ""
```
```yaml
readinessProbe:
  grpc:
    port: 8080
    service:
```

### What did you expect to happen?

The *Probe struct should be able to receive an "empty" value for the `grpc.service` endpoint.

### How can we reproduce it (as minimally and precisely as possible)?

 - Create a deployment with these values (both should behave the same imo):
```yaml
readinessProbe:
  grpc:
    port: 8080
    service: ""
```
```yaml
readinessProbe:
  grpc:
    port: 8080
    service:
```
 - Apply the deployment to a cluster
 - Make a change to something unrelated to the `grpc` struct
 - Try to `kubectl patch` it

### Anything else we need to know?

_No response_

### Kubernetes version

<details>

```console
$ kubectl version
Client Version: v1.30.5
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.9
```

</details>


### Cloud provider

<details>
Azure AKS
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
BuildNumber  Caption                          OSArchitecture  Version
26100        Microsoft Windows 11 Enterprise  64-bit          10.0.26100
```

</details>


### Install tools

<details>

</details>


### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>