-
Notifications
You must be signed in to change notification settings - Fork 979
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
Adding traffic_distribution field #2625
base: v3-major-release
Are you sure you want to change the base?
Conversation
89a16b6
to
e045752
Compare
5aad8b0
to
7ec763b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All in all, great job! 🚀
I have left some cosmetic suggestions. 😊
Thanks for making the test function flexible with the additional attribute, once the Kubernetes team adds more traffic distribution values, it can be reused to add more tests.
Description: "Specifies the preferred strategy for distributing traffic to Service endpoints. When set to PreferClose, the Kubernetes will prioritize routing traffic to endpoints that are topologically closer", | ||
Optional: true, | ||
ValidateFunc: validation.StringInSlice([]string{ | ||
"PreferClose", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest importing such predefined words from Kubernetes code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arybolovlev Wow, that's a clever approach! Would this be considered best practice for the future? Due to the k8s api were to update / expand on the traffic_distrubtion
field with additional options, our code would automatically align with those changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say yes, this is the best practice regarding 'static' values. At least in this case, we can be sure that we validate against the same values that Kubernetes API relies on.
our code would automatically align with those changes?
Unfortunately, no, we will have to either follow up with the changes that the Kubernetes team introduces or wait for end users to report that missing part. Likely, this new feature will be highlighted in the release notes. Another option, with auto code generation, should be resolved as we bump up dependencies.
Description
Addresses #2581
This PR introduces the traffic_distribution field to the kubernetes_service_v1 resource. This field, introduced in Kubernetes v1.31 provides a way to influence traffic routing within a Kubernetes Service by specifying a preference for traffic distribution.
Acceptance tests
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References
Community Note