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

fix(TrafficRoute): use default value when choiceCount is 0 #7938

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

lukidzi
Copy link
Contributor

@lukidzi lukidzi commented Oct 2, 2023

Checklist prior to review

Api says that when choiceCount is not defined we are using a default value of 2 which is correct from the envoy perspective but not from kuma API.

GetLeastRequest() returns an object that has choiceCount equal 0, so when a user creates a policy without choiceCount it doesn't fail on the API but will fail on xds configuration generation because envoy requires a minimum value of 2.
I've changed a bit how validation works now:

  • validate object if the value is equal 1, that won't cause xds configuration to fail and break the sidecar
  • when the value is equal to 0 we assume that it's an empty object and we set it to default 2

@lukidzi lukidzi requested a review from a team as a code owner October 2, 2023 10:56
@lukidzi lukidzi requested review from slonka and jakubdyszkiewicz and removed request for a team October 2, 2023 10:56
@jakubdyszkiewicz
Copy link
Contributor

Is it fixed in MeshLoadBalancingStrategy already?

Copy link
Contributor

@slonka slonka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can't detect 0 vs no value like in new policies let's do this.

pkg/xds/envoy/clusters/v3/lb_configurer.go Show resolved Hide resolved
@lukidzi
Copy link
Contributor Author

lukidzi commented Oct 3, 2023

Is it fixed in MeshLoadBalancingStrategy already?

Yes, kubevalidator validates if the value is bigger than or equal to 2, also when an empty body it treats it as a null so it works.

@lukidzi lukidzi merged commit 72faeed into kumahq:master Oct 3, 2023
@lahabana lahabana changed the title fix(kuma-cp): use default value when choiceCount is 0 fix(TrafficRoute): use default value when choiceCount is 0 Nov 3, 2023
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.

TrafficRoute doesn't set LB type to LeastRequest when choiceCount is not specified
3 participants