Skip to content

Conversation

@hirishh
Copy link
Contributor

@hirishh hirishh commented Jul 15, 2025

Hello,

I've implemented a simple way to enable keepalive as suggested in #202 (comment)

I'm activating it only if "watch=1" is passed as queryParameters and keepalive is enabled in the clientApi configuration.
If you want this to be different, please advice, and I will change the implementation.

I've tested it with watch_list_pod example and using wireshark:

keepalive

Best,

hirishh

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hirishh
Once this PR has been reviewed and has the lgtm label, please assign brendandburns for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from ityuhui July 15, 2025 09:37
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 15, 2025
@brendandburns
Copy link
Contributor

Unfortunately, all of this code is generated, which means that the next time we regenerate, this change will be overridden.

The right place to fix this is in the generator itself:

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.h.mustache
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache

They've generally been really good about merging PRs relatively quickly.

Once the generator is updated, we can regenerate the code to pick up the change.

Sorry for the complexity, but generated code is the only way we can keep up with the very large surface area of the Kubernetes API.

@brendandburns
Copy link
Contributor

I also suspect that they won't accept the isWatchCall part since it is very kubernetes specific. I think the right thing to do is probably to implement a watch function or some-such that creates a separate API client and sets the config to do keepAlive. I'll leave it to you to figure out the approach that you like best.

@hirishh
Copy link
Contributor Author

hirishh commented Jul 15, 2025

Thank you for the information. I will try to do a PR there.

Honestly, I believe there is no need to do a check like "isWatchCall". Activating the keepalive has no consequences for normal calls.

@brendandburns
Copy link
Contributor

If the upstream code generator is ok to merge it without the check, we'll pick it up from there.

Thanks! (and apologies again for the complication)

@hirishh
Copy link
Contributor Author

hirishh commented Jul 22, 2025

@brendandburns
Copy link
Contributor

Looks like the PR in the generator merged, I will see about regenerating.

@hirishh
Copy link
Contributor Author

hirishh commented Jul 29, 2025

Looks like the PR in the generator merged, I will see about regenerating.

If you give me some more days, I'm going to do a PR tomorrow about "pre-invoke-callback" proposal (OpenAPITools/openapi-generator#21613 (comment)), so we can have a version where programmers can freely configure the curl handler

@hirishh
Copy link
Contributor Author

hirishh commented Jul 29, 2025

Here we go: OpenAPITools/openapi-generator#21654

@brendandburns
Copy link
Contributor

Ok sounds good, I will hold off on generating. Thanks for doing this!

@hirishh
Copy link
Contributor Author

hirishh commented Jul 30, 2025

Ok sounds good, I will hold off on generating. Thanks for doing this!

You can proceed now :)

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 1, 2025
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Details

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-sigs/prow repository.

@brendandburns
Copy link
Contributor

Closing because #280 merged. Thanks for the patience and working in the code generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants