forked from controlplaneio/simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubesim
executable file
·32 lines (26 loc) · 905 Bytes
/
kubesim
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
#!/bin/bash
if [[ -z ${AWS_SHARED_CREDENTIALS_FILE} ]]; then
SIMULATOR_AWS_CREDS_PATH="${HOME}/.aws/"
else
SIMULATOR_AWS_CREDS_PATH="$(dirname "${AWS_SHARED_CREDENTIALS_FILE}")"
fi
CONTAINER_NAME="controlplane/simulator:latest"
KUBE_SIM_TMP="${HOME}/.kubesim/"
SIMULATOR_CONFIG_FILE="${KUBE_SIM_TMP}simulator.yaml"
BASTION_TF_VARS="${KUBE_SIM_TMP}settings/bastion.tfvars"
[[ ! -d ${KUBE_SIM_TMP} ]] && mkdir -pv "${KUBE_SIM_TMP}/settings"
touch "${SIMULATOR_CONFIG_FILE}"
touch "${BASTION_TF_VARS}"
docker pull "${CONTAINER_NAME}"
docker run \
-h launch \
-v "${SIMULATOR_AWS_CREDS_PATH}":/home/launch/.aws \
-v "${KUBE_SIM_TMP}":/home/launch/.kubesim \
-v "${KUBE_SIM_TMP}":/home/launch/.ssh \
-e "AWS_ACCESS_KEY_ID" \
-e "AWS_SECRET_ACCESS_KEY" \
-e "AWS_REGION" \
-e "AWS_DEFAULT_REGION" \
-e "AWS_PROFILE" \
-e "AWS_DEFAULT_PROFILE" \
--rm --init -it ${CONTAINER_NAME}