From bc857b4eb698e7667a711fdf54e05c302ccf51a9 Mon Sep 17 00:00:00 2001 From: Andrew Stucki Date: Mon, 15 Aug 2022 15:41:39 -0400 Subject: [PATCH 1/2] Fix intention syncing CAS index --- internal/commands/server/k8s_e2e_test.go | 7 ++----- internal/consul/intentions.go | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/internal/commands/server/k8s_e2e_test.go b/internal/commands/server/k8s_e2e_test.go index 511e596ba..e677b5c96 100644 --- a/internal/commands/server/k8s_e2e_test.go +++ b/internal/commands/server/k8s_e2e_test.go @@ -2000,12 +2000,9 @@ func TestRouteParentRefChange(t *testing.T) { Body: serviceOne.Name, }, nil, "service one not routable from first gateway in allotted time") - // TODO: Routing from multiple gateways is not yet supported. - // When implemented, this check should be updated to wait for - // http.StatusOK and serviceOne.Name as the body content prefix. checkRoute(t, secondGatewayCheckPort, "/", httpResponse{ - StatusCode: http.StatusServiceUnavailable, - Body: "no healthy upstream", + StatusCode: http.StatusOK, + Body: serviceOne.Name, }, nil, "service one not returning expected error from second gateway in allotted time") // Update httpRoute from remote, then remove first gateway ParentRef diff --git a/internal/consul/intentions.go b/internal/consul/intentions.go index bd8d2f475..0dd1049d5 100644 --- a/internal/consul/intentions.go +++ b/internal/consul/intentions.go @@ -331,10 +331,10 @@ func (r *IntentionsReconciler) updateIntentionSources(name api.CompoundServiceNa } func (r *IntentionsReconciler) getOrInitIntention(name api.CompoundServiceName) (intention *api.ServiceIntentionsConfigEntry, idx uint64, err error) { - entry, meta, err := r.consulConfig.Get(api.ServiceIntentions, name.Name, &api.QueryOptions{Namespace: name.Namespace}) + entry, _, err := r.consulConfig.Get(api.ServiceIntentions, name.Name, &api.QueryOptions{Namespace: name.Namespace}) if err == nil { intention = entry.(*api.ServiceIntentionsConfigEntry) - return intention, meta.LastIndex, nil + return intention, entry.GetModifyIndex(), nil } if strings.Contains(err.Error(), "Unexpected response code: 404") { From 1aa9407417981bb0a57aa27c2c3816a6b2c86312 Mon Sep 17 00:00:00 2001 From: Andrew Stucki Date: Mon, 15 Aug 2022 15:47:36 -0400 Subject: [PATCH 2/2] Add changelog --- .changelog/308.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/308.txt diff --git a/.changelog/308.txt b/.changelog/308.txt new file mode 100644 index 000000000..c2c903779 --- /dev/null +++ b/.changelog/308.txt @@ -0,0 +1,3 @@ +```release-note:bug +Fix intentions syncing for multiple gateways bound to a single route. +``` \ No newline at end of file