-
Notifications
You must be signed in to change notification settings - Fork 1
/
.quickstartEnv
107 lines (87 loc) · 3.88 KB
/
.quickstartEnv
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
export TOOLS_IMAGE=quay.io/kuadrant/mgc-tools:latest
export TMP_DIR=/tmp/api
# export KIND_BIN=kind
# export HELM_BIN=helm
dockerBinCmd() {
local network=""
if [ ! -z ${KIND_CLUSTER_DOCKER_NETWORK} ]; then
network=" --network ${KIND_CLUSTER_DOCKER_NETWORK}"
fi
local configDir="$(dirname "${BASH_SOURCE[0]}")/config"
local configVolume=" -v ${configDir}:${configDir}"
echo "docker run --rm -u $UID -v ${TMP_DIR}:/tmp/api:z${configVolume}${network} -e KUBECONFIG=/tmp/api/kubeconfig --entrypoint=$1 $TOOLS_IMAGE"
}
export KIND_CLUSTER_PREFIX="api-"
export KIND_CLUSTER_CONTROL_PLANE="${KIND_CLUSTER_PREFIX}control-plane"
export KIND_CLUSTER_WORKLOAD="${KIND_CLUSTER_PREFIX}workload"
export KIND_CLUSTER_DOCKER_NETWORK="mgc"
# SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# BIN_DIR="${SCRIPT_DIR}/../bin/"
export KIND_BIN=kind
export HELM_BIN=helm
export KUSTOMIZE_BIN=$(dockerBinCmd "kustomize")
export YQ_BIN=$(dockerBinCmd "yq")
export ISTIOCTL_BIN="${BIN_DIR}istioctl"
export OPERATOR_SDK_BIN="${BIN_DIR}operator-sdk"
export CLUSTERADM_BIN=$(dockerBinCmd "clusteradm")
export SUBCTL_BIN="${BIN_DIR}subctl"
export KFILT="docker run --rm -i ryane/kfilt"
export port80=9090
export port443=8445
export proxyPort=9200
export metalLBSubnetStart=200
requiredENV() {
export PROVIDER="aws"
if [[ "$PROVIDER" == "aws" ]]; then
if [[ -z "${KUADRANT_AWS_ACCESS_KEY_ID}" ]]; then
echo "Enter an AWS access key ID for an account where you have access to Route53:"
read KUADRANT_AWS_ACCESS_KEY_ID </dev/tty
echo "export KUADRANT_AWS_ACCESS_KEY_ID for future executions of the script to skip this step"
fi
if [[ -z "${KUADRANT_AWS_SECRET_ACCESS_KEY}" ]]; then
echo "Enter the corresponding AWS secret access key for the AWS access key ID entered above:"
read KUADRANT_AWS_SECRET_ACCESS_KEY </dev/tty
echo "export KUADRANT_AWS_SECRET_ACCESS_KEY for future executions of the script to skip this step"
fi
if [[ -z "${KUADRANT_AWS_REGION}" ]]; then
echo "Enter an AWS region (e.g. eu-west-1) for an Account where you have access to Route53:"
read KUADRANT_AWS_REGION </dev/tty
echo "export KUADRANT_AWS_REGION for future executions of the script to skip this step"
fi
if [[ -z "${KUADRANT_AWS_DNS_PUBLIC_ZONE_ID}" ]]; then
echo "Enter the Public Zone ID of your Route53 zone:"
read KUADRANT_AWS_DNS_PUBLIC_ZONE_ID </dev/tty
echo "export KUADRANT_AWS_DNS_PUBLIC_ZONE_ID for future executions of the script to skip this step"
fi
if [[ -z "${KUADRANT_ZONE_ROOT_DOMAIN}" ]]; then
echo "Enter the root domain of your Route53 hosted zone (e.g. www.example.com):"
read KUADRANT_ZONE_ROOT_DOMAIN </dev/tty
echo "export KUADRANT_ZONE_ROOT_DOMAIN for future executions of the script to skip this step"
fi
else
if [[ -z "${GOOGLE}" ]]; then
echo "Enter either credentials created either by CLI or by service account (Please make sure the credentials provided are in JSON format)"
read GOOGLE </dev/tty
echo "export GOOGLE for future executions of the script to skip this step"
fi
if ! jq -e . <<< "$GOOGLE" >/dev/null 2>&1; then
echo "Credentials provided is not in JSON format"
exit 1
fi
if [[ -z "${PROJECT_ID}" ]]; then
echo "Enter the project id for your GCP Cloud DNS:"
read PROJECT_ID </dev/tty
echo "export PROJECT_ID for future executions of the script to skip this step"
fi
if [[ -z "${ZONE_DNS_NAME}" ]]; then
echo "Enter the DNS name for your GCP Cloud DNS:"
read ZONE_DNS_NAME </dev/tty
echo "export ZONE_DNS_NAME for future executions of the script to skip this step"
fi
if [[ -z "${ZONE_NAME}" ]]; then
echo "Enter the Zone name for your GCP Cloud DNS:"
read ZONE_NAME </dev/tty
echo "export ZONE_NAME for future executions of the script to skip this step"
fi
fi
}