This allows overriding the docker images registry through the
`LINKERD_DOCKER_REGISTRY` environment variable, as the CLI's `--registry`
flag does (analogously to the `LINKERD_NAMESPACE` env var).
In the `integration_tests.yml` workflow we've been
wanting to test directly against GH's registry instead of having to
endure cr.l5d.io's problems. To achieve this we set `DOCKER_REGISTRY:
ghcr.io/linkerd` globally,
and all the docker scripts will use it
accordingly. And before triggering the integration tests, we copy that
value to `LINKERD_DOCKER_REGISTRY`. Note that the CLI and Helm manifests
will continue to point to `cr.l5d.io` by default when this is not
overridden.
`release.yml` still points to `cr.l5.io` because that's what users will experience,
so we want to test that right before releasing.
Another goal was to be able to run these workflows in forks by
overriding the global `DOCKER_REGISTRY` var pointing to the fork's own
registry.
## Nice side-effects
- This fixes the policy controller's image not being affected by the
`--registry` flag when installing through the CLI.
- The `--registry` flag (and overriding `LINKERD_DOCKER_REGISTRY` env var) have been added to `linkerd jaeger install`.
One of the challenges with using the Cobra flag library is that it is difficult to differentiate between a flag that has been set explicitly to its default value and one that has been unset (and thus remains at its default value). In particular, when processing CLI flags for the purposes of install and upgrade, this distinction is important because we want to persist the effects of flags which have been set.
Flag is an interface which describes a command line flag that affects the Helm Values used to render Helm charts. This interface allows us to iterate over flags which have been set and apply their effects to the Values. To see how this library is to be used, see https://github.com/linkerd/linkerd2/pull/5005
Signed-off-by: Alex Leong <alex@buoyant.io>