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

support for zero weighted services in a route #10428

Merged
merged 1 commit into from
Aug 17, 2016

Conversation

rajatchopra
Copy link
Contributor

Issue #10279
Both 'to' and 'alternateBackends' can now point to a service with '0' as the weight. Any service with '0' weight will not have its servers listed as backends to the haproxy router. This means that one can disable a route completely by having all its services with a weight '0'. The config may still catch the request but with none of the backends existing it will result in a 503.

[test]

@rajatchopra
Copy link
Contributor Author

[test] again

@knobunc
Copy link
Contributor

knobunc commented Aug 16, 2016

LGTM [test]

@@ -46,7 +46,7 @@ func ValidateRoute(route *routeapi.Route) field.ErrorList {
if route.Spec.To.Kind != "Service" {
result = append(result, field.Invalid(specPath.Child("to", "kind"), route.Spec.To.Kind, "must reference a Service"))
}
if route.Spec.To.Weight != nil && (*route.Spec.To.Weight < 1 || *route.Spec.To.Weight > 256) {
if route.Spec.To.Weight != nil && (*route.Spec.To.Weight < 0 || *route.Spec.To.Weight > 256) {
result = append(result, field.Invalid(specPath.Child("to", "weight"), route.Spec.To.Weight, "weight must be an integer between 1 and 256"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit: error message still says 1-256.

@ramr
Copy link
Contributor

ramr commented Aug 16, 2016

@rajatchopra tests possibly are failing due to the check - use {{ if ne $weight 0 }}.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 16, 2016
@rajatchopra rajatchopra force-pushed the zeroweights branch 3 times, most recently from b02d089 to 72af619 Compare August 16, 2016 23:10
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 17, 2016
@rajatchopra
Copy link
Contributor Author

[test] again

@knobunc
Copy link
Contributor

knobunc commented Aug 17, 2016

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to e7cd87e

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8040/)

@ramr
Copy link
Contributor

ramr commented Aug 17, 2016

LGTM

@knobunc
Copy link
Contributor

knobunc commented Aug 17, 2016

[merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Aug 17, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8040/) (Image: devenv-rhel7_4857)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to e7cd87e

@smarterclayton
Copy link
Contributor

API change approved

@openshift-bot openshift-bot merged commit 8b63ae7 into openshift:master Aug 17, 2016
@rajatchopra rajatchopra deleted the zeroweights branch August 17, 2016 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants