Commit Graph

365 Commits

Author SHA1 Message Date
Alex Leong f04edae759
policy: Add HTTPRoute indexing (#8795)
linkerd2-proxy-api v0.6.0 adds support for inbound proxies to discover
route configurations based on the Gateway API HTTPRoute types. This
change updates the policy controller to index
`gateway.networking.k8s.io/v1beta` `HTTPRoute` types to discover these
policies from the Kubernetes API.

`HTTPRoute` resources may target `Server` resources (as a `parentRef`)
to attach policies to an inbound proxy. When no routes are configured,
a default route is synthesized to allow traffic; but when at least one
route attaches to a server, only requests that match a route are
permitted (other requests are failed with a 404).

Only the *core* subset of the `HTTPRoute` filters are supported:
`RequestRedirect` and `RequestHeaderModifier`. Backends may *not* be
configured on these routes (since they may only apply to inbound/server-
side proxies). No `status` updates are currently performed on these
`HTTPRoute` resources.

This change does not yet allow `AuthorizationPolicy` resources to target
`HTTPRoute` resources. This will be added in a follow-up change.

Signed-off-by: Alex Leong <alex@buoyant.io>
Co-authored-by: Oliver Gould <ver@buoyant.io>
2022-07-14 09:04:48 -07:00
Kevin Leimkuhler d6c33e9743
Unset `policyValidator.keyPEM` in `linkerd-config` (#8827)
Closes #8823 

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2022-07-07 20:53:37 -06:00
Alex Leong 120f91ca2c
Add validation for HTTPRoute (#8730)
Fixes #8665

We add validation for HTTPRoute resources to the policy admission controller.  We validate that for any HTTPRoute which has a Server as a parent_ref, that it doesn't have unsupported filters.  For the moment we do not support any HTTP filters.  As we add support for HTTP filter types, we should update the validator accordingly.

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

Co-authored-by: Oliver Gould <ver@buoyant.io>
2022-07-07 16:14:26 -07:00
Alex Leong b7a0b8adb4
Bump minimum kubernetes version to 1.21 (#8647)
Fixes #8592

Increase the minimum supported kubernetes version from 1.20 to 1.21.  This allows us to drop support for batch/v1beta1/CronJob and discovery/v1beta1/EndpointSlices, instead using only v1 of those resources.  This fixes deprecation warnings about these warnings printed by the CLI.

Signed-off-by: Alex Leong <alex@buoyant.io>
2022-06-14 15:15:28 -07:00
Alex Leong 7dfebf3588
Add safe-to-evict annotation to control plane components (#8524)
Fixes #4067

We add the `cluster-autoscaler.kubernetes.io/safe-to-evict: "true"` annotation to the Linkerd control plane components.  This annotation tells the cluster autoscaler that even though the control plane components have volume mounts, it is okay to evict them (subject to pod disruption constraints).  This is because we only use the volume as temporary storage for certificates and do not need to persist that data.

Signed-off-by: Alex Leong <alex@buoyant.io>
2022-05-31 16:09:12 -07:00
Alex Leong 893fa78671
Split HA functionality into multiple configurable values (#8445)
Some autoscalers, namely Karpenter, don't allow podAntiAffinity and the enablePodAntiAffinity flag is
currently overloaded with other HA requirements. This commit splits out the PDB and updateStrategy
configuration into separate value inputs.

Fixes #8062

Signed-off-by: Alex Leong <alex@buoyant.io>
Co-authored-by: Evan Hines <evan@firebolt.io>
2022-05-10 09:49:58 -07:00
Oliver Gould 33c1d610ad
test: Diff structured YAML when possible (#8432)
When we compare generated manifests against fixtures, we do a simple
string comparison to compare output. The diffed data can be pretty hard
to understand.

This change adds a new test helper, `DiffTestYAML` that parses strings
as arbitrary YAML data structures and uses `deep.Equal` to generate a
diff of the datastructures.

Now, when a test fails, we'll get output like:

```
install_test.go:244: YAML mismatches install_output.golden:
	slice[32].map[spec].map[template].map[spec].map[containers].slice[3].map[image]: PolicyControllerImageName:PolicyControllerVersion != SomeOtherImage:PolicyControllerVersion
```

While testing this, it became apparent that several of our generated
golden files were not actually valid YAML, due to the `LinkerdVersion`
value being unset. This has been fixed.

Signed-off-by: Oliver Gould <ver@buoyant.io>
2022-05-10 08:40:29 -07:00
Alex Leong 6762dd28ac
Add --crds flag to install/upgrade and remove config/control-plane stages (#8251)
Fixes: #8173 

In order to support having custom resources in the default Linkerd installation, it is necessary to add a separate install step to install CRDs before the core install.  The Linkerd Helm charts already accomplish this by having CRDs in a separate chart.

We add this functionality to the CLI by adding a `--crds` flag to `linkerd install` and `linkerd upgrade` which outputs manifests for the CRDs only and remove the CRD manifests when the `--crds` flag is not set.  To avoid a compounding of complexity, we remove the `config` and `control-plane` stages from install/upgrade.  The effect of this is that we drop support for splitting up an install by privilege level (cluster admin vs Linkerd admin).

The Linkerd install flow is now always a 2-step process where `linkerd install --crds` must be run first to install CRDs only and then `linkerd install` is run to install everything else.  This more closely aligns the CLI install flow with the Helm install flow where the CRDs are a separate chart.  Attempting to run `linkerd install` before the CRDs are installed will result in a helpful error message.

Similarly, upgrade is also a 2-step process of `linkerd upgrade --crds` follow by `linkerd upgrade`.

Signed-off-by: Alex Leong <alex@buoyant.io>
2022-04-28 09:36:14 -07:00
Michał Romanowski 88b8da50d2
Introduce node affinity support for linkerd pods (#8137)
In order to restrict pods to run only on arbitrarily chosen nodes, affinities
or tolerations can be used. Currently, Linkerd only supports tolerations,
which are applied to pods and allow them to be scheduled on nodes with
matching "taints".

Certain environments and workflows lean more towards affinity instead of
tolerations to determine preferred or required scheduling. This change
introduces a new "nodeAffinity" field so that users may specify affinity
rules for scheduling Linkerd pods.

Closes #8136

Signed-off-by: Michal Romanowski <michal.rom089@gmail.com>
2022-04-15 11:24:16 +01:00
Kevin Leimkuhler bb8737b912
Add change notes for `edge-22.3.5` (#8182)
This edge release introduces new policy CRDs that allow for more generalized
authorization policies.

The `AuthorizationPolicy` CRD authorizes clients that satisfy all the required
authentications to communicate with the Linkerd `Server` that it targets.
Required authentications are specified through the new `MeshTLSAuthentication`
and `NetworkAuthentication` CRDs.

A `MeshTLSAuthentication` defines a list of authenticated client IDs—specified
directly by proxy identity strings or referencing resources such as
`ServiceAccount`s.

A `NetworkAuthentication` defines a list of client networks that will be
authenticated.

Additionally, to support the new CRDs, policy-related labels have been changed
to better categorize policy metrics. A `srv_kind` label has been introduced
which splits the current `srv_name` value—formatted as `kind:name`—into separate
labels. The `saz_name` label has been removed and is replaced by the new
`authz_kind` and `authz_name` labels.

* Introduced the `srv_kind` label which allowed splitting the value of the
  current `srv_name` label
* Removed the `saz_name` label and replaced it with the new `authz_kind` and
  `authz_name` labels
* Fixed an issue in the destination controller where an update would not be sent
  after an endpoint was discovered for a currently empty service
* Introduced the following custom resource types to support generalized
  authorization policies: `AuthorizationPolicy`, `MeshTLSAuthentication`,
  `NetworkAuthentication`
* Deprecated the `--proxy-version` flag (thanks @importhuman!)
* Updated linkerd-viz to use new policy CRDs

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2022-03-31 15:59:32 -06:00
Oliver Gould c1a1430d1a
Introduce AuthorizationPolicy CRDs (#8007)
Issue #7709 proposes new Custom Resource types to support generalized
authorization policies:

- `AuthorizationPolicy`
- `MeshTLSAuthentication`
- `NetworkAuthentication`

This change introduces these CRDs to the default linkerd installation
(via the `linkerd-crds` chart) and updates the policy controller's
to handle these resource types. The policy admission controller
validates that these resource reference only suppported types.

This new functionality is tested at multiple levels:

* `linkerd-policy-controller-k8s-index` includes unit tests for the
  indexer to test how events update the index;
* `linkerd-policy-test` includes integration tests that run in-cluster
  to validate that the gRPC API updates as resources are manipulated;
* `linkerd-policy-test` includes integration tests that exercise the
  admission controller's resource validation; and
* `linkerd-policy-test` includes integration tests that ensure that
  proxies honor authorization resources.

This change does NOT update Linkerd's control plane and extensions to
use these new authorization primitives. Furthermore, the `linkerd` CLI
does not yet support inspecting these new resource types. These
enhancements will be made in followup changes.

Signed-off-by: Oliver Gould <ver@buoyant.io>
2022-03-30 12:26:45 -07:00
Oliver Gould 00954d71c6
policy: Add end-to-end ServerAuthorization tests (#8155)
In preparation for new policy CRD resources, this change adds end-to-end
tests to validate policy enforcement for `ServerAuthorization`
resources.

In adding these tests, it became clear that the OpenAPI validation for
`ServerAuthorization` resources is too strict. Various `oneof`
constraints have been removed in favor of admission controller
validation. These changes are semantically compatible and do not
necessitate an API version change.

The end-to-end tests work by creating `curl` pods that call an `nginx`
pod. In order to test network policies, the `curl` pod may be created
before the nginx pod, in which case an init container blocks execution
until a `curl-lock` configmap is deleted from the cluster. If the
configmap is not present to begin with, no blocking occurs.

Signed-off-by: Oliver Gould <ver@buoyant.io>
2022-03-28 14:03:24 -07:00
Alex Leong 47105d5eb6
edge-22.3.4 (#8141)
* Disabled pprof endpoints on Linkerd control plane components by default
* Fixed an issue where mirror service endpoints of headless services were always
  ready regardless of gateway liveness
* Added server side validation for ServerAuthorization resources
* Fixed an "origin not allowed" issue when using the latest Grafana with the
  Linkerd Viz extension

Signed-off-by: Alex Leong <alex@buoyant.io>
2022-03-24 13:44:49 -07:00
Kevin Leimkuhler 388f14f48f
allow pprof to be configurable via helm flags (#8090)
Follow-up to #8087 that allows pprof to be enabled via the `--set
enablePprof=true` flag.

Each control plane components spawns its own admin server, so each of these
received it's own `enable-pprof` flag. When `enablePprof=true`, it is passed
through to each component so that when it launches its admin server, its pprof
endpoints are enabled.

A note on the templating: `-enable-pprof={{.Values.enablePprof | default
false}}`. `false` values are not rendered by Helm so without the `... | default
false}}`, it tries to pass the flag as `-enable-pprof=""` which results in an
error. Inlining this felt better than conditionally passing the flag with

```yaml {{ if .Values.enablePprof -}} -enable-pprof={{.Values.enablePprof}} {{
end -}} ```

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2022-03-22 14:31:04 -06:00
Oliver Gould c445c72d61
policy: Validate ServerAuthorization resources (#8076)
`ServerAuthorization` resources are not validated by the admission
controller.

This change enables validation for `ServerAuthorization` resources,
based on changes to the admission controller proposed as a part of
linkerd/linkerd2#8007. This admission controller is generalized to
support arbitrary resource types. The `ServerAuthoriation` validation
currently only ensures that network blocks are valid CIDRs and that they
are coherent. We use the new _schemars_ feature of `ipnet` v2.4.0 to
support using IpNet data structures directly in the custom resource
type bindings.

This change also adds an integration test to validate that the admission
controller behaves as expected.

Signed-off-by: Oliver Gould <ver@buoyant.io>
2022-03-16 14:03:21 -07:00
Kevin Leimkuhler d5e58f214d
add changes for edge-22.3.3 (#8072)
This edge release ensures that in multicluster installations, mirror service
endpoints have their readiness tied to gateway liveness. When the gateway for a
target cluster is not alive, the endpoints that point to it on a source cluster
will properly indicate that they are not ready.

* Fixed tap controller logging errors that were succeptible to log forgery by
  ensuring special characters are escaped
* Fixed issue where mirror service endpoints were always ready regardless of
  gateway liveness
* Removed unused `namespace` entry in `linkerd-control-plane` chart

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2022-03-15 12:44:30 -07:00
Matei David a7b8a5b66b
edge-22.3.2 (#8048)
* edge-22.3.2

This edge release includes a few fixes and quality of life improvements. An
issue has been fixed in the proxy allowing HTTP Upgrade requests to work
through multi-cluster gateways, and the init container's resource limits and
requests have been revised. Additionally, more Go linters have been enabled and
improvements have been made to the devcontainer.

* Changed `linkerd-init` resource (CPU/memory) limits and requests to ensure by
  default the init container does not break a pod's `Guaranteed` QOS class
* Added a new check condition to skip pods whose status is `NodeShutdown`
  during validation as they will not have a proxy container
* Fixed an issue that would prevent proxies from sending HTTP Upgrade requests
  (used in websockets) through multi-cluster gateways

Signed-off-by: Matei David <matei@buoyant.io>

Co-authored-by: Alejandro Pedraza <alejandro@buoyant.io>
2022-03-11 17:26:22 +00:00
Kevin Leimkuhler 3222778191
Match linkerd-init CPU/memory requests/limits (#7989)
Closes #7980 

A pod is considered `Burstable` instead of `Guaranteed` if there exists at least one container in the pod that specifies CPU/memory limits/requests that do not match.

The `linkerd-init` container falls into this category meaning that even if all other containers in a Pod have matching CPU/memory limits/requests, the Pod will not be considered `Guaranteed` because of `linkerd-init`'s hardcoded values.

This changes the values to match, meaning that `linkerd-init` will not be the culprit container if a Pod is not considered `Guaranteed`. Raising the requests—instead of lowering the limits—felt like the safer option here. This means that the container will now always be guaranteed these amounts _and_ will never use more.

[Docs](https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/#create-a-pod-that-gets-assigned-a-qos-class-of-guaranteed) explain this in more detail.

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2022-03-08 15:30:03 -07:00
cpretzer 2065e817fa
Changes for edge-22.3.1 (#8002)
## edge-22.3.1

This edge release includes updates to dependencies, CI, and rust 1.59.0. It also
includes changes to the `linkerd-jaeger` chart to ensure that namespace labels
are preserved and adds support for `imagePullSecrets`, along with improvements
to the multicluster and policy functionality.

* Added note to `multicluster link` command to clarify that the link is
  one-direction
* Introduced `imagePullSecrets` to Jaeger Helm chart
* Updated Rust to v1.59.0
* Fixed a bug where labels can be overwritten in the `linkerd-jaeger` chart
* Fix broken mirrored headles services after `repairEndpoints` runs
* Updated `Server` CRD to handle an empty `PodSelector`

Signed-off-by: Charles Pretzer <charles@buoyant.io>
2022-03-03 14:00:11 -07:00
Oliver Gould d4543cd86e
policy: Use a `kubert::Runtime` (#7961)
`kubert` provides a runtime utility that helps reduce boilerplate around
process lifecycle management, construction of admin and HTTPS servers,
etc.

The admission controller server preserves the certificate reloading
functionality introduced in 96131b5 and updates the utility to read both
RSA and PKSC8 keys to close #7963.

Signed-off-by: Oliver Gould <ver@buoyant.io>
2022-03-01 16:29:32 -08:00
Kevin Leimkuhler af34bbd017
Add changes for edge-22.2.4 (#7962)
## edge-22.2.4

 This edge release continues to address several security related lints and
 ensures they are checked by CI.

 * Add `linkerd check` warning for clusters that cannot verify their
   `clusterNetworks` due to Nodes missing the `podCIDR` field
 * Changed `Server` CRD to allow having an empty `PodSelector`
 * Modified `linkerd inject` to only support `https` URLs to mitigate security
   risks
 * Fixed potential goroutine leak in the port forwarding used by several CLI
   commands and control plane components
 * Fixed timeouts in the policiy validator which could lead to failures if
   `failurePolicy` was set to `Fail`

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2022-02-24 18:48:22 -07:00
Alejandro Pedraza a268ff11c9
Allow `Server` CRD to have empty `PodSelector` (#7925)
Fixes #7904

Allow the `Server` CRD to have the `PodSelector` entry be an empty object, by removing the `omitempty` tag from its go type definition and the `oneof` section in the CRD. No update to the CRD version is required, as this is BC change -- The CRD overriding was tested fine.

Also added some unit tests to confirm podSelector conditions are ANDed, and some minor refactorings in the `Selector` constructors.

Co-authored-by: Oliver Gould <ver@buoyant.io>
2022-02-23 13:45:34 +00:00
Alex Leong 2a4c84db3e
edge-22.2.3 (#7911)
This edge release fixes some `Instant`-related proxy panics that occur on Amazon
Linux. It also includes many behind the scenes improvements to the project's
CI and linting.

* Removed the `--controller-image-version` install flag to simplify the way that
  image versions are handled. The controller image version can be set using the
  `--set linkerdVersion` flag or Helm value
* Lowercased logs and removed redundant lines from the Linkerd2 proxy init
  container
* Prevented the proxy from logging spurious errors when its pod does not define
  any container ports
* Added workarounds to reduce the likelihood of `Instant`-related proxy panics
  that occur on Amazon Linux

Signed-off-by: Alex Leong <alex@buoyant.io>
2022-02-17 13:51:08 -08:00
Matei David 0d59864033
Remove usage of controllerImageVersion values field (#7883)
Remove usage of controllerImageVersion values field

This change removes the unused `controllerImageVersion` field, first
from the tests, and then from the actual chart values structure. Note
that at this point in time, it is impossible to use
`--controller-image-version` through Helm, yet it still seems to be
working for the CLI.

* We configure the charts to use `linkerdVersionValue` instead of
  `controlPlaneImageVersion` (or default to it where appropriate).
* We add the stringslicevar flag (i.e `--set`) to the flagset we use in
  upgrade tests. This means instead of testing value overrides through a
  dedicated flag, we can now make use of `--set` in upgrade tests. We
  first set the linkerdVersionValue in the install option and then
  override the policy controller image version and the linkerd
  controller image version to test flags work as expected.
* We remove hardcoded values from healthcheck test.
* We remove field from chart values struct.

Signed-off-by: Matei David <matei@buoyant.io>
2022-02-17 15:19:08 +00:00
Alejandro Pedraza df311fd8ca
Edge-22.2.2 change notes (#7860)
* Edge-22.2.2 change notes

## edge-22.2.2

This edge release updates the jaeger extension to be available in ARM
architectures as well, and applies some security-oriented amendments.

* Upgraded jaeger and the opentelemetry-collector to their latest versions,
  which now support ARM architectures
* Fixed `linkerd multicluster check` which was reporting false warnings
* Started enforcing TLS v1.2 as a minimum in the webhook servers
* Had the identity controller emit SHA256 certificate fingerprints in its
  logs/events, instead of MD5
2022-02-10 18:06:23 -05:00
Kevin Leimkuhler e79bd72dbd
Add 2 minutes linkerd-await timeout (#7778)
If the proxy doesn't become ready `linkerd-await` never succeeds
and the proxy's logs don't become accessible.

This change adds a default 2 minute timeout so that pod startup
continues despite the proxy failing to become ready. `linkerd-await`
fails and `kubectl` will report that a post start hook failed.

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2022-02-03 17:23:06 -08:00
Kevin Leimkuhler 7cc8be2f1b
Add changes for edge-22.2.1 (#7779)
## edge-22.2.1

This edge release removed the `disableIdentity` configuration now that the proxy
no longer supports running without identity.

* Added a `privileged` configuration to linkerd-cni which is required by some
  environments
* Fixed an issue where the TLS credentials used by the policy validator were not
  updated when the credentials were rotated
* Removed the `disableIdentity` configurations now that the proxy no longer
  supports running without identity
* Fixed an issue where `linkerd jaeger check` would needlessly fail for BYO
  Jaeger or collector installations
* Fixed a Helm HA installation race condition introduced by the stoppage of
  namespace creation

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2022-02-03 15:13:36 -07:00
Alejandro Pedraza 539bcced34
Fix HA race when installing through Helm (#7718)
* Fix HA race when installing through Helm

Fixes #7699

The problem didn't affect 2.11, only latest edges since the Helm charts
got split into `linkerd-crds` and `linkerd-control-plane` and we stopped
creating the linkerd namespace.

With the surrendering of the creation of the namespace, we can no longer
guarantee the existence of the `config.linkerd.io/admission-webhooks`
label, so this PR creates an `objectSelector` for the injector that
filters-out control-plane components, based on the existence of the
`linkerd.io/control-plane-component` label.

Given we still want the multicluster components to be injected, we had
to be rename its `linkerd.io/control-plane-component` label to
`component`, following the same convention used by the other extensions.
The corresponding Prometheus rule for scraping the service mirrors was
updated accordingly.

A similar filter was added for the linkerd-cni DaemonSet.

Also, now that the `kubernetes.io/metadata.name` is prevalent, we're
also using it to filter out the kube-system and cert-manager namespaces.
The former namespace was already mentioned in the docs; the latter is
also included to avoid having races with cert-manager-cainjector which
can be used to provision the injector's cert.
2022-02-02 11:27:20 -05:00
Alejandro Pedraza 68b63269d9
Remove the `proxy.disableIdentity` config (#7729)
* Remove the `proxy.disableIdentity` config

Fixes #7724

Also:
- Removed the `linkerd.io/identity-mode` annotation.
- Removed the `config.linkerd.io/disable-identity` annotation.
- Removed the `linkerd.proxy.validation` template partial, which only
  made sense when `proxy.disableIdentity` was `true`.
- TestInjectManualParams now requires to hit the cluster to retrieve the
  trust root.
2022-01-31 10:17:10 -05:00
Tarun Pothulapati 3fb30a2309
release notes for `edge-22.1.5` (#7722)
## edge-22.1.5

This edge release adds support for per-request Access Logging for HTTP inbound
requests in Linkerd. A new annotation i.e. `config.linkerd.io/access-log` is added,
which configures the proxies to emit access logs to stderr. `apache` and `json`
are the supported configuration options, emitting access logs in Apache Common
Log Format and JSON respectively.

Special thanks to @tustvold for all the initial work around this!

* Updated injector to support the new `config.linkerd.io/access-log` annotation
* Added a new `LINKERD2_PROXY_ACCESS_LOG` proxy environment variable to configure
  the access log format (thanks @tustvold)
* Updated service mirror controller to emit relevant events when
  mirroring is skipped for a service
* Updated various dependencies across the project (thanks @dependabot)

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2022-01-28 00:25:26 +05:30
Eliza Weisman 9e9c9457ae
inject: support `config.linkerd.io/access-log` annotation (#7689)
With #7661, the proxy supports a `LINKERD2_PROXY_ACCESS_LOG`
configuration with the values `apache` or `json`. This configuration
causes the proxy to emit access logs to stderr. This branch makes it
possible for users to enable access logging by adding an annotation,
`config.linkerd.io/access-log`, that tells the proxy injector to set
this environment variable.

I've also added some tests to ensure that the annotation and the
environment variable are set correctly. I tried to follow the existing
tests as examples of how we do this, but please let me know if I've
overlooked anything!

Closes #7662 #1913

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2022-01-24 14:02:19 -08:00
Matei David b158c0b6ca
edge-22.1.4 (#7653)
## edge-22.1.4

This edge release features a new configuration annotation, support for
externally hosted Grafana instances, and other improvements in the CLI,
dashboard and Helm charts. To learn more about using an external Grafana
instance with Linkerd, you can refer to our
[docs](0c3c5cd5ae/linkerd.io/content/2.12/tasks/grafana.md).

* Added a new annotation to configure skipping subnets in the init container
  (`config.linkerd.io/skip-subnets`). This configuration option is ideal for
  Docker-in-Docker (dind) workloads (thanks @michaellzc!)
* Added support in the dashboard for externally hosted Grafana instances
  (thanks @jackgill!)
* Introduced resource block to `linkerd-jaeger` Helm chart (thanks
  @yuriydzobak!)
* Introduced parametrized datasource (`DS_PROMETHEUS`) in all Grafana
  dashboards. This allows pointing to the right Prometheus datasource when
  importing a dashboard
* Introduced a consistent `--ignore-cluster` flag in the CLI for the base
  installation and extensions; manifests will now be rendered even if there is
  an existing installation in the current Kubernetes context (thanks
  @krzysztofdrys!)
* Updated the service mirror controller to skip mirroring services whose
  namespaces do not yet exist in the source cluster; previously, the service
  mirror would create the namespace itself.

Signed-off-by: Matei David <matei@buoyant.io>
2022-01-20 19:48:01 +00:00
Michael Lin 99f3e087e1
Introduce annotation to skip subnets (#7631)
The goal is to support configuring the
`--subnets-to-ignore` flag in proxy-init

This change adds a new annotation `/skip-subnets` which
takes a comma-separated list of valid CIDR.
The argument will map to the `--subnets-to-ignore`
flag in the proxy-init initContainer.

Fixes #6758

Signed-off-by: Michael Lin <mlzc@hey.com>
2022-01-20 16:53:59 +00:00
Tarun Pothulapati 1cc068c111
release notes for `edge-22.1.3` (#7607)
* release notes for `edge-22.1.3`

## edge-22.1.3

This release removes the Grafana component in the linkerd-viz extension.
Users can now import linkerd dashboards into Grafana from the [Linkerd org](https://grafana.com/orgs/linkerd)
in Grafana. Users can also follow the instructions in the [docs](https://github.com/linkerd/website/pull/1273)
to install a separate Grafana that can be integrated with the Linkerd Dashboard.

* Stopped shipping grafana-based image in the linkerd-viz extension
* Removed `repair` sub-command in the CLI
* Updated various dependencies across the project (thanks @dependabot)

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2022-01-14 01:07:33 +05:30
Alejandro Pedraza 67dfebb259
Stop shipping grafana-based image (#7567)
* Stop shipping grafana-based image

Fixes #6045 #7358

With this change we stop building a Grafana-based image preloaded with the Linkerd Grafana dashboards.

Instead, we'll recommend users to install Grafana by themselves, and we provide a file `grafana/values.yaml` with a default config that points to all the same Grafana dashboards we had, which are now hosted in https://grafana.com/orgs/linkerd/dashboards .

The new file `grafana/README.md` contains instructions for installing the official Grafana Helm chart, and mentions other available methods.

The `grafana.enabled` flag has been removed, and `grafanaUrl` has been moved to `grafana.url`. This will help consolidating other grafana settings that might emerge, in particular when #7429 gets addressed.

## Dashboards definitions changes

The dashboard definitions under `grafana/dashboards` (which should be kept in sync with what's published in https://grafana.com/orgs/linkerd/dashboards), got updated, adding the `__inputs`, `__elements` and `__requires` entries at the beginning, that were required in order to be published.
2022-01-11 14:47:40 -05:00
Alex Leong 6a5f580278
edge 22.1.1 (#7572)
This release adds support for using the cert-manager CA Injector to configure
Linkerd's webhooks.

* Fixed a rare issue when a Service's opaque ports annotation does not match
  that of the pods in the service
* Disallowed privilege escalation in control plane containers (thanks @kichristensen!)
* Updated the multicluster extension's service mirror controller to make mirror
  services empty when the exported service is empty
* Added support for injecting Webhook CA bundles with cert-manager CA Injector
  (thanks @bdun1013!)

Signed-off-by: Alex Leong <alex@buoyant.io>
2022-01-06 16:40:42 -08:00
Kim Christensen 75903af4a9
Make privilege escalation configurable in Helm (#7521)
Disabling privilege escalation is a security best practice. But
currently this is not supported when installing from Helm.

A parameter called `privilegeEscalationEnabled` is added to the Helm
chart. The default value is `true`to avoid breaking changes to the Helm
chart.

Fixes #7282

Signed-off-by: Kim Christensen <kimworking@gmail.com>
2022-01-03 14:30:42 -05:00
Brian Dunnigan a8dbe4d1e0
Adding support for injecting Webhook CA bundles with cert-manager CA Injector (#7353) (#7354)
* Adding support for injecting Webhook CA bundles with cert-manager CA Injector (#7353)

Currently, users need to pass in the caBundle when doing a helm/CLI install. If the user is already using cert-manager to generate webhook certs, they can use the cert-manager CA injector to populate the caBundle for the Webhooks.

Adding inectCaFrom and injectCaFromSecret options to every webhook alongside every caBundle option gives users the ability to add the cert-manager.io/inject-ca-from or cert-manager.io/inject-ca-from-secret annotations to the Webhooks specifying the Certificate or Secret to pull the CA from to accomplish ca bundle injection.

Signed-off-by: Brian Dunnigan <bdun1013dev@gmail.com>
Co-authored-by: Alejandro Pedraza <alejandro@buoyant.io>
2022-01-03 14:28:30 -05:00
Tarun Pothulapati e97d405056
update chart version for `edge-21.12.4` (#7529)
* update chart version for `edge-21.12.4`

This PR updates the chart version of the `linkerd-control-plane`
chart for the latest edge.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2021-12-24 00:13:58 +05:30
Tarun Pothulapati aa9ee6b007
injector: remove unused proxy reference env variables (#7382)
Fixes #6740

\#6711 removed the usage of unnecessary reference variables
in the proxy template, as they are not needed. Their definations
were left as there were race conditions with extension installs.

As `2.11` was released with that change, Now its a good time to
remove the definations too as no usages should be present from a
`2.11` upgrade.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2021-12-16 00:06:18 +05:30
Alejandro Pedraza f9f3ebefa9
Remove namespace from charts and split them into `linkerd-crd` and `linkerd-control-plane` (#6635)
Fixes #6584 #6620 #7405

# Namespace Removal

With this change, the `namespace.yaml` template is rendered only for CLI installs and not Helm, and likewise the `namespace:` entry in the namespace-level objects (using a new `partials.namespace` helper).

The `installNamespace` and `namespace` entries in `values.yaml` have been removed.

There in the templates where the namespace is required, we moved from `.Values.namespace` to `.Release.Namespace` which is filled-in automatically by Helm. For the CLI, `install.go` now explicitly defines the contents of the `Release` map alongside `Values`.

The proxy-injector has a new `linkerd-namespace` argument given the namespace is no longer persisted in the `linkerd-config` ConfigMap, so it has to be passed in. To pass it further down to `injector.Inject()` without modifying the `Handler` signature, a closure was used.

------------
Update: Merged-in #6638: Similar changes for the `linkerd-viz` chart:

Stop rendering `namespace.yaml` in the `linkerd-viz` chart.

The additional change here is the addition of the `namespace-metadata.yaml` template (and its RBAC), _not_ rendered in CLI installs, which is a Helm `post-install` hook, consisting on a Job that executes a script adding the required annotations and labels to the viz namespace using a PATCH request against kube-api. The script first checks if the namespace doesn't already have an annotations/labels entries, in which case it has to add extra ops in that patch.

---------
Update: Merged-in the approved #6643, #6665 and #6669 which address the `linkerd2-cni`, `linkerd-multicluster` and `linkerd-jaeger` charts. 

Additional changes from what's already mentioned above:
- Removes the install-namespace option from `linkerd install-cni`, which isn't found in `linkerd install` nor `linkerd viz install` anyways, and it would add some complexity to support.
- Added a dependency on the `partials` chart to the `linkerd-multicluster-link` chart, so that we can tap on the `partials.namespace` helper.
- We don't have any more the restriction on having the muticluster objects live in a separate namespace than linkerd. It's still good practice, and that's the default for the CLI install, but I removed that validation.


Finally, as a side-effect, the `linkerd mc allow` subcommand was fixed; it has been broken for a while apparently:

```console
$ linkerd mc allow --service-account-name foobar
Error: template: linkerd-multicluster/templates/remote-access-service-mirror-rbac.yaml:16:7: executing "linkerd-multicluster/templates/remote-access-service-mirror-rbac.yaml" at <include "partials.annotations.created-by" $>: error calling include: template: no template "partials.annotations.created-by" associated with template "gotpl"
```
---------
Update: see helm/helm#5465 describing the current best-practice

# Core Helm Charts Split

This removes the `linkerd2` chart, and replaces it with the `linkerd-crds` and `linkerd-control-plane` charts. Note that the viz and other extension charts are not concerned by this change.

Also note the original `values.yaml` file has been split into both charts accordingly.

### UX

```console
$ helm install linkerd-crds --namespace linkerd --create-namespace linkerd/linkerd-crds
...
# certs.yaml should contain identityTrustAnchorsPEM and the identity issuer values
$ helm install linkerd-control-plane --namespace linkerd -f certs.yaml linkerd/linkerd-control-plane
```

### Upgrade

As explained in #6635, this is a breaking change. Users will have to uninstall the `linkerd2` chart and install these two, and eventually rollout the proxies (they should continue to work during the transition anyway).

### CLI

The CLI install/upgrade code was updated to be able to pick the templates from these new charts, but the CLI UX remains identical as before.

### Other changes

- The `linkerd-crds` and `linkerd-control-plane` charts now carry a version scheme independent of linkerd's own versioning, as explained in #7405.
- These charts are Helm v3, which is reflected in the `Chart.yaml` entries and in the removal of the `requirements.yaml` files.
- In the integration tests, replaced the `helm-chart` arg with `helm-charts` containing the path `./charts`, used to build the paths for both charts.

### Followups

- Now it's possible to add a `ServiceProfile` instance for Destination in the `linkerd-control-plane` chart.
2021-12-10 15:53:08 -05:00
Tarun Pothulapati 4170b49b33
smi: remove default functionality in linkerd (#7334)
Now, that SMI functionality is fully being moved into the
[linkerd-smi](www.github.com/linkerd/linkerd-smi) extension, we can
stop supporting its functionality by default.

This means that the `destination` component will stop reacting
to the `TrafficSplit` objects. When `linkerd-smi` is installed,
It does the conversion of `TrafficSplit` objects to `ServiceProfiles`
that destination components can understand, and will react accordingly.

Also, Whenever a `ServiceProfile` with traffic splitting is associated
with a service, the same information (i.e splits and weights) is also
surfaced through the `UI` (in the new `services` tab) and the `viz cmd`.
So, We are not really loosing any UI functionality here.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2021-12-03 12:07:30 +05:30
Alex Leong 18bfd0bd9e
default enableEndpointSlices to true (#7216)
EndpointSlices are enabled by default in our Kubernetes minimum version of 1.20.  Thus we can change the default behavior of the destination controller to use EndpointSlices instead of Endpoints.  This unblocks any functionality which is specific to EndpointSlices such as topology aware hints.

Signed-off-by: Alex Leong <alex@buoyant.io>
2021-12-01 15:56:44 -08:00
Alexander Berger 1b4a1f63dd
Add check for runAsRoot for docker container runtime (#7361)
Add check for runAsRoot for docker container runtime

Fixes https://github.com/linkerd/linkerd2/issues/7308
Followup to https://github.com/linkerd/linkerd2/pull/7348

Signed-off-by: Alexander Berger <alex-berger@gmx.ch>
2021-12-01 12:22:03 +00:00
Oliver Gould 06af5e0c67
Deprecate v1alpha1 policy APIs (#7344)
The policy APIs are currently at v1beta1, though we continue to support
the (identical) v1alpha1 APIs. This change marks the v1alpha1 variants
as deprecated so that kubectl will emit warnings if they are used.
2021-11-23 12:09:51 -08:00
Matei David 690bc09c35
Stop using deprecated `beta.kubernetes.io/node` label (#7310)
In our chart values and (some) integration tests, we're using a deprecated
label for node selection. According to the warning messages we get during
installation, the label has been deprecated since k8s `v1.14`:

```
Warning: spec.template.spec.nodeSelector[beta.kubernetes.io/os]: deprecated since v1.14; use "kubernetes.io/os" instead
Warning: spec.jobTemplate.spec.template.spec.nodeSelector[beta.kubernetes.io/os]: deprecated since v1.14; use "kubernetes.io/os" instead
```

This PR changes all occurrences of `beta.kubernetes.io/node` with
`kubernetes.io/node`.

Fixes #7225
2021-11-19 09:50:15 -08:00
Gustavo Fernandes de Carvalho be7010928e
Adds logFormat and logLevel values for proxy-init (#6881) (#6966)
This PR adds changes in partials and values.yaml to allow the optional flags `log-level` and `log-format` to proxy-init.

This approach was used to have backwards compatibility between different linkerd-proxy-init images without needing to change helm charts.

Related to https://github.com/linkerd/linkerd2-proxy-init/pull/47

Fixes #6881

Signed-off-by: Gustavo Carvalho <gusfcarvalho@gmail.com>
2021-11-08 12:53:42 -07:00
cpretzer b3150c4f18
Add control plane namespace arg to policy controller (#7206)
The policy controller synthesizes identity strings based on service account
names; but it assumed that `linkerd` was the name of the control plane
namespace. This change updates the policy controller to take a
`--control-plane-namespace` command-line argument to set this value in
identity strings. The helm templates have been updated to configure the policy
controller appropriately.

Fixes #7204

Co-authored-by: Oliver Gould <ver@buoyant.io>
2021-11-05 11:24:54 -07:00
Christian Schlotter 98533538e6
Allow proxy-init container to run as non-root (#7162)
Linkerd proxy-init container is currently enforced to run as root.

Removes hardcoding `runAsNonRoot: false` and `runAsUser: 0`. This way
the container inherits the user ID from the proxy-init image instead which
may allow to run as non-root.

Fixes #5505

Signed-off-by: Schlotter, Christian <christian.schlotter@daimler.com>
2021-11-05 10:44:32 -05:00
Michael Lin 752d78bf79
Support ephemeral-storage resource config (#7159)
The resource configuration does not support `ephemeral-storage`.

The [partials.resources](main/charts/partials/templates/_resources.tpl) named template should be updated to support such configuration.

The change can be validated by running under `linkerd2/viz/charts/linkerd-viz` directory

```bash
helm template --set prometheus.resources.ephemeral-storage.limit=4Gi .
```

```bash
helm template --set prometheus.resources.ephemeral-storage.request=4Gi .
```

```bash
helm template \
  --set prometheus.resources.ephemeral-storage.limit=4Gi \
  --set prometheus.resources.ephemeral-storage.request=4Gi .
```

Make sure it doesn't affect existing resources configuration

```bash
helm template --set prometheus.resources.cpu.limit=4Gi .
```

Fixes #3307

Signed-off-by: Michael Lin <mlzc@hey.com>
2021-11-03 17:46:44 -06:00