Commit Graph

5329 Commits (4e1e51904b550e607c0226006ccf17b6118edf57)

Author SHA1 Message Date
hc-github-team-consul-core 4e1e51904b
Backport of NET-6943 - Replace usage of deprecated Envoy field envoy.config.router.v3.WeightedCluster.total_weight. into release/1.17.x (#20061)
* no-op commit due to failed cherry-picking

* NET-6943 - Replace usage of deprecated Envoy field envoy.config.router.v3.WeightedCluster.total_weight. (#20011)

---------

Co-authored-by: temp <temp@hashicorp.com>
Co-authored-by: John Murret <john.murret@hashicorp.com>
2024-01-02 17:31:51 +00:00
John Murret 59da5e792f
Backport into 1.17 of NET-6944 - Replace usage of deprecated Envoy field envoy.extensions.filters.http.lua.v3.Lua.inline_code (#20054)
NET-6944 - Replace usage of deprecated Envoy field envoy.extensions.filters.http.lua.v3.Lua.inline_code (#20012)
2023-12-22 18:00:58 +00:00
hc-github-team-consul-core 03c94a7cf0
Backport of agent: prevent empty server_metadata.json into release/1.17.x (#19997)
backport of commit 9fc0fc3dcc

Co-authored-by: cskh <hui.kang@hashicorp.com>
2023-12-21 10:05:17 -05:00
hc-github-team-consul-core ad4851c973
Backport of Fix bug with prepared queries using sameness-groups. into release/1.17.x (#19972)
backport of commit 21bde38517

Co-authored-by: Derek Menteer <derek.menteer@hashicorp.com>
2023-12-15 13:17:08 -06:00
hc-github-team-consul-core c4caa3147d
Backport of Hash based config entry replication into release/1.17.x (#19916)
add hash based config entry replication

Co-authored-by: Dhia Ayachi <dhia@hashicorp.com>
2023-12-12 13:36:07 -05:00
hc-github-team-consul-core 6c6d978634
Backport of Remove warning for consul 1.17 deprecation into release/1.17.x (#19905)
backport of commit 8d43647ed9

Co-authored-by: Ronald Ekambi <ronekambi@gmail.com>
2023-12-12 10:05:45 -05:00
Derek Menteer 212485578c
Backport of: Fix ClusterLoadAssignment timeouts dropping endpoints. into 1.17 (#19884)
Fix ClusterLoadAssignment timeouts dropping endpoints.

When a large number of upstreams are configured on a single envoy
proxy, there was a chance that it would timeout when waiting for
ClusterLoadAssignments. While this doesn't always immediately cause
issues, consul-dataplane instances appear to consistently drop
endpoints from their configurations after an xDS connection is
re-established (the server dies, random disconnect, etc).

This commit adds an `xds_fetch_timeout_ms` config to service registrations
so that users can set the value higher for large instances that have
many upstreams. The timeout can be disabled by setting a value of `0`.

This configuration was introduced to reduce the risk of causing a
breaking change for users if there is ever a scenario where endpoints
would never be received. Rather than just always blocking indefinitely
or for a significantly longer period of time, this config will affect
only the service instance associated with it.
2023-12-11 10:02:33 -06:00
hc-github-team-consul-core f80fc2b548
Backport of Fix xDS missing endpoint race condition. into release/1.17.x (#19874)
backport of commit 7d8764dc0e

Co-authored-by: Keith Smiley <ksmiley@salesforce.com>
Co-authored-by: Derek Menteer <derek.menteer@hashicorp.com>
2023-12-08 11:59:21 -06:00
Andrew Stucki 880713a10b
[Backport 1.17.x] Add CE version of Gateway Upstream Disambiguation (#19868)
* Add CE version of Gateway Upstream Disambiguation

* Add range variable shadow

---------

Co-authored-by: Thomas Eckert <teckert@hashicorp.com>
2023-12-08 17:00:14 +00:00
hc-github-team-consul-core a34009b7c1
Backport of parse config protocol on write to optimize disco-chain compilation into release/1.17.x (#19859)
* parse config protocol on write to optimize disco-chain compilation (#19829)

* parse config protocol on write to optimize disco-chain compilation

* add changelog

* add test fixes from PR

* adding missing config field

---------

Co-authored-by: Dhia Ayachi <dhia@hashicorp.com>
2023-12-07 15:35:26 -05:00
hc-github-team-consul-core 1a5ace03f0
Backport of improve client RPC metrics consistency into release/1.17.x (#19843)
* backport of commit 06507fe053

* backport of commit 14e160573d

* backport of commit 088ec70f90

---------

Co-authored-by: Jared Kirschner <85913323+jkirschner-hashicorp@users.noreply.github.com>
2023-12-06 14:06:17 -05:00
hc-github-team-consul-core b1acee8f94
Backport of [NET-6251] Nomad client templated policy into release/1.17.x (#19839)
backport of commit 9a8d0c848b

Co-authored-by: Ronald Ekambi <ronekambi@gmail.com>
2023-12-06 11:18:33 -05:00
lornasong 81a22ae9b6
Manual Backport of [Cloud][CC-6925] Updates to pushing server state into release/1.17.x (#19810)
* [Cloud][CC-6925] Updates to pushing server state (#19682)

* Upgrade hcp-sdk-go to latest version v0.73

Changes:
- go get github.com/hashicorp/hcp-sdk-go
- go mod tidy

* From upgrade: regenerate protobufs for upgrade from 1.30 to 1.31

Ran: `make proto`

Slack: https://hashicorp.slack.com/archives/C0253EQ5B40/p1701105418579429

* From upgrade: fix mock interface implementation

After upgrading, there is the following compile error:

cannot use &mockHCPCfg{} (value of type *mockHCPCfg) as "github.com/hashicorp/hcp-sdk-go/config".HCPConfig value in return statement: *mockHCPCfg does not implement "github.com/hashicorp/hcp-sdk-go/config".HCPConfig (missing method Logout)

Solution: update the mock to have the missing Logout method

* From upgrade: Lint: remove usage of deprecated req.ServerState.TLS

Due to upgrade, linting is erroring due to usage of a newly deprecated field

22:47:56 [consul]: make lint
--> Running golangci-lint (.)
agent/hcp/testing.go:157:24: SA1019: req.ServerState.TLS is deprecated: use server_tls.internal_rpc instead. (staticcheck)
                time.Until(time.Time(req.ServerState.TLS.CertExpiry)).Hours()/24,
                                     ^

* From upgrade: adjust oidc error message

From the upgrade, this test started failing:

=== FAIL: internal/go-sso/oidcauth TestOIDC_ClaimsFromAuthCode/failed_code_exchange (re-run 2) (0.01s)
    oidc_test.go:393: unexpected error: Provider login failed: Error exchanging oidc code: oauth2: "invalid_grant" "unexpected auth code"

Prior to the upgrade, the error returned was:
```
Provider login failed: Error exchanging oidc code: oauth2: cannot fetch token: 401 Unauthorized\nResponse: {\"error\":\"invalid_grant\",\"error_description\":\"unexpected auth code\"}\n
```

Now the error returned is as below and does not contain "cannot fetch token"
```
Provider login failed: Error exchanging oidc code: oauth2: "invalid_grant" "unexpected auth code"

```

* Update AgentPushServerState structs with new fields

HCP-side changes for the new fields are in:
https://github.com/hashicorp/cloud-global-network-manager-service/pull/1195/files

* Minor refactor for hcpServerStatus to abstract tlsInfo into struct

This will make it easier to set the same tls-info information to both
 - status.TLS (deprecated field)
 - status.ServerTLSMetadata (new field to use instead)

* Update hcpServerStatus to parse out information for new fields

Changes:
 - Improve error message and handling (encountered some issues and was confused)
 - Set new field TLSInfo.CertIssuer
 - Collect certificate authority metadata and set on TLSInfo.CertificateAuthorities
 - Set TLSInfo on both server.TLS and server.ServerTLSMetadata.InternalRPC

* Update serverStatusToHCP to convert new fields to GNM rpc

* Add changelog

* Feedback: connect.ParseCert, caCerts

* Feedback: refactor and unit test server status

* Feedback: test to use expected struct

* Feedback: certificate with intermediate

* Feedback: catch no leaf, remove expectedErr

* Feedback: update todos with jira ticket

* Feedback: mock tlsConfigurator

* make proto for additional file in 1.17 not in main
2023-12-04 15:34:24 -05:00
John Maguire 71e2a0c986
[NET-5688] APIGateway UI Topology Fixes (#19657) (#19765)
* [NET-5688] APIGateway UI Topology Fixes (#19657)

* Update catalog and ui endpoints to show APIGateway in gateway service
topology view

* Added initial implementation for service view

* updated ui

* Fix topology view for gateways

* Adding tests for gw controller

* remove unused args

* Undo formatting changes

* Fix call sites for upstream/downstream gw changes

* Add config entry tests

* Fix function calls again

* Move from ServiceKey to ServiceName, cleanup from PR review

* Add additional check for length of services in bound apigateway for
IsSame comparison

* fix formatting for proto

* gofmt

* Add DeepCopy for retrieved BoundAPIGateway

* gofmt

* gofmt

* Rename function to be more consistent

* updated ui assets
2023-11-29 11:23:52 -05:00
hc-github-team-consul-core 6ff06bd08d
Backport of [NET-6249] Add templated policies description into release/1.17.x (#19736)
backport of commit 5cf44bea20

Co-authored-by: Ronald Ekambi <ronekambi@gmail.com>
2023-11-27 16:43:14 -05:00
hc-github-team-consul-core d974bf4028
Backport of NET-6251 API gateway templated policy into release/1.17.x (#19729)
backport of commit c4408eaae1

Co-authored-by: Ronald Ekambi <ronekambi@gmail.com>
2023-11-24 13:40:58 -05:00
hc-github-team-consul-core 92d7d692a6
Backport of [NET-6103] Enable query tokens by service name using templated policy into release/1.17.x (#19668)
backport of commit 9f2b068696

Co-authored-by: Ronald Ekambi <ronekambi@gmail.com>
2023-11-16 19:49:39 +00:00
hc-github-team-consul-core c4ca97f65b
Backport of Fix more test flakes into release/1.17.x (#19546)
* backport of commit 5cb614ed73

* backport of commit 13c10a19b1

---------

Co-authored-by: Derek Menteer <derek.menteer@hashicorp.com>
2023-11-07 16:38:37 +00:00
hc-github-team-consul-core 2f0d638fa4
Backport of [NET-6459] Fix issue with wanfed lan ip conflicts. into release/1.17.x (#19523)
backport of commit a47995f72d

Co-authored-by: Derek Menteer <derek.menteer@hashicorp.com>
2023-11-06 15:07:14 +00:00
hc-github-team-consul-core 3e0240caba
Backport of [NET-5916] Fix locality-aware routing config and tests (CE) into release/1.17.x (#19491)
backport of commit c0203fbcb5

Co-authored-by: Derek Menteer <derek.menteer@hashicorp.com>
2023-11-03 17:06:57 -05:00
hc-github-team-consul-core 9f85516e7d
Backport of NET-6294 - v1 Agentless proxycfg datasource errors after v2 changes into release/1.17.x (#19416)
backport of commit fa50df4b2d

Co-authored-by: John Murret <john.murret@hashicorp.com>
2023-10-27 21:04:20 +00:00
hc-github-team-consul-core b7055a096e
Backport of Use strict DNS for mesh gateways with hostnames into release/1.17.x (#19396)
* backport of commit e9eabcb3b3

* backport of commit 013de0bce9

---------

Co-authored-by: Andrew Stucki <andrew.stucki@hashicorp.com>
2023-10-26 20:28:45 +00:00
hc-github-team-consul-core 54ee2b633e
Backport of Add clarification for route match behavior into release/1.17.x (#19368)
* backport of commit dba8d6721e

* backport of commit 436cc19464

---------

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
2023-10-25 20:19:32 +00:00
hc-github-team-consul-core e6c6814c13
Backport of [NET-6305] xds: Ensure v2 route match and protocol are populated for gRPC into release/1.17.x (#19366)
* backport of commit 0a8fe0d94f

* backport of commit 74bf2aa8b0

---------

Co-authored-by: Michael Zalimeni <michael.zalimeni@hashicorp.com>
2023-10-25 19:12:18 +00:00
hc-github-team-consul-core 7d60b6ccb9
Backport of NET-6081 - xds controller golden file inputs into xds resources - sources into release/1.17.x (#19354)
no-op commit due to failed cherry-picking

Co-authored-by: temp <temp@hashicorp.com>
2023-10-24 20:32:14 +00:00
hc-github-team-consul-core 1c98afd997
Backport of NET-6080 - xds controller golden file inputs into xds resources - destinations into release/1.17.x (#19352)
* backport of commit f142c77956

* backport of commit 79eadd1afd

* backport of commit d269c63a99

* backport of commit 532aad4dbf

* backport of commit 2de83d470f

* backport of commit c8af477a30

* NET-6080 - xds controller golden file inputs into xds resources - destinations (#19244)

* NET-5397 - wire up golden tests from sidecar-proxy controller for xds controller and xdsv2

* WIP

* WIP

* everything matching except leafCerts.  need to mock those

* single port destinations working except mixed destinations

* golden test input to xds controller tests for destinations

* proposed fix for failover group naming errors

* clean up test to use helper.

* clean up test to use helper.

* fix test file

* add docstring for test function.

* add docstring for test function.

* fix linting error

* fixing test after route fix merged into main

* first source test works

* WIP

* modify all source files

* source tests pass

* fixing tests after bug fix in main

* got first destination working.

* adding destinations

* fix docstring for test

* fixing tests after bug fix in main

---------

Co-authored-by: John Murret <john.murret@hashicorp.com>
2023-10-24 19:11:28 +00:00
Derek Menteer 8b35e087c5
Backport of Add grpc keepalive configuration (#19339) to 1.17.x (#19345)
Add grpc keepalive configuration. (#19339)

Prior to the introduction of this configuration, grpc keepalive messages were
sent after 2 hours of inactivity on the stream. This posed issues in various
scenarios where the server-side xds connection balancing was unaware that envoy
instances were uncleanly killed / force-closed, since the connections would
only be cleaned up after ~5 minutes of TCP timeouts occurred. Setting this
config to a 30 second interval with a 20 second timeout ensures that at most,
it should take up to 50 seconds for a dead xds connection to be closed.
2023-10-24 08:51:49 -05:00
hc-github-team-consul-core c613594416
Backport of Vault CA bugfixes into release/1.17.x (#19309)
* backport of commit 8a6a858584

* backport of commit 1922b5f539

* backport of commit a4dff42744

* backport of commit cb7e5ded36

* backport of commit fcc9ee6542

* backport of commit 61d1c264d8

---------

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
2023-10-20 17:05:05 +00:00
hc-github-team-consul-core fa564e95fe
Backport of [NET-6221] Ensure LB policy set for locality-aware routing (CE) into release/1.17.x (#19289)
backport of commit a2de5916df

Co-authored-by: Michael Zalimeni <michael.zalimeni@hashicorp.com>
2023-10-19 14:31:20 +00:00
hc-github-team-consul-core 1c91abd23d
Backport of [NET-5810] CE changes for multiple virtual hosts into release/1.17.x (#19247)
backport of commit c5018c1da7

Co-authored-by: jm96441n <john.maguire@hashicorp.com>
2023-10-17 15:33:12 +00:00
hc-github-team-consul-core 689f32c59d
Backport of catalog, mesh: implement missing ACL hooks into release/1.17.x (#19212)
catalog, mesh: implement missing ACL hooks (#19143)

This change adds ACL hooks to the remaining catalog and mesh resources, excluding any computed ones. Those will for now continue using the default operator:x permissions.

It refactors a lot of the common testing functions so that they can be re-used between resources.

There are also some types that we don't yet support (e.g. virtual IPs) that this change adds ACL hooks to for future-proofing.

Co-authored-by: Iryna Shustava <ishustava@users.noreply.github.com>
2023-10-14 01:50:22 +00:00
hc-github-team-consul-core 813d666a6e
Backport of server: run the api checks against the path without params into release/1.17.x (#19206)
backport of commit 3894d93d61

Co-authored-by: R.B. Boyer <rb@hashicorp.com>
2023-10-13 20:47:51 +00:00
Dhia Ayachi 5fbf0c00d3
Add namespace read write tests (#19173) 2023-10-13 12:03:06 -04:00
Thomas Eckert 76c60fdfac
Golden File Tests for TermGW w/ Cluster Peering (#19096)
Add intention to create golden file for terminating gateway peered trust bundle
2023-10-13 11:56:58 -04:00
Nitya Dhanushkodi 95d9b2c7e4
[NET-4931] xdsv2, sidecarproxycontroller, l4 trafficpermissions: support L7 (#19185)
* xdsv2: support l7 by adding xfcc policy/headers, tweaking routes, and make a bunch of listeners l7 tests pass

* sidecarproxycontroller: add l7 local app support 

* trafficpermissions: make l4 traffic permissions work on l7 workloads

* rename route name field for consistency with l4 cluster name field

* resolve conflicts and rebase

* fix: ensure route name is used in l7 destination route name as well. previously it was only in the route names themselves, now the route name and l7 destination route name line up
2023-10-12 23:45:45 +00:00
Iryna Shustava 25283f0ec2
get-envoy-bootstrap-params: when v2 is enabled, use computed proxy configuration (#19175) 2023-10-12 14:01:36 -06:00
Chris S. Kim 197bcd4164
Refactor connect_auth.go into agent_endpoint.go (#19166) 2023-10-12 12:54:32 -04:00
John Maguire 7a323c492b
[NET-5457] Golden Files for Multiple Virtual Hosts (#19131)
* Add new golden file tests

* Update with latest deterministic code
2023-10-11 18:11:29 +00:00
John Murret 6cbd417f29
NET-5822 - Add default outbound router in TProxy (#19087)
* NET-5822 - Add default outbound router in TProxy

* fixing connection timeout to be 5 s instead of 10 seconds
2023-10-11 10:31:45 -06:00
R.B. Boyer b9ab63c55d
server: when the v2 catalog experiment is enabled reject api and rpc requests that are for the v1 catalog (#19129)
When the v2 catalog experiment is enabled the old v1 catalog apis will be
forcibly disabled at both the API (json) layer and the RPC (msgpack) layer.
This will also disable anti-entropy as it uses the v1 api.

This includes all of /v1/catalog/*, /v1/health/*, most of /v1/agent/*,
/v1/config/*, and most of /v1/internal/*.
2023-10-11 10:44:03 -05:00
John Maguire 8bebfc147d
[NET-5457] Fix CE code for jwt multiple virtual hosts bug (#19123)
* Fix CE code for jwt multiple virtual hosts bug

* Fix struct definition

* fix bug with always appending route to jwt config

* Update comment to be correct

* Update comment
2023-10-10 16:25:36 -04:00
Semir Patel 830c4ea81c
v2tenancy: cluster scoped reads (#19082) 2023-10-10 13:30:23 -05:00
Dhia Ayachi 226590541c
Activate verifier when running WAL with experimental features (#19102)
* activate verifier when running WAL with experimental features

* only change verifier parameters if it's disabled (default value)
2023-10-10 14:14:20 -04:00
Chris S. Kim 92ce814693
Remove old build tags (#19128) 2023-10-10 10:58:06 -04:00
Chris Thain dcdf2fc6ba
Update Vault CA provider namespace configuration (#19095) 2023-10-10 13:53:00 +00:00
Ashesh Vidyut a30ccdf5dc
NET-4135 - Fix NodeMeta filtering Catalog List Services API (#18322)
* logs for debugging

* Init

* white spaces fix

* added change log

* Fix tests

* fix typo

* using queryoptionfilter to populate args.filter

* tests

* fix test

* fix tests

* fix tests

* fix tests

* fix tests

* fix variable name

* fix tests

* fix tests

* fix tests

* Update .changelog/18322.txt

Co-authored-by: Ganesh S <ganesh.seetharaman@hashicorp.com>

* fix change log

* address nits

* removed unused line

* doing join only when filter has nodemeta

* fix tests

* fix tests

* Update agent/consul/catalog_endpoint.go

Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>

* fix tests

* removed unwanted code

---------

Co-authored-by: Ganesh S <ganesh.seetharaman@hashicorp.com>
Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>
2023-10-08 12:48:31 +00:00
Derek Menteer af3439b53d
Ensure that upstream configuration is properly normalized. (#19076)
This PR fixes an issue where upstreams did not correctly inherit the proper
namespace / partition from the parent service when attempting to fetch the
upstream protocol due to inconsistent normalization.

Some of the merge-service-configuration logic would normalize to default, while
some of the proxycfg logic would normalize to match the parent service. Due to
this mismatch in logic, an incorrect service-defaults configuration entry would
be fetched and have its protocol applied to the upstream.
2023-10-06 13:59:47 -05:00
Dhia Ayachi ed882e2522
Make raft-wal default when `resource-apis` is active (#19090)
Make raft-wal default when v2 catalog experiment is on
2023-10-06 10:24:21 -04:00
Thomas Eckert 342306c312
Allow connections through Terminating Gateways from peered clusters NET-3463 (#18959)
* Add InboundPeerTrustBundle maps to Terminating Gateway

* Add notify and cancelation of watch for inbound peer trust bundles

* Pass peer trust bundles to the RBAC creation function

* Regenerate Golden Files

* add changelog, also adds another spot that needed peeredTrustBundles

* Add basic test for terminating gateway with peer trust bundle

* Add intention to cluster peered golden test

* rerun codegen

* update changelog

* really update the changelog

---------

Co-authored-by: Melisa Griffin <melisa.griffin@hashicorp.com>
2023-10-05 21:54:23 +00:00
Chris S. Kim aa526db225
Retry flaky tests (#19088) 2023-10-05 21:27:28 +00:00