aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-minimal-onap/tools/get_kubectl.sh
blob: 752c286c2abce3b73757ed99edb8f2ea39b7d1a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash

#
# @file        test/security/k8s/tools/dublin/get_kubectl.sh
# @author      Pawel Wieczorek <p.wieczorek2@samsung.com>
# @brief       Utility for obtaining kubectl tool
#

# Dependencies:
#     wget
#     coreutils
#
# Privileges:
# Script expects to be run with administrative privileges for accessing /usr/local/bin
#
# Usage:
# # ./get_kubectl.sh [VERSION [ARCH [SYSTEM]]]
#

# Constants
BINARY='kubectl'
INSTALL_DIR='/usr/local/bin/'

DEFAULT_VERSION='v1.13.5'
DEFAULT_ARCH='amd64'
DEFAULT_SYSTEM='linux'

# Variables
VERSION="${1:-$DEFAULT_VERSION}"
ARCH="${2:-$DEFAULT_ARCH}"
SYSTEM="${3:-$DEFAULT_SYSTEM}"

URL="https://storage.googleapis.com/kubernetes-release/release/${VERSION}/bin/${SYSTEM}/${ARCH}/${BINARY}"


# Prerequistes
wget "$URL"
chmod +x "$BINARY"

# Installation
mv "$BINARY" "$INSTALL_DIR"