-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleting pods fails because the server returns a Pod object instead of a Status object #145
Comments
OK - so it took me some digging to find out that was discussed before in #44 and an attempt to mitigate this has been made in #46 & #47. I don't think the API is very intuitive but you can do something like this: public static async Task<object> SafeDeleteNamespacedPodAsync(this IKubernetes client, V1DeleteOptions body, string name, string namespaceParameter, int? gracePeriodSeconds = null, bool? orphanDependents = null, string propagationPolicy = null, string pretty = null, CancellationToken cancellationToken = default)
{
var result = await client.DeleteNamespacedPodAsync(body, name, namespaceParameter, gracePeriodSeconds, orphanDependents, propagationPolicy, pretty, cancellationToken).ConfigureAwait(false);
if (result.ApiVersion != null || !result.HasObject)
{
return result;
}
else
{
return result.ObjectView<V1Pod>();
}
} |
the design wants to avoid returning an untyped |
@tintoy That makes sense, so the API could look like this: Task<KubeObjectV1> DeleteNamespacedPodAsync(this IKubernetes client, V1DeleteOptions body, string name, string namespaceParameter, int? gracePeriodSeconds = null, bool? orphanDependents = null, string propagationPolicy = null, string pretty = null, CancellationToken cancellationToken = default) And calling code would be something like: var result = await DeleteNamespacedPodAsync(...);
if(result.Kind == "Pod")
{
...
}
else if(result.Kind == "Status")
{
...
} The advantage of this over the current implementation is that the caller can use the |
Yep! Or if you're using newer C# versions you can use pattern matching :) |
Should we close this issue since the pull request has been merged? |
I don't think that the Delete* code has been updated to return the parent type? |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Correct, this issue still persists. |
reopen for investigation |
Rotten issues close after 30d of inactivity. Send feedback to sig-contributor-experience at kubernetes/community. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
When you delete a Pod, the server responds with a Pod object instead of a Status object.
The C# client tries to parse the Pod object as a Status object and fails.
This seems to be a general issue with the Swagger/OpenAPI definition of the Kubernetes API, see kubernetes/kubernetes#59501, kubernetes-client/java#86, kubernetes/kubernetes#25716, kubernetes/kubernetes#30537
Opening an issue here mainly to make it discoverable for others.
The text was updated successfully, but these errors were encountered: