kubectl debug compatibility with pre-1.22 ephemeral containers API #102008
Description
What would you like to be added:
#101034 changed the Kind used with the /ephemeralcontainers
subresource from EphemeralContainers
to Pod
. This change will break old clients. (The ephemeral containers API is still in alpha, so this is acceptable.)
Currently, compatibility is broken in both directions:
- kubectl versions prior to 1.22 are incompatible with server version 1.22
- kubectl version 1.22 is incompatible with server versions prior to 1.22
Remediating the first requires complex server-side backwards compatibility logic which is not worth implementing for an alpha API.
Remediating the second for kubectl debug
should be much easier. The EphemeralContainer
struct hasn't changed, only the path in the object. We could detect the kind returned by the server and change the path used in the JSON patch (or even just naively try the previous path if the server returns an error).
This behavior would be removed after the old server version falls out of the support window.
Why is this needed:
This isn't strictly needed, but it would improve UX for what I expect is a common scenario: using the latest kubectl with older servers.
/sig cli
/priority important-soon