podman-desktop icon indicating copy to clipboard operation
podman-desktop copied to clipboard

Users attempting to edit immutable properties should get a clearer error message.

Open jberkus opened this issue 9 months ago • 2 comments

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

  1. Create a Kubernetes/Kind cluster
  2. Create a pod on that cluster.
  3. Go into the Kubernetes/Pods UI
  4. Go to the Kube tab.
  5. Make some edits to immutable properties (in my case, ENV) to the object YAML
  6. Click "Apply changes to Cluster"
  7. 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:

  1. Errors sent back from kubernetes should be trapped and pretty-printed instead of giving the user raw HTTP errors.

  2. 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.

  3. 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.

jberkus avatar Mar 06 '25 23:03 jberkus

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.

amisskii avatar Mar 10 '25 10:03 amisskii

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.

jberkus avatar Mar 12 '25 20:03 jberkus