Pawel Wieczorek | 2d13ea8 | 2019-07-29 13:17:51 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # |
| 4 | # @file test/security/k8s/tools/dublin/get_kubectl.sh |
| 5 | # @author Pawel Wieczorek <p.wieczorek2@samsung.com> |
| 6 | # @brief Utility for obtaining kubectl tool |
| 7 | # |
| 8 | |
| 9 | # Dependencies: |
| 10 | # wget |
| 11 | # coreutils |
| 12 | # |
| 13 | # Privileges: |
| 14 | # Script expects to be run with administrative privileges for accessing /usr/local/bin |
| 15 | # |
| 16 | # Usage: |
| 17 | # # ./get_kubectl.sh [VERSION [ARCH [SYSTEM]]] |
| 18 | # |
| 19 | |
| 20 | # Constants |
| 21 | BINARY='kubectl' |
| 22 | INSTALL_DIR='/usr/local/bin/' |
| 23 | |
| 24 | DEFAULT_VERSION='v1.13.5' |
| 25 | DEFAULT_ARCH='amd64' |
| 26 | DEFAULT_SYSTEM='linux' |
| 27 | |
| 28 | # Variables |
| 29 | VERSION="${1:-$DEFAULT_VERSION}" |
| 30 | ARCH="${2:-$DEFAULT_ARCH}" |
| 31 | SYSTEM="${3:-$DEFAULT_SYSTEM}" |
| 32 | |
| 33 | URL="https://storage.googleapis.com/kubernetes-release/release/${VERSION}/bin/${SYSTEM}/${ARCH}/${BINARY}" |
| 34 | |
| 35 | |
| 36 | # Prerequistes |
| 37 | wget "$URL" |
| 38 | chmod +x "$BINARY" |
| 39 | |
| 40 | # Installation |
| 41 | mv "$BINARY" "$INSTALL_DIR" |