From 615485affbdb5fc21b456348b3b1770fdbdf5a10 Mon Sep 17 00:00:00 2001 From: JacieChao Date: Tue, 3 Nov 2020 18:28:57 +0800 Subject: [PATCH] Reload nginx when L4 proxy protocol change Signed-off-by: JacieChao --- internal/ingress/types_equals.go | 3 +++ internal/ingress/types_equals_test.go | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/internal/ingress/types_equals.go b/internal/ingress/types_equals.go index c179426b4..8e19f0881 100644 --- a/internal/ingress/types_equals.go +++ b/internal/ingress/types_equals.go @@ -524,6 +524,9 @@ func (l4b1 *L4Backend) Equal(l4b2 *L4Backend) bool { if l4b1.Protocol != l4b2.Protocol { return false } + if l4b1.ProxyProtocol != l4b2.ProxyProtocol { + return false + } return true } diff --git a/internal/ingress/types_equals_test.go b/internal/ingress/types_equals_test.go index 8a078b6ae..273a4acdd 100644 --- a/internal/ingress/types_equals_test.go +++ b/internal/ingress/types_equals_test.go @@ -94,6 +94,24 @@ func TestL4ServiceElementsMatch(t *testing.T) { {Port: 80, Endpoints: []Endpoint{{Address: "1.1.1.2"}, {Address: "1.1.1.1"}}}}, true, }, + { + []L4Service{ + {Port: 80, Backend: L4Backend{Name: "test", Namespace: "default", Protocol: "TCP", ProxyProtocol: ProxyProtocol{Decode: false, Encode: false}}}, + }, + []L4Service{ + {Port: 80, Backend: L4Backend{Name: "test", Namespace: "default", Protocol: "TCP", ProxyProtocol: ProxyProtocol{Decode: false, Encode: false}}}, + }, + true, + }, + { + []L4Service{ + {Port: 80, Backend: L4Backend{Name: "test", Namespace: "default", Protocol: "TCP", ProxyProtocol: ProxyProtocol{Decode: false, Encode: false}}}, + }, + []L4Service{ + {Port: 80, Backend: L4Backend{Name: "test", Namespace: "default", Protocol: "TCP", ProxyProtocol: ProxyProtocol{Decode: false, Encode: true}}}, + }, + false, + }, } for _, testCase := range testCases {