From 33107d212f9d26e2779d2daffdcb0562cf035fe2 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Tue, 13 Nov 2018 15:53:43 +0000 Subject: [PATCH] Fix lb-method validation Bug introduced in: https://github.com/nginxinc/kubernetes-ingress/commit/547055cefac864b156c0e7d6c752b5a45c5fcccb * "least_time" and "last_byte" are no longer valid input * Add the above as invalid input to unit test --- internal/nginx/extensions.go | 12 +++++------- internal/nginx/extensions_test.go | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/nginx/extensions.go b/internal/nginx/extensions.go index b23205cc52..2af42286dc 100644 --- a/internal/nginx/extensions.go +++ b/internal/nginx/extensions.go @@ -25,16 +25,14 @@ func ParseLBMethod(method string) (string, error) { } var nginxLBValidInput = map[string]bool{ - "least_conn": true, - "ip_hash": true, - "random": true, - "random two": true, - "random two least_conn": true, + "least_conn": true, + "ip_hash": true, + "random": true, + "random two": true, + "random two least_conn": true, } var nginxPlusLBValidInput = map[string]bool{ - "least_time": true, - "last_byte": true, "least_conn": true, "ip_hash": true, "random": true, diff --git a/internal/nginx/extensions_test.go b/internal/nginx/extensions_test.go index ef645c0242..e06817b1d1 100644 --- a/internal/nginx/extensions_test.go +++ b/internal/nginx/extensions_test.go @@ -72,6 +72,8 @@ func TestParseLBMethodForPlus(t *testing.T) { "", "blabla", "hash123", + "least_time", + "last_byte", "least_time inflight header", "random one", "random two ip_hash",