-
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.
.changelog/2625.txt
Outdated
@@ -0,0 +1,3 @@ | |||
```release-note:enhancement | |||
Added the `traffic_distribution` field to the `kubernetes_service_v1` resource |
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 to use imperative voice here and add kubernetes_service
too, since both resources refer to the same code:
```release-note:enhancement
`resource/kubernetes_service`: add a new field `traffic_distribution`.
```
```
`resource/kubernetes_service_v1`: add a new field `traffic_distribution`.
```
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?
resourceName := "kubernetes_service_v1.test" | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, |
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.
Please add here skipIfClusterVersionLessThan
to make sure these test runs on Kubernetes 1.31+ only.
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