-
Notifications
You must be signed in to change notification settings - Fork 48
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
Cannot delete pod forcibly with CoreV1API_deleteNamespacedPod API #158
Comments
Yes. it's a problem. Now, can you set a small value such as Later, I want to fix this issue by introducing a magic number for the undefined integer parameter in openapi-generator. e.g. #define INT_UNDEFINED -9997
or
#define INT_UNDEFINED INT_MIN // INT_MIN is defined in <limits.h>
...
if (gracePeriodSeconds != INT_UNDEFINED) // the current code is `if (gracePeriodSeconds)`
{
keyQuery_gracePeriodSeconds = strdup("gracePeriodSeconds");
valueQuery_gracePeriodSeconds = calloc(1,MAX_NUMBER_LENGTH);
snprintf(valueQuery_gracePeriodSeconds, MAX_NUMBER_LENGTH, "%d", gracePeriodSeconds);
keyPairQuery_gracePeriodSeconds = keyValuePair_create(keyQuery_gracePeriodSeconds, valueQuery_gracePeriodSeconds);
list_addElement(localVarQueryParameters,keyPairQuery_gracePeriodSeconds);
}
... |
Ok, thanks for the confirmation. gracePeriodSeconds=1 does not work in my test. If I do "kubectl delete pod " when the pod is in Running phase the kubectl commands hangs until the pod is forcibly deleted by sending a Pod delete with gracePeriodSeconds=0. |
Got it. If you need a fix now, apply the patch below and build yourself please. diff --git a/kubernetes/api/CoreV1API.c b/kubernetes/api/CoreV1API.c
index 0dff85d..cb0ce55 100644
--- a/kubernetes/api/CoreV1API.c
+++ b/kubernetes/api/CoreV1API.c
@@ -16088,7 +16088,6 @@ CoreV1API_deleteNamespacedPod(apiClient_t *apiClient, char * name , char * _name
char *keyQuery_gracePeriodSeconds = NULL;
char * valueQuery_gracePeriodSeconds = NULL;
keyValuePair_t *keyPairQuery_gracePeriodSeconds = 0;
- if (gracePeriodSeconds)
{
keyQuery_gracePeriodSeconds = strdup("gracePeriodSeconds");
valueQuery_gracePeriodSeconds = calloc(1,MAX_NUMBER_LENGTH); |
To delete a pod forcibly you need to set gracePeriodSeconds to zero. zero means delete immediately.
Example:
DELETE /api/v1/namespaces/{namespace}/pods/{name}?gracePeriodSeconds=0
However, if calling CoreV1API_deleteNamespacedPod with the gracePeriodSeconds parameter set to 0 the gracePeriodSeconds query parameter is not created in the HTTP request.
The text was updated successfully, but these errors were encountered: