- Use single quotes for static strings, not double
- Use sh and not bash for _os.sh that has no bash-specific content
- Remove superfluous double quotes on variable assignments
- Only use bash-specific [[ ]] if statements for bash-specific content
- Consistently use style with if; then on same line
Change-Id: I1575971262773149db32021efbf2d7f1d4df9771
Signed-off-by: Joakim Roubert <joakimr@axis.com>
- Replace simple awk commands with shell built-ins
- Single quotes instead of double quotes for static strings
- No need for -n operator to check that variables are not empty
- Use single echo calls instead of several consecutive ones
- No quotes are needed for variable assignments
- Use the more lightweight echo instead of printf where applicable
- No need to use bash's == comparison when there is the POSIX =
Signed-off-by: Joakim Roubert <joakim.roubert@axis.com>
Introduce `bin/scurl` which invokes `curl` with a standard set of flags to enforce best practices.
All `curl` invocations have been replaced with `scurl`.
Fixes#7593
Signed-off-by: Alex Leong <alex@buoyant.io>
When PR images are built for integration tests in CI, they use the `ghcr.io` registry. When attempting to install Linkerd from those images using the `bin/install-pr` script, it expects the `cr.l5d.io` registry.
This changes the `install-pr` script to rename those images to use the expected `cr.l5d.io` registry so that users can continue to use a simpler install command—as opposed to passing `--set` flags for _every_ Linkerd image.
`install-pr` is only used for testing and most of the time should be a quick check to make sure some feature is working as expected. This is why I decided renaming made more sense than making the user pass `--set` for each image.
Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
Images created based off PRs now use the `ghcr.io/linkerd` registry. `bin/docker-pull-binaries` which is used by this script uses the default `cr.l5d.io/linkerd`. This results in no binary being pulled because `bin/install-pr` is using the incorrect image name.
This change overrides the `DOCKER_REGISTRY` in `bin/install-pr` so that the correct name is used when pulling the binary.
Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
A few small improvements to our docker build scripts:
* Centralized the list of docker images to a DOCKER_IMAGES variable defined in _docker.sh
* Build scripts now honor the TAG variable, if defined
* Unused docker-images script has been removed
We also update the `--control-plane-version` Linkerd install flag to affect the policy controller version as well.
Taken together, this enables the following workflow for building and deploying changes to individual Linkerd components. For example, suppose you wish to deploy changes which only affect the controller image:
```console
# Begin by building all images at main with a dev tag
> TAG=alex-dev bin/docker-build
# OR begin by retagging all images from a recent release
> bin/docker-retag-all edge-21.8.4 alex-dev
# Make changes and then rebuild specific component
> TAG=alex-dev bin/docker-build-controller
# Load images into kind
> TAG=alex-dev bin/image-load --kind --cluster alex
# Install Linkerd
> bin/linkerd install --control-plane-version alex-dev --proxy-version alex-dev | k apply -f -
```
Signed-off-by: Alex Leong <alex@buoyant.io>
Addresses #6169 in part.
Improve `bin/image-load` commands to receive as arguments the images we
want to load (any from proxy, controller, web, metrics-api, grafana, debug, cni-plugin, jaeger-webhook or tap).
If nothing is passed, it loads them all, as it currently does.
Note that now in order to specify a target cluster different that the default (`k3s-default` for k3d and `kind` for KinD) you need to use the new `--cluster` flag.
This changes the install-pr script to work with k3d.
Additionally, it now only installs the CLI; it no longer installs Linkerd on the
cluster. This was removed because most of the time when installing a Linkerd
version from a PR, some extra installation configuration is required and I was
always commenting out that final part of the script.
`--context` was changed to `--cluster` since we no longer need a context value,
only the cluster name which we are loading the images in to.
Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
* Consolidate integration tests under k3d
Fixes#5007
Simplified integration tests by moving all to k3d. Previously things were running in Kind, except for the multicluster tests, which implied some extra complexity in the supporting scripts.
Removed the KinD config files under `test/integration/configs`, as config is now passed as flags into the `k3d` command.
Also renamed `kind_integration.yml` to `integration_tests.yml`
Test skipping logic under ARM was also simplified.
Using `/bin/env` increases portability for the shell scripts (and often using `/bin/env` is requested by e.g. Mac users). This would also facilitate testing scripts with different Bash versions via the Bash containers, as they have bash in `/usr/local` and not `/bin`. Using `/bin/env`, there is no need to change the script when testing. (I assume the latter was behind c301ea214b (diff-ecec5e3a811f60bc2739019004fa35b0), which would not happen using `/bin/env`.)
Signed-off-by: Joakim Roubert <joakimr@axis.com>
* Fix install-pr script
* Add image-archives path to commands to use the files
Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
Signed-off-by: Charles Pretzer <charles@buoyant.io>
Co-authored-by: Charles Pretzer <charles@buoyant.io>
Fixes#4206 Followup to #4167
Extract common logic to load images into KinD, from `bin/kind-load`, `bin/install-pr`, `.github/workflows/kind_integration.yml` and `.github/workflows/release.yml`.
Besides removing the duplication, `bin/kind-load` will benefit in performance by having each image be loaded in parallel.
```
Load into KinD the images for Linkerd's proxy, controller, web, grafana, debug and cni-plugin.
Usage:
bin/kind-load [--images] [--images-host ssh://linkerd-docker]
Examples:
# Load images from the local docker instance
bin/kind-load
# Load images from tar files located in the current directory
bin/kind-load --images
# Retrieve images from a remote docker instance and then load them into KinD
bin/kind-load --images --images-host ssh://linkerd-docker
Available Commands:
--images: use 'kind load image-archive' to load the images from local .tar files in the current directory.
--images-host: the argument to this option is used as the remote docker instance from which images are first retrieved
(using 'docker save') to be then loaded into KinD. This command requires --images.
```
## Motivation
After #4147 added the `install-pr` script, installing PRs into existing
clusters does not work if that cluster is a KinD cluster
Changing the script to be able to use KinD, and specifically automate `kind
load` would be helpful!
## Solution
The script can now be used in the following ways.
```
❯ bin/install-pr --help
Install Linkerd with the changes made in a GitHub Pull Request.
Usage:
--context: The name of the kubeconfig context to use
# Install Linkerd into the current cluster
bin/install-pr 1234
# Install Linkerd into the current KinD cluster
bin/install-pr [-k|--kind] 1234
# Install Linkerd into the 'kind-pr-1234' KinD cluster
bin/install-pr [-k|--kind] --context kind-pr-1234 1234
```
The script assumes that the cluster (KinD or not) has already been created. If
the cluster is a KinD cluster, the `-k|--kind` flag should be passed.
If the `--context` flag is not passsed, the install defaults to the current
context (`kubectl config current-context`).
I also added a [`-h|--help]` option that describes how to use the script.
# Install PR
This script takes a Github pull request number as an argument, downloads the
docker images from the pull request's artifacts, pushes them, and installs
them on your Kubernetes cluster. Requires a Github personal access token
in the $GITHUB_TOKEN environment variable.
Signed-off-by: Alex Leong <alex@buoyant.io>