Commit Graph

462 Commits

Author SHA1 Message Date
Alejandro Pedraza 71291fe7bc
Add `accessPolicy` field to Server CRD (#12845)
Followup to #12844

This new field defines the default policy for Servers, i.e. if a request doesn't match the policy associated to a Server then this policy applies. The values are the same as for `proxy.defaultInboundPolicy` and the `config.linkerd.io/default-inbound-policy` annotation (all-unauthenticated, all-authenticated, cluster-authenticated, cluster-unauthenticated, deny), plus a new value "audit". The default is "deny", thus remaining backwards-compatible.

This field is also exposed as an additional printer column.
2024-07-22 09:01:09 -05:00
Matei David f05d1e9e26
feat(helm): default proxy-init resource requests to proxy values (#12741)
Default values for `linkerd-init` (resources allocated) are not always
the right fit. We offer default values to ensure proxy-init does not get
in the way of QOS Guaranteed (`linkerd-init` resource limits and
requests cannot be configured in any other way).

Instead of using default values that can be overridden, we can re-use
the proxy's configuration values. For the pod to be QOS Guaranteed, the
values for the proxy have to be set any way. If we re-use the same
values for proxy-init we can ensure we'll always request the same amount
of CPU and memory as needed.

* `linkerd-init` now defaults to the proxy's values
* when the proxy has an annotation configuration for resource requests,
  it also impacts `linkerd-init`
* Helm chart and docs have been updated to reflect the missing values.
* tests now no longer use `ProxyInit.Resources`

UPGRADE NOTE:
- Deprecates `proxyInit.resources` field in the Helm values.
  - It will be a no-op if specified (no hard failures)

Closes #11320

---------

Signed-off-by: Matei David <matei@buoyant.io>
2024-06-24 12:37:47 +01:00
Alex Leong 26eba44ac3
feat(cli): Add json output to link, unlink, allow, and allow-scrapes commands (#12658)
We add an -o/--output flag to the remaining commands which render kubernetes resources and do not yet have this flag. The supported values for this flag are "yaml" (default) and "json". The commands are:

linkerd mulitcluster allow
linkerd multicluster link
linkerd multicluster unlink
linkerd viz allow-scrapes

Signed-off-by: Alex Leong <alex@buoyant.io>
2024-06-14 09:01:29 -07:00
Alejandro Pedraza b21686a9be
IPv6/dual-stack integration tests (#12575)
* IPv6 integration tests

This adds a new test `TestDualStack` to the deep suite that ensures requests to a dual stack service are always routed the the IPv6 endpoint.

It also amends other tests in the suite for them to work in IPv6-only clusters:

- skipports: replaced the booksapp with emojivoto, given the servers in the former don't bind to IPv6 addresses
- endpoints: amended the regexes to include IPv6 addresses
- localhost: bumped nginx for it to bind to the IPv6 loopback as well

Note the `TestDualStack` test is disabled by default because Github runners don't support IPv6. To run it locally, first deploy a dual-stack cluster via:

```
kind create cluster --config test/integration/deep/kind-dualstack.yml
```
(for testing IPv6-only clusters, use the `kind-ipv6.yml` config)

Then load the images and trigger the test with:

```
bin/tests --name deep-dual-stack --skip-cluster-create $PWD/target/cli/linux-amd64/linkerd
```
2024-05-28 16:00:26 -05:00
Nico Feulner 3d674599b3
make group ID configurable (#11924)
Fixes #11773

Make the proxy's GUID configurable via `proxy.gid` which defaults to `-1`, in which case the GUID is not set.
Also added ability to set the GUID for proxy-init and the core and extension controllers.

---------

Signed-off-by: Nico Feulner <nico.feulner@gmail.com>
Co-authored-by: Alejandro Pedraza <alejandro@buoyant.io>
2024-05-23 15:54:21 -05:00
Alejandro Pedraza 7dbafb26c8
Make IPv6 support opt-in (#12576)
This changes the default of the Helm value `disableIPv6` to `true`.
Additionally, the proxy's `LINKERD2_PROXY_OUTBOUND_LISTEN_ADDRS` env var
is now set accordingly to that value.

This addresses an incompatibility with GKE introduced in last week's
edge (`edge-24.5.1`): in default IPv4-only nodes in GKE clusters the
proxy can't bind to `::1`, so we have make IPv6 opt-in to avoid
surprises.
2024-05-09 09:09:26 -05:00
Alejandro Pedraza 7cbe2f5ca6
Enable forwarding IPv6 connections through the proxy (#12495)
As part of the ongoing effort to support IPv6/dual-stack networks, this change
enables the proxy to properly forward IPv6 connections:

- Adds the new `LINKERD2_PROXY_OUTBOUND_LISTEN_ADDRS` environment variable when
  injecting the proxy. This is supported as of proxy v2.228.0 which was just
  pulled into the linkerd2 repo in #2d5085b56e465ef56ed4a178dfd766a3e16a631d.
  This adds the IPv6 loopback address (`[::1]`) to the IPv4 one (`127.0.0.1`)
  so the proxy can forward outbound connections received via IPv6. The injector
  will still inject `LINKERD2_PROXY_OUTBOUND_LISTEN_ADDR` to support the rare
  case where the `proxy.image.version` value is overridden with an older
  version. The new proxy still considers that variable, but it's superseded by
  the new one. The old variable is considered deprecated and should be removed
  in the future.
- The values for `LINKERD2_PROXY_CONTROL_LISTEN_ADDR`,
  `LINKERD2_PROXY_ADMIN_LISTEN_ADDR` and `LINKERD2_PROXY_INBOUND_LISTEN_ADDR`
  have been updated to point to the IPv6 wildcard address (`[::]`) instead of
  the IPv4 one (`0.0.0.0`) for the same reason. Unlike with the loopback
  address, the IPv6 wildcard address suffices to capture both IPv4 and IPv6
  traffic.
- The endpoint translator's `getInboundPort()` has been updated to properly
  parse the IPv6 loopback address retrieved from the proxy container manifest.
  A unit test was added to validate the behavior.
2024-05-02 16:39:19 +01:00
Alejandro Pedraza 1f9fa44e01
Add native sidecar deep integration test (#12452)
Added the test `deep-native-sidecar` which runs the `deep` test with the
new flag `--native-sidecar`.

Also replaced the final `WaitRollout` call in `install_test.go` with a
`linkerd check` call, to also allow us verifying that command is working
as intended.
2024-04-30 15:30:00 -05:00
Oliver Gould aef8a02426
feat(destination): Add meshed HTTP/2 keep-alive settings (#12504)
This commit adds destination controller configuration that enables default
keep-alives for meshed HTTP/2 clients.

This is accomplished by encoding the raw protobuf message structure into the
helm values, and then encoding that as JSON in the destination controller's
command-line options. This allows operators to set any supported HTTP/2 client
configuration without having to modify the destination controller.
2024-04-30 19:35:30 +00:00
knowmost 27bcdd1028
chore: fix function names in comment (#12512)
Signed-off-by: knowmost <knowmost@outlook.com>
2024-04-29 10:28:10 -07:00
Alejandro Pedraza e6a70713de
Remove `upgrade-stable` integration test, refactor `helm-upgrade` (#12519)
This removes the `upgrade-stable` integration test and refactors the
`helm-upgrade` one to upgrade from the last published edge helm charts
instead of the last stable.
2024-04-29 10:14:10 -05:00
Alejandro Pedraza 7545d131cb
Replace kubectl's `--prune-whitelist` with `--prune-allowlist` (#12496) 2024-04-24 13:17:38 -07:00
Matei David 38c6d11832
Change injector overriding logic to be more generic (#12405)
The proxy-injector package has a `ResourceConfig` type that is
responsible for parsing resources, applying overrides, and serialising a
series of configuration values to a Kubernetes patch. The functionality
is very concrete in its assumption; it always relies on a pod spec and
it mutates inner state when deciding on which overrides to apply.

This is not a flexible way to handle injection and configuration
overriding for other types of resources. We change this by turning
methods previously defined on `ResourceConfig` into free-standing
functions. These functions can be applied for any type of resources in
order to compute a set of configuration values based on annotation
overrides. Through the change, the functions can be used to compute
static configuration for non-Pod types or can be used in tests.


Signed-off-by: Matei David <matei@buoyant.io>
2024-04-10 15:51:58 +01:00
Matei David 7d6695327c
Use proxy-init version from internal package in tests (#11921)
We keep track of our proxy-init and CNI plugin versions in two exported
variables in `pkg/version/version.go`. As part of our release process,
we require these versions to be bumped when the iptables dependencies
are bumped.

In our multicluster test, we provide a proxy-init version that's
hardcoded. Instead of relying on the release coordinator to bump the
image in the test (which can be easily missed), use the already exported
version.

Signed-off-by: Matei David <matei@buoyant.io>
2024-01-22 16:15:12 -05:00
Zahari Dichev 391ce919f5
policy: regenerate Server go bindings (#11920)
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
2024-01-15 11:09:31 +02:00
Oliver Gould 62dd6fbd95
cli: Enhance diagnostics endpoints json output (#11889)
The 'endpoints' diagnostic command omits some interesting endpoint
metadata. This change adds weights and metric labels to JSON output.
2024-01-08 11:17:48 -08:00
Alex Leong a92d17dbe9
Fix error for profile lookups on unmeshed pods with port in default opaque list (#11550)
When we do a `GetProfile` lookup for an unmeshed pod, we set the `weightedAddr.ProtocolHint` to an empty value `&pb.ProtocolHint{}` to indicate that the address is unmeshed and has no protocol hint.  However, when the looked up port is in the default opaque list, we erroneously check if `weightedAddr.ProtocolHint != nil` to determine if we should attempt to get the inbound listen port for that pod.  Since `&pb.ProtocolHint{} != nil`, we attempt to get the inbound listen port for the unmeshed pod.  This results in an error, preventing any valid `GetProfile` responses from being returned.

We update the initialization logic for `weightedAddr.ProtocolHint` to only create a struct when a protocol hint is present and to leave it as `nil` if the pod is unmeshed.

We add a simple unit test for this behavior as well.

Signed-off-by: Alex Leong <alex@buoyant.io>
2023-12-20 13:56:49 -08:00
Alejandro Pedraza 26864c29cd
Reenable cni-calico-deep integration test (#11617)
* Reenable cni-calico-deep integration test

Fixes #11567

The trick is to run the test under k8s `v1.27.6-k3s1` as the following
versions break Calico in k3s (see k3d-io/k3d#1375).

Also removed the `continue-on-error: true` directive in the integration
workflow because it was hiding this problem.
2023-11-20 06:54:50 -05:00
Matei David 21046ab9ff
Skip `multicluster-gateways-endpoints` for links with no gateways (#11447)
The multicluster extension has always allowed the extension to be
installed without a gateway; the idea being that users would provide
their own. With p2p, we extended this to allow links that do not specify
a gateway at all, but in the process we missed changing a key check
-- `multicluster-gateways-endpoints` -- that asserts all links have a
probe service.

Without a gateway on the other end, a link will not have a probe spec
(or a gateway address) so it makes no sense to run this check, there
will never be a probe service created in the source cluster. To fix this
issue, we skip the check when the link misses either a gateway address
or a probe spec.

Fixes #11428

Signed-off-by: Matei David <matei@buoyant.io>
Co-authored-by: Alejandro Pedraza <alejandro@buoyant.io>
2023-10-18 10:38:40 +01:00
Oliver Gould b010b58680
viz: Fix jaeger check test (#11425)
64b66f921 changed the behavior of healthcheck.CheckProxyVersionsUpToDate
so that it errors when there are no channels provided. The viz tracing
test uses this utility to generate the expected error message, and it
did so without providing any channels.

This regression is fixed by instantiating the Channels struct with data.
2023-09-26 15:07:46 -07:00
Alejandro Pedraza ec1c898bd9
Bump proxy-init:v2.2.3 and cni-plugin:v1.2.2 (#11399)
https://github.com/linkerd/linkerd2-proxy-init/releases/tag/proxy-init%2Fv2.2.3
https://github.com/linkerd/linkerd2-proxy-init/releases/tag/cni-plugin%2Fv1.2.2

Updated to use go 1.21
2023-09-21 11:16:37 -05:00
Matei David c0da3b95bc
Bump CNI plugin and proxy-init versions (#11348)
* Bump CNI plugin to v1.2.1
* Bump proxy-init to v2.2.2

Both dependencies include a fix for CVE-2023-2603. Since alpine is used
as the runtime image, there is a security vulnerability detected in the
produced images (due to an issue with libcap). The alpine images have
been bumped to address the CVE.

Signed-off-by: Matei David <matei@buoyant.io>
2023-09-07 16:27:13 +01:00
Alex Leong a0af754089
Add p2p integration test (#11270)
Add an integration test that exercises the direct pod-to-pod multicluster mode.

Signed-off-by: Alex Leong <alex@buoyant.io>
Co-authored-by: Alejandro Pedraza <alejandro@buoyant.io>
2023-08-22 09:59:36 -07:00
Alex Leong 368b63866d
Add support for remote discovery (#11224)
Adds support for remote discovery to the destination controller.

When the destination controller gets a `Get` request for a Service with the `multicluster.linkerd.io/remote-discovery` label, this is an indication that the destination controller should discover the endpoints for this service from a remote cluster.  The destination controller will look for a remote cluster which has been linked to it (using the `linkerd multicluster link` command) with that name.  It will look at the `multicluster.linkerd.io/remote-discovery` label for the service name to look up in that cluster.  It then streams back the endpoint data for that remote service.

Since we now have multiple client-go informers for the same resource types (one for the local cluster and one for each linked remote cluster) we add a `cluster` label onto the prometheus metrics for the informers and EndpointWatchers to ensure that each of these components' metrics are correctly tracked and don't overwrite each other.

---------

Signed-off-by: Alex Leong <alex@buoyant.io>
2023-08-11 09:31:45 -07:00
Arnaud Beun 2ebddd3841
Add log-format value to the multicluster-link helm chart (#10779)
Signed-off-by: Arnaud Beun <arnaud.beun@sorare.com>
Co-authored-by: Arnaud Beun <arnaud.beun@sorare.com>
2023-06-08 05:10:48 -05:00
Matei David 9c9b434946
Add integration tests for loopback routing (#10882)
Traffic may be routed over the loopback interface for a pod when the pod
either tries to communicate with itself using its IP, or when a pod
communicates with itself using its logical address. In the latter case,
a proportion of the traffic may be resolved to the pod's own IP by the
balancer, in which case the traffic is again routed over loopback.

This change adds an integration test to assert that locally routed
traffic does not result in any unexpected errors.

---------

Signed-off-by: Matei David <matei@buoyant.io>
2023-05-18 15:22:15 +01:00
dependabot[bot] e5830ad05b
build(deps): bump linkerd/dev from 39 to 40 (#10825)
* build(deps): bump linkerd/dev from 39 to 40

Bumps [linkerd/dev](https://github.com/linkerd/dev) from 39 to 40.
- [Release notes](https://github.com/linkerd/dev/releases)
- [Commits](https://github.com/linkerd/dev/compare/v39...v40)

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Alex Leong <alex@buoyant.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Leong <alex@buoyant.io>
2023-05-09 10:57:19 -07:00
David McLaughlin 7963acb53e
edge-23.4.2 (#10794)
* edge-23.4.2

This edge release contains a number of bug fixes.

* CLI
  * Fixed `linkerd uninstall` issue for HttpRoute
  * The `linkerd diagnostics policy` command now displays outbound policy when
    the target resource is a Service

* CNI
  * Fixed incompatibility issue with AWS CNI addon in EKS, that was
    forbidding pods to acquire networking after scaling up nodes.
    (thanks @frimik!)
  * Added --set flag to install-cni plugin (thanks @amit-62!)

* Control Plane
  * Fixed an issue where the policy controller always used the default
    `cluster.local` domain
  * Send Opaque protocol hint for opaque ports in destination controller

* Helm
  * Fixed an issue in the viz Helm chart where the namespace metadata template
    would throw `unexpected argument found` errors
  * Fixed Jaeger chart installation failure

* Multicluster
  * Remove namespace field from cluster scoped resources to fix pruning

* Proxy
  * Updated `h2` dependency to include a patch for a theoretical
    denial-of-service vulnerability discovered in CVE-2023-26964
  * Handle Opaque protocol hints on endpoints
  * Changed the proxy's default log level to silence warnings from
    `trust_dns_proto` that are generally spurious.
  * Added `outbound_http_balancer_endpoints` metric
  * Fixed missing route_ metrics for requests with ServiceProfiles

* Viz
  * Bump prometheus image to v2.43.0
  * Add the `kubelet` NetworkAuthentication back since it is used by the
`linkerd viz allow-scrapes` subcommand.

---------

Signed-off-by: David McLaughlin <david@dmclaughlin.com>
Co-authored-by: Alejandro Pedraza <alejandro@buoyant.io>
2023-04-21 13:40:36 -05:00
Dima 46933500b7
Add new integration test for "linkerd multicluster allow" command (#6693) (#10632)
Fixes #6693

Signed-off-by: Dima Pugachev <krabradosty@gmail.com>
2023-04-20 09:34:52 -05:00
Alex Leong 342a096f2a
Enable smoke tests (#10766)
We have a number of tests in the `test/integration/install` directory which exercise basic functionality such as injecting pods and sending traffic.  These test are not currently run at all.

We update a number of tests which were previously just installing Linkerd to also run these basic tests.

Signed-off-by: Matei David <matei@buoyant.io>
Signed-off-by: Alex Leong <alex@buoyant.io>
Co-authored-by: Matei David <matei@buoyant.io>
2023-04-19 13:19:10 -07:00
Alejandro Pedraza 0c202bf17b
Bump linkerd2-proxy-init packages (#10678)
proxy-init v2.2.1:
* Sanitize `subnets-to-ignore` flag
* Dep bumps

cni-plugin v1.1.0:
* Add support for the `config.linkerd.io/skip-subnets` annotation
* Dep bumps

validator v0.1.2:
* Dep bumps

Also, `linkerd-network-validator` is now released wrapped in a tar file, so this PR also amends `Dockerfile-proxy` to account for that.
2023-04-04 18:07:03 -05:00
Matei David 0fcf84939f
Remove viz dependency in multicluster tests (#10609)
Our multicluster integration tests used to depend on viz. Viz was used
to check the state of the gateways (`linkerd multicluster gateways`
required it). Since this is no longer the case, we can remove this
dependency to get back a few seconds of execution times (multicluster
tests are famously slow).

---------

Signed-off-by: Matei David <matei@buoyant.io>
2023-03-30 15:11:32 +01:00
Andrew Seigner e71266f2c9
cli: Support running `check` on CLI-only extensions (#10588)
The existing `linkerd check` command runs extension checks based on extension namespaces already on-cluster. This approach does not permit running extension checks without cluster-side components.

Introduce "CLI Checks". These extensions run as part of `linkerd check`, if they satisfy the following criteria:
1) executable in PATH
2) prefixed by `linkerd-`
3) supports an `_extension-metadata` subcommand, that outputs self-identifying
   JSON, for example:
   ```
   $ linkerd-foo _extension-metadata
   {
     "name": "linkerd-foo",
     "checks": "always"
   }
   ```
4) The `name` value from `_extension-metadata` must match the filename. And `checks` must equal `always`.

If a CLI Check is found that also would have run as an on-cluster extension check, it is run as a CLI Check only.

Fixes #10544
2023-03-29 12:07:36 -07:00
Oliver Gould 69c23bafe5
proxy: v2.192.1 (#10498)
To support Gateway API-style routes in the outbound proxy, we need to begin
discovering this route configuration from the control plane (via the new
`OutboundPolicies` API).

This change updates the proxy as follows:

1. Policy controller configuration is now required for the proxy.
   Previously, the policy API was optionally configured for the inbound
   proxy.
2. The sidecar and ingress proxies are updated to use client policies.
   Service profile configurations continue to be used when they include
   HTTP routes and/or traffic split. Otherwise, a client policy is used
   to route traffic.

Outbound policies are currently discovered for *all* outbound IP addresses. Over
time, the policy controller will assume responsibility to make *all* routing
decisions.  It does not yet serve responses for all cases, however, so some
fallback behavior exists to use endpoint metadata from profile discovery,
if it exists.

The multi-cluster gateway configuration does not yet use policies for
outbound routing. Furthermore, the proxy reports an IP logical address for
policy routes (instead of a named address, as is done with profiles). There
are no new metrics or labels introduced in this PR. Metrics changes will be made
in follow-up changes.

---

* outbound: Decouple backend caching from request distribution (linkerd/linkerd2-proxy#2284)
* build(deps): bump socket2 from 0.4.7 to 0.4.9 (linkerd/linkerd2-proxy#2290)
* README: comment just-cargo and make it more clear (linkerd/linkerd2-proxy#2292)
* build(deps): bump prettyplease from 0.1.23 to 0.1.24 (linkerd/linkerd2-proxy#2293)
* build(deps): bump tokio from 1.25.0 to 1.26.0 (linkerd/linkerd2-proxy#2286)
* build(deps): bump petgraph from 0.6.2 to 0.6.3 (linkerd/linkerd2-proxy#2285)
* client-policy: add protobuf conversion (linkerd/linkerd2-proxy#2289)
* integration: add test policy controller (linkerd/linkerd2-proxy#2288)
* outbound: change `push_discover` to take a `Service` (linkerd/linkerd2-proxy#2291)
* build(deps): bump rustix from 0.36.7 to 0.36.9 (linkerd/linkerd2-proxy#2295)
* build(deps): bump serde_json from 1.0.93 to 1.0.94 (linkerd/linkerd2-proxy#2296)
* build(deps): bump async-trait from 0.1.64 to 0.1.66 (linkerd/linkerd2-proxy#2297)
* build(deps): bump thiserror from 1.0.38 to 1.0.39 (linkerd/linkerd2-proxy#2298)
* build(deps): bump mio from 0.8.5 to 0.8.6 (linkerd/linkerd2-proxy#2299)
* separate policy client config from `inbound::Config` (linkerd/linkerd2-proxy#2307)
* outbound: Require ClientPolicy discovery (linkerd/linkerd2-proxy#2265)
* just: Fix docker tag formatting (linkerd/linkerd2-proxy#2312)
* outbound: Report concrete authorities for policies (linkerd/linkerd2-proxy#2313)

Signed-off-by: Oliver Gould <ver@buoyant.io>
2023-03-13 15:27:33 -07:00
Oliver Gould 59716f31b5
test: Cleanup trafficsplit, improve diagnostics (#10518)
While integrating a new proxy version, we needed to make a few test
changes to improve diagnostics. These changes are probably worthwhile in
general:

1. We have unused test resources in the trafficsplit tests. These can be
   removed.
2. We can simply inline our ServiceProfile configurations in the
   trafficsplit tests. There's not a lot of value in having that
   decoupled from the test.
3. We now enable verbose proxy logs and emit proxy logs when the
   trafficsplit test fails
4. The norelay test is also updated for clarity and to include
   additional proxy logs on failure.
2023-03-13 14:49:22 -07:00
Oliver Gould 16d648da4e
proxy: v2.190.1 (#10342)
This release includes many internal changes to prepare for the new
client policy API. Stack metric label values have changed to reflect the
new shape of the outbound proxy.

This change also includes some test improvements that helped debug an
issue while merging this.

---

* build(deps): bump try-lock from 0.2.3 to 0.2.4 (linkerd/linkerd2-proxy#2139)
* build(deps): bump regex from 1.7.0 to 1.7.1 (linkerd/linkerd2-proxy#2145)
* build(deps): bump tokio from 1.24.0 to 1.24.1 (linkerd/linkerd2-proxy#2144)
* Parameterize the load balancer stack (linkerd/linkerd2-proxy#2142)
* build(deps): bump prost-types from 0.11.5 to 0.11.6 (linkerd/linkerd2-proxy#2147)
* build(deps): bump prost from 0.11.5 to 0.11.6 (linkerd/linkerd2-proxy#2148)
* build(deps): bump prost-build from 0.11.5 to 0.11.6 (linkerd/linkerd2-proxy#2149)
* stack: add `AnnotateError` middleware (linkerd/linkerd2-proxy#2158)
* Fix proxy-core dependencies (linkerd/linkerd2-proxy#2163)
* build(deps): bump tj-actions/changed-files from 35.3.1 to 35.4.1 (linkerd/linkerd2-proxy#2153)
* orig_proto: don't set `connection: close` on errors (linkerd/linkerd2-proxy#2171)
* build(deps): bump bumpalo from 3.11.1 to 3.12.0 (linkerd/linkerd2-proxy#2166)
* build(deps): bump proc-macro2 from 1.0.49 to 1.0.50 (linkerd/linkerd2-proxy#2165)
* build(deps): bump tj-actions/changed-files from 35.4.1 to 35.4.4 (linkerd/linkerd2-proxy#2172)
* build(deps): bump windows_x86_64_msvc from 0.42.0 to 0.42.1 (linkerd/linkerd2-proxy#2164)
* configure buffers from target `Param`s (linkerd/linkerd2-proxy#2173)
* Simplify profile discovery (linkerd/linkerd2-proxy#2170)
* stack: Unify AnnotateError and MapErr (linkerd/linkerd2-proxy#2180)
* build(deps): bump windows_aarch64_msvc from 0.42.0 to 0.42.1 (linkerd/linkerd2-proxy#2176)
* build(deps): bump async-trait from 0.1.61 to 0.1.63 (linkerd/linkerd2-proxy#2177)
* build(deps): bump tokio from 1.24.1 to 1.24.2 (linkerd/linkerd2-proxy#2178)
* Add the `meshtls-boring-fips` feature flag (linkerd/linkerd2-proxy#2168)
* Update HTTP error responder to log version info (linkerd/linkerd2-proxy#2182)
* build(deps): bump which from 4.3.0 to 4.4.0 (linkerd/linkerd2-proxy#2185)
* build(deps): bump derive_arbitrary from 1.2.2 to 1.2.3 (linkerd/linkerd2-proxy#2184)
* build(deps): bump unicode-bidi from 0.3.8 to 0.3.10 (linkerd/linkerd2-proxy#2183)
* build(deps): bump linkerd/dev from 38 to 39 (linkerd/linkerd2-proxy#2175)
* add target metadata to error contexts (linkerd/linkerd2-proxy#2162)
* build(deps): bump rustls from 0.20.7 to 0.20.8 (linkerd/linkerd2-proxy#2187)
* build(deps): bump ahash from 0.8.2 to 0.8.3 (linkerd/linkerd2-proxy#2188)
* build(deps): bump matches from 0.1.9 to 0.1.10 (linkerd/linkerd2-proxy#2189)
* Rename MakeThunk to NewThunk (linkerd/linkerd2-proxy#2197)
* Add `NewQueueWithoutTimeout` (linkerd/linkerd2-proxy#2196)
* Cache discovery results independently of proxy stacks  (linkerd/linkerd2-proxy#2195)
* core: Rename Stack utilities for clarity (linkerd/linkerd2-proxy#2199)
* gateway: Unify discovery for HTTP & opaque stacks (linkerd/linkerd2-proxy#2198)
* build(deps): bump libfuzzer-sys from 0.4.5 to 0.4.6 (linkerd/linkerd2-proxy#2193)
* build(deps): bump arbitrary from 1.2.2 to 1.2.3 (linkerd/linkerd2-proxy#2191)
* http: Remove `Clone` requirement in servers (linkerd/linkerd2-proxy#2200)
* build(deps): bump either from 1.8.0 to 1.8.1 (linkerd/linkerd2-proxy#2192)
* build(deps): bump bytes from 1.3.0 to 1.4.0 (linkerd/linkerd2-proxy#2202)
* build(deps): bump cc from 1.0.78 to 1.0.79 (linkerd/linkerd2-proxy#2203)
* build(deps): bump tj-actions/changed-files from 35.4.4 to 35.5.1 (linkerd/linkerd2-proxy#2211)
* build(deps): bump tokio from 1.24.2 to 1.25.0 (linkerd/linkerd2-proxy#2206)
* build(deps): bump miniz_oxide from 0.6.2 to 0.6.4 (linkerd/linkerd2-proxy#2207)
* build(deps): bump async-trait from 0.1.63 to 0.1.64 (linkerd/linkerd2-proxy#2205)
* Split outbound test modules into files (linkerd/linkerd2-proxy#2213)
* Disable broken tests (linkerd/linkerd2-proxy#2214)
* Add traceparent header parsing for w3c tracecontext (linkerd/linkerd2-proxy#2179)
* Simplify the `Resolve` trait alias (linkerd/linkerd2-proxy#2218)
* downgrade `miniz_oxide` from yanked 0.6.4 to 0.6.2 (linkerd/linkerd2-proxy#2219)
* build(deps): bump heck from 0.4.0 to 0.4.1 (linkerd/linkerd2-proxy#2215)
* ci: Fix check-each workflow (linkerd/linkerd2-proxy#2222)
* Use a cascading stack with protocol detection (linkerd/linkerd2-proxy#2221)
* ci: Fix quotation in list-crates (linkerd/linkerd2-proxy#2225)
* outbound: Split out separate 'opaq' modules (linkerd/linkerd2-proxy#2224)
* Update `linkerd2-proxy-api` to v0.8.0 (linkerd/linkerd2-proxy#2223)
* outbound: Lint stack target types (linkerd/linkerd2-proxy#2226)
* outbound: Split sidecar and ingress stack modules (linkerd/linkerd2-proxy#2227)
* gateway: Split 'http' and 'opaq' modules (linkerd/linkerd2-proxy#2230)
* test: Disable tap::rejects_incorrect_identity_when_identity_is_expected (linkerd/linkerd2-proxy#2231)
* outbound: Improve discovery cache test (linkerd/linkerd2-proxy#2233)
* integration: add destination update builders (linkerd/linkerd2-proxy#2232)
* Rename linkerd-server-policy to linkerd-proxy-server-policy (linkerd/linkerd2-proxy#2235)
* integration: add test for direct HTTP connections (linkerd/linkerd2-proxy#2234)
* outbound: Refactor stack target types (linkerd/linkerd2-proxy#2210)
* Add client-policy types (linkerd/linkerd2-proxy#2236)
2023-02-17 12:51:12 -08:00
Oliver Gould 363e123d79
Update to dev:v39 with Go 1.19 (#10336) 2023-02-16 08:25:42 -08:00
Alex Leong 03727b753b
Add v1beta2 version to HTTPRoute CRD (#9973)
Fixes #9965

Adds a `path` property to the RedirectRequestFilter in all versions.  This property was absent from the CRD even though it appears in the gateway API documentation and is represented in the internal types.  Adding this property to the CRD will also users to specify it.

Add a new version to the HTTPRoute CRD: v1beta2.  This new version includes two changes from v1beta1:

* Added `port` property to `parentRef` for use when the parentRef is a Service
* Added `backendRefs` property to HTTPRoute rules

We switch the storage version of the HTTPRoute CRD from v1alpha1 to v1beta2 so that these new fields may be persisted.

We also update the policy admission controller to allow an HTTPRoute parentRef type to be Service (in addition to Server).

Signed-off-by: Alex Leong <alex@buoyant.io>
2023-01-23 08:56:35 -08:00
Alejandro Pedraza 72589f0e53
Reenable `helm-upgrade` integration test (#10047)
Supersedes #9856, now that the `linkerd check` logic in the integrations tests got cleaned up via #9989.

The helm-upgrade test had been commented-out when we jumped to the new 2.12 helm charts. It can be used again to test upgrades from 2.12.x.

- Some of the logic in `test/integration/install/install_test.go` still hadn't considered the need to upgrade both the `linkerd-crds` and `linkerd-control-plane` charts, so that got fixed.
- Removed references to the now-deprecated `linkerd2` chart.
- Improved the `helm_cleanup()` function by uninstalling the charts in reverse order (extensions first, core last). We delete the namespaces afterwards because helm sometimes doesn't remove them, and so we shouldn't fail if we attempt to delete one that is already gone. Also removed unneeded `kubectl wait`s because `kubect delete ns` should be blocking.
2023-01-10 09:33:11 -05:00
Alex Leong 768e04dd7e
Update endpoints watcher to not fetch pods for removed endpoints (#10013)
Fixes #10003

When endpoints are removed from an EndpointSlice resource, the destination controller builds a list of addresses to remove.  However, if any of the removed endpoints have a Pod as their targetRef, we will attempt to fetch that pod to build the address to remove.  If that pod has already been removed from the informer cache, this will fail and the endpoint will be skipped in the list of endpoints to be removed.  This results in stale endpoints being stuck in the address set and never being removed.

We update the endpoint watcher to construct only a list of endpoint IDs for endpoints to remove, rather than fetching the entire pod object.  Since we no longer attempt to fetch the pod, this operation is now infallible and endpoints will no longer be skipped during removal.

We also add a `TestEndpointSliceScaleDown` test to exercise this.

Signed-off-by: Alex Leong <alex@buoyant.io>
2023-01-03 10:04:02 -08:00
Alejandro Pedraza 6247730141
Refactor `linkerd check` calls in the integration tests (#9989)
* Refactor `linkerd check` calls in the integration tests

Extracted logic into the new file `testutil/test_helper_check.go` which exposes the functions `TestCheckPre`, `TestCheck` and `TestCheckProxy`.

`linkerd check --output json` is called so its output is properly captured without the need of golden files.

Besides checking that there are no errors (although warnings are allowed), we check that the expected check categories are returned.

The plan is to leverage this in #9856 when re-enabling the helm-upgrade test.
2022-12-21 12:14:43 -05:00
ziollek ca685f78ad
Fixes #9616 remove kubectl version check (#9623)
* Fixes #9616 remove kubectl version check

Signed-off-by: tomasz.ziolkowski <e.prace@gmail.com>
2022-10-19 15:27:11 -05:00
Alejandro Pedraza e6fa5a7156
Replace usage of io/ioutil package (#9613)
`io/ioutil` has been deprecated since go 1.16 and the linter started to
complain about it.
2022-10-13 12:10:58 -05:00
Jeremy Chase 32b4ac4f3a
Populate empty proxy-version annotation (#9382)
Addresses: #9311 

* Set injected `proxy-version` annotation to `values.LinkerdVersion` when image version is empty.
* Set `Proxy.Image.Version` consistently between CLI and Helm

Tested when installed via CLI:

```
$ k get po -o yaml -n emojivoto | grep proxy-version
      linkerd.io/proxy-version: dev-0911ad92-jchase
      linkerd.io/proxy-version: dev-0911ad92-jchase
      linkerd.io/proxy-version: dev-0911ad92-jchase
      linkerd.io/proxy-version: dev-0911ad92-jchase
```

Untested when installed via Helm.

Signed-off-by: Jeremy Chase <jeremy.chase@gmail.com>
Co-authored-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2022-10-11 13:05:59 -06:00
Alex Leong dba0a985d8
Add check that clusterip services are in the cluster networks (#9567)
The root cause of https://github.com/linkerd/linkerd2/issues/9521 was that there were clusterip Services which were not in Linkerd's cluster networks.  This means that Linkerd was not performing discovery when connecting to these services and therefore was not doing mTLS.  This issue was difficult to detect and diagnose.

We add a check which verifies that all clusterIP services in the cluster have their clusterIP in the cluster networks.  This is very similar to the existing check which verifies that all pods have a podIP in the cluster networks.

Signed-off-by: Alex Leong <alex@buoyant.io>
2022-10-10 11:38:59 -07:00
Alex Leong 87b64964cf
Fix upgrade stable test (#9247)
The upgrade stable test starts by installing the latest stable release of Linkerd.  Previously, that was stable-2.11.4 which did not require installing the CRDs as a separate step.  Now the latest is stable-2.12.0 which does require installing the CRDs first.  This was causing the install step to fail in this test.

We update the test to first install the CRDs.

Signed-off-by: Alex Leong <alex@buoyant.io>

<!--  Thanks for sending a pull request!

If you already have a well-structured git commit message, chances are GitHub
set the title and description of this PR to the git commit message subject and
body, respectively. If so, you may delete these instructions and submit your PR.

If this is your first time, please read our contributor guide:
https://github.com/linkerd/linkerd2/blob/main/CONTRIBUTING.md

The title and description of your Pull Request should match the git commit
subject and body, respectively. Git commit messages are structured as follows:

```
Subject

Problem

Solution

Validation

Fixes #[GitHub issue ID]

DCO Sign off
```

Example git commit message:

```
Introduce Pull Request Template

GitHub's community guidelines recommend a pull request template, the repo was
lacking one.

Introduce a `PULL_REQUEST_TEMPLATE.md` file.

Once merged, the
[Community profile checklist](https://github.com/linkerd/linkerd2/community)
should indicate the repo now provides a pull request template.

Fixes #3321

Signed-off-by: Jane Smith <jane.smith@example.com>
```

Note the git commit message subject becomes the pull request title.

For more details around git commits, see the section on Committing in our
contributor guide:
https://github.com/linkerd/linkerd2/blob/main/CONTRIBUTING.md#committing
-->

Signed-off-by: Alex Leong <alex@buoyant.io>
2022-08-23 16:29:11 -07:00
Eliza Weisman f6c6ff965c
inject: fix --default-inbound-policy not setting annotation (#9197)
Depends on #9195

Currently, `linkerd inject --default-inbound-policy` does not set the
`config.linkerd.io/default-inbound-policy` annotation on the injected
resource(s).

The `inject` command does _try_ to set that annotation if it's set in
the `Values` generated by `proxyFlagSet`:
14d1dbb3b7/cli/cmd/inject.go (L485-L487)

...but, the flag in the proxy `FlagSet` doesn't set
`Values.Proxy.DefaultInboundPolicy`, it sets
`Values.PolicyController.DefaultAllowPolicy`:
7c5e3aaf40/cli/cmd/options.go (L375-L379)

This is because the flag set is shared across `linkerd inject` and
`linkerd install` subcommands, and in `linkerd install`, we want to set
the default policy for the whole cluster by configuring the policy
controller. In `linkerd inject`, though, we want to add the annotation
to the injected pods only.

This branch fixes this issue by changing the flag so that it sets the
`Values.Proxy.DefaultInboundPolicy` instead of the
`Values.PolicyController.DefaultAllowPolicy` value. In `linkerd
install`, we then set `Values.PolicyController.DefaultAllowPolicy` based
on the value of `Values.Proxy.DefaultInboundPolicy`, while in `inject`,
we will now actually add the annotation.

This branch is based on PR #9195, which adds validation to reject
invalid values for `--default-inbound-policy`, rather than on `main`.
This is because the validation code added in that PR had to be moved
around a bit, since it now needs to validate the
`Values.Proxy.DefaultInboundPolicy` value rather than the
`Values.PolicyController.DefaultAllowPolicy` value. I thought using
#9195 as a base branch was better than basing this on `main` and then
having to resolve merge conflicts later. When that PR merges, this can 
be rebased onto `main`.

Fixes #9168
2022-08-18 17:16:27 -07:00
Eliza Weisman fdf1f9c404
viz: check for default-deny in `linkerd viz check --proxy` (#9169)
This branch adds a check to `linkerd viz check --proxy` that checks if
the data plane namespace (or any namespace, if the check is run without
a namespace) has the `config.linkerd.io/default-inbound-policy: deny`
annotation, indicating that the `linkerd-viz` Prometheus instance may
not be authorized to scrape proxies in that namespace.

For example, after installing emojivoto with the default-deny
annotation:

```
linkerd-viz-data-plane
----------------------
√ data plane namespace exists
‼ prometheus is authorized to scrape data plane pods
    prometheus may not be authorized to scrape the following pods:
	* emojivoto/emoji-699d77c79-77w7f
	* emojivoto/voting-55d76f4bcb-6lsml
	* emojivoto/web-6c54d9554d-md2sd
	* emojivoto/vote-bot-b57689ffb-fq8t5
    see https://linkerd.io/2/checks/#l5d-viz-data-plane-prom-authz for hints
```

This check is a warning rather than fatal, because it's possible that
user-created policies may exist that authorize scrapes, which the check
is not currently aware of. We could, potentially, do more exhaustive
checking for whether _any_ policy would authorize scrapes, but that
would require reimplementing a bunch of policy logic inside the `viz`
extension CLI. For now, I settled on making the check a warning, and
having the error message say "prometheus _may_ not be authorized...".
The subsequent check that data plane metrics exist will fail if
Prometheus actually can't scrape anything.

In a subsequent branch, I'll add a `linkerd viz` subcommand for
generating policy resources to allow Prometheus to scrape the proxies in
a namespace; once this is implemented, the check will also check for the
existance of such a policy in that namespace. If the policy does not
exist, the check output will suggest using that command to generate a
policy to allow scrapes.

See #9150

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2022-08-17 14:11:54 -07:00
Dani Baeyens 074f5e6cdf
Allows RSA signed trust anchors on linkerd cli (#7771) (#8868)
* Allows RSA signed trust anchors on linkerd cli (#7771)

Linkerd currently forces using an ECDSA P-256
issuer certificate along with a ECDSA trust
anchor. Still, it's still cryptographically valid
to have an ECDSA P-256 issuer certificate issued
by an RSA signed CA.

CheckCertAlgoRequirements checks if CA cert uses
ECDSA or RSA 2048/4096 signing algorithm.

Fixes #7771

Signed-off-by: Baeyens, Daniel <daniel.baeyens@gmail.com>
Co-authored-by: Alejandro Pedraza <alejandro@buoyant.io>
2022-08-08 08:04:24 -05:00
Krzysztof Dryś 35722363f7
Use prommatch everywhere (#8674)
Introduce `prommatch.Suite` to simplify checking against multiple matchers. Also, added labels for a common scenario of `target_addr`.
2022-06-21 21:48:51 -06:00