Users attempting to edit immutable properties should get a clearer error message.
Bug description
Bug UPDATED based on discussion below.
I attempted to edit immutable properties in the YAML of a pod using the "Kube" tab of the Pods interface for a running Pod on Kubernetes. It errored on apply, with a confusing -- and largely untrapped -- error message.
Operating system
Fedora Linux 41 (Bluefin)
Installation Method
Flathub (Linux)
Version
1.17.0
Steps to reproduce
- Create a Kubernetes/Kind cluster
- Create a pod on that cluster.
- Go into the Kubernetes/Pods UI
- Go to the Kube tab.
- Make some edits to immutable properties (in my case, ENV) to the object YAML
- Click "Apply changes to Cluster"
- Get the following error:
Could not apply Kubernetes YAML: Error: HTTP-Code: 409
Message: Unsuccessful HTTP Request
Body: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"pods \\\"my-pod\\\" already exists\",\"reason\":\"AlreadyExists\",\"details\":{\"name\":\"my-pod\",\"kind\":\"pods\"},\"code\":409}\n"
Headers: {"cache-control":"no-cache, private","connection":"close","content-length":"190","content-type":"application/json","date":"Thu, 06 Mar 2025 23:45:51 GMT","x-kubernetes-pf-flowschema-uid":"88f36c47-351e-42db-8acc-aad0ab953eab","x-kubernetes-pf-prioritylevel-uid":"f139851a-a4b9-4bf5-8b82-66df40db2004"}
Additional context
There are three bugs here that I can see:
-
Errors sent back from kubernetes should be trapped and pretty-printed instead of giving the user raw HTTP errors.
-
It's not clear why we're getting an "already exists" error here; how is PD sending the pod definition change? I would have expected a "cannot apply" error.
-
Regardless, users attempting to edit immutable properties is a common enough mistake that we should try to give the user a more helpful error message, even if it's as a suggestion in addition to the real error message.
Hello @jberkus, thank you for opening the issue. It seems that you've tried to change a resource property that is immutable, such as metadata.name or metadata.namespace. Please try changing something like label.app to verify that editing the YAML file is working correctly. There is a related issue: https://github.com/podman-desktop/podman-desktop/issues/9324.
I didn't think I was changing an immutable property, but on checking I was trying to do so.
Editing this issue to make it clear that the problem is the error messages.