blob: 752c286c2abce3b73757ed99edb8f2ea39b7d1a9 [file] [log] [blame]
Pawel Wieczorek2d13ea82019-07-29 13:17:51 +02001#!/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
21BINARY='kubectl'
22INSTALL_DIR='/usr/local/bin/'
23
24DEFAULT_VERSION='v1.13.5'
25DEFAULT_ARCH='amd64'
26DEFAULT_SYSTEM='linux'
27
28# Variables
29VERSION="${1:-$DEFAULT_VERSION}"
30ARCH="${2:-$DEFAULT_ARCH}"
31SYSTEM="${3:-$DEFAULT_SYSTEM}"
32
33URL="https://storage.googleapis.com/kubernetes-release/release/${VERSION}/bin/${SYSTEM}/${ARCH}/${BINARY}"
34
35
36# Prerequistes
37wget "$URL"
38chmod +x "$BINARY"
39
40# Installation
41mv "$BINARY" "$INSTALL_DIR"