Commit Graph

15 Commits

Author SHA1 Message Date
Joakim Roubert 2b92b07b19
bin: shellscript housekeeping (#13469)
- 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>
2024-12-12 10:28:14 -05:00
Joakim Roubert 7303846417
Shellscript housekeeping (#8549)
- 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>
2022-05-26 16:19:35 +01:00
Alex Leong 2c6db25d7b
Standardize curl flags with scurl (#7658)
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>
2022-01-24 08:42:20 -08:00
Kevin Leimkuhler a7b17ef6f0
Fix install-pr to use correct registry (#7083)
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>
2021-10-20 13:55:00 -06:00
Kevin Leimkuhler 0082867102
override docker registry in install-pr script (#6848)
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>
2021-09-10 13:54:11 -06:00
Alex Leong 8f15683177
Fix up docker build scripts (#6781)
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>
2021-09-01 09:37:56 -07:00
Alejandro Pedraza bded2fae14
Expand `bin/image-load` command to specify images (#6206)
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.
2021-06-03 05:06:17 -05:00
Kevin Leimkuhler a456d03621
Change script to work with k3d and install only CLI (#5333)
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>
2020-12-07 11:35:01 -05:00
Alejandro Pedraza deca7ede08
Consolidate integration tests under k3d (#5245)
* 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.
2020-11-18 14:33:16 -05:00
Alex Leong 2e5087b9f6
Update install-pr to use image-load script (#5226)
The `bin/kind-load` script no longer exists and has been renamed to `bin/image-load`.

Signed-off-by: Alex Leong <alex@buoyant.io>
2020-11-13 14:38:20 -08:00
Joakim Roubert 8d19b4055b
Improve shellscript portability by using /bin/env (#4628)
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>
2020-06-19 15:49:29 -04:00
Kevin Leimkuhler f6bd722e2c
Fix install-pr script (#4610)
* 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>
2020-06-17 21:32:01 -07:00
Alejandro Pedraza 22f1606b73
Extract common logic in scripts and CI to load images into KinD (#4212)
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.
```
2020-03-30 16:28:28 -05:00
Kevin Leimkuhler 6369cffacc
Add KinD option to `install-pr` script (#4167)
## 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.
2020-03-17 10:54:33 -07:00
Alex Leong 586911e340
Add bin/install-pr script (#4147)
# 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>
2020-03-10 10:58:03 -07:00