Skip to content
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

Add resource version parameter for kubernetes strategy #207

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Argonus
Copy link

@Argonus Argonus commented Nov 27, 2024

Summary of changes

Why

In enviroment with multiple different application, using same kubernates cluster, many apps may trigger thousends of requests to cluster API to get requested resources. In our case, we talk about 500000 requests per hour. In such a case, direct requests to etcd may impact cluster resources. Solution for such a case may be

  • using cached version of resource (implemented in PR)
  • using watch to subscribe to changes (investigating possible solutions)

In this PR, as cache should be eventually consistent, I've implemented simples solution for such a issue, aka using cached version of resource instead of direct API call. According do AWS, which is our cluster provider, cache inconsistency should be few tens of milliseconds

What

  • Add kubernetes_resource_version parameter to Kubernates strategy, that allows to select given resource version, in our case, select 0 as a cache.
  • Added test cases for extended api call.

Testing Scenario

  • Create k8s cluster & 5 pods that should be connected.
  • Ensured that uri contains resourceVersion and the nodes are connected

Checklist

  • New functions have typespecs, changed functions were updated
  • Same for documentation, including moduledocs
  • Tests were added or updated to cover changes
  • Commits were squashed into a single coherent commit
  • Notes added to CHANGELOG file which describe changes at a high-level

@Argonus Argonus changed the title Add resource version parameter for kubernates strategy [WIP] Add resource version parameter for kubernates strategy Nov 27, 2024
@Argonus Argonus changed the title [WIP] Add resource version parameter for kubernates strategy [WIP - testing] Add resource version parameter for kubernates strategy Nov 27, 2024
@Argonus Argonus marked this pull request as ready for review November 28, 2024 16:37
@Argonus Argonus changed the title [WIP - testing] Add resource version parameter for kubernates strategy Add resource version parameter for kubernetes strategy Nov 28, 2024
@Argonus
Copy link
Author

Argonus commented Nov 28, 2024

@bitwalker
I've tested it on AWS cluster, and it works, The nodes are properly connected, and the connection is setup after restarts.
Also, I want to rethink using watch so maybe I'll have time to take it next year, but this one should be more than enough if app setup is kind of DDoSing k8s cluster :)
Would be amazing, if you can release minor bump with this improvement, if you have strong nope, I'll have to prepare fork of it.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant