Backport of Use correct enterprise meta on wildcard service update into release/1.15.x (#20726)

* backport of commit 94a0aa2ea7

* backport of commit f0e1badd6f

* backport of commit 183dd2fb12

---------

Co-authored-by: Sarah Alsmiller <sarah.alsmiller@hashicorp.com>
pull/20739/head
hc-github-team-consul-core 2024-02-26 13:36:38 -05:00 committed by GitHub
parent b251def757
commit 5c0fcf75e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

3
.changelog/_20721.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ingress-gateway: **(Enterprise Only)** Fix a bug where on update, Ingress Gateways lost all upstreams for listeners with wildcard services in a different namespace.
```

View File

@ -3399,7 +3399,7 @@ func updateGatewayServices(tx WriteTxn, idx uint64, conf structs.ConfigEntry, en
for _, svc := range gatewayServices { for _, svc := range gatewayServices {
// If the service is a wildcard we need to target all services within the namespace // If the service is a wildcard we need to target all services within the namespace
if svc.Service.Name == structs.WildcardSpecifier { if svc.Service.Name == structs.WildcardSpecifier {
if err := updateGatewayNamespace(tx, idx, svc, entMeta); err != nil { if err := updateGatewayNamespace(tx, idx, svc, &svc.Service.EnterpriseMeta); err != nil {
return fmt.Errorf("failed to associate gateway %q with wildcard: %v", gateway.String(), err) return fmt.Errorf("failed to associate gateway %q with wildcard: %v", gateway.String(), err)
} }
// Skip service-specific update below if there was a wildcard update // Skip service-specific update below if there was a wildcard update