kubeclient icon indicating copy to clipboard operation
kubeclient copied to clipboard

Support dryRun for POST, PUT, PATCH, and DELETE

Open rhysm opened this issue 6 years ago • 3 comments

Dry Run is now available as beta since Kubernetes v1.13.

This involves adding the dryRun query parameter to requests. I'm hesitant to jump in and add support for extra parameters to the various modifier _entity methods as I see some discussion around cleaning these up in #312.

I'm thinking #391 with the addition of the **opts to create_ and update_ will allow us to easily add a dryRun option to those methods.

rhysm avatar May 07 '19 21:05 rhysm

Nice. Do you know what happens if you send dryRun param to older k8s that doesn't understand it? Does it error or silently performs a wet run 😰? Is there a way to detect dry run support?

cben avatar May 08 '19 04:05 cben

Nice. Do you know what happens if you send dryRun param to older k8s that doesn't understand it? Does it error or silently performs a wet run? Is there a way to detect dry run support?

It seems that any feature in alpha/beta can be switched on/off via feature gates (aka feature flags) https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/ So you might run into a situation with older versions which lack support, but also even on a version where dryRun is present, but is disabled. AFAIK there's no way to query upfront on the list and status of feature gates, but perhaps @rhysm knows a way?

abonas avatar May 08 '19 08:05 abonas

@cben I don't have access to an older cluster right now. I have a branch https://github.com/rhysm/kubeclient/tree/dryRun which I've been using for testing if someone has one readily available. Otherwise I can get one running in the next few days and give it a try.

@abonas I don't know any way of determining via the API if feature gates are enabled.

I think we would have to document the option clearly to ensure users understand their cluster needs the dry run feature enabled for this to work. We could also name the option serverSideDryRun to be really explicit.

rhysm avatar May 08 '19 23:05 rhysm