Skip to content

Commit

Permalink
one-time setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jadarsie committed Apr 21, 2020
1 parent 9b23531 commit a6deb76
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 55 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
INPUT := env/input.env

.PHONY: setup
setup:
.PHONY: setup-dvm
setup-dvm:
scripts/upload.sh $(INPUT)

.PHONY: run
run:
.PHONY: run-dvm
run-dvm:
scripts/run-dvm.sh $(INPUT)

.PHONY: run-local
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
## Run locally

```bash
export INPUT=env/sample.env
make run-local
make run-local INPUT=env/sample.env
```

## Run on DVM

```bash
export INPUT=env/sample.env
make setup
make run
make results
make setup INPUT=env/sample.env
make run INPUT=env/sample.env
make results INPUT=env/sample.env
```
3 changes: 3 additions & 0 deletions env/sample.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CLOUD DETAILS
export IDENTITY_SYSTEM=""
export CLOUD_FQDN=""
export CLOUD_AZCLI_NAME=""
export AZURE_LOCATION=""
export AZURE_CLIENT_ID=""
export AZURE_CLIENT_SECRET=""
Expand All @@ -14,6 +15,8 @@ export CLUSTER_DEFINITION=""
export DEV_IMAGE=""
export AKSE_REPO=""
export AKSE_BRANCH=""
export UPGRADE_FORK=""
export UPGRADE_BRANCH=""
export E2E_TEST_TIMEOUT="30m"
export CLEANUP_ON_EXIT=false
export CLEANUP_IF_FAIL=false
Expand Down
9 changes: 9 additions & 0 deletions hack/akse-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,13 @@ set -o nounset
set -o pipefail
set -o xtrace

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
cd "${REPO_ROOT}" || exit 1

git clone https://github.com/${AKSE_REPO} -b ${AKSE_BRANCH}

if [[ "${OSTYPE}" == "linux-gnu" ]]; then
if sudo test -f "/var/lib/waagent/Certificates.pem"; then
sudo cp /var/lib/waagent/Certificates.pem ${REPO_ROOT}/aks-engine/Certificates.pem
fi
fi
6 changes: 3 additions & 3 deletions hack/cloud-register.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ set -o pipefail
set -o xtrace

register() {
if az cloud list | jq '.[].name' | grep $ENVIRONMENT_NAME; then
if az cloud list | jq '.[].name' | grep $CLOUD_AZCLI_NAME; then
return
fi

VM_IMAGES="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json"

az cloud register \
-n $ENVIRONMENT_NAME \
-n $CLOUD_AZCLI_NAME \
--endpoint-resource-manager $RESOURCE_MANAGER_ENDPOINT \
--endpoint-vm-image-alias-doc $VM_IMAGES \
--suffix-storage-endpoint $STORAGE_ENDPOINT_SUFFIX \
--suffix-keyvault-dns $KEY_VAULT_DNS_SUFFIX
}

register
az cloud set -n $ENVIRONMENT_NAME
az cloud set -n $CLOUD_AZCLI_NAME
az cloud update --profile $API_PROFILE
1 change: 1 addition & 0 deletions hack/cloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ echo export API_PROFILE=\"2019-03-01-hybrid\"
echo export ENVIRONMENT_NAME=\"AzureStackCloud\"
echo export AUTHENTICATION_METHOD=\"client_secret\"
echo export ORCHESTRATOR=\"kubernetes\"
echo export AZURE_ENV=\"AzureStackCloud\"

echo export LOCATION=\"$AZURE_LOCATION\"
echo export REGION_OPTIONS=\"$AZURE_LOCATION\"
Expand Down
3 changes: 0 additions & 3 deletions scripts/setup.sh → hack/e2e-clone.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@ set -o nounset
set -o pipefail
set -o xtrace

sudo apt-get update
sudo apt-get install -y git

git clone https://github.com/jadarsie/e2e-ci-poc -b master
9 changes: 2 additions & 7 deletions hack/ensure-azscert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ set -o nounset
set -o pipefail
set -o xtrace

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..

ensure() {
if sudo test -f "/var/lib/waagent/Certificates.pem"; then
sudo cp /var/lib/waagent/Certificates.pem /usr/local/share/ca-certificates/azsCertificate.crt
sudo update-ca-certificates
sudo cp /var/lib/waagent/Certificates.pem ${REPO_ROOT}/aks-engine/Certificates.pem
fi
sudo cp /var/lib/waagent/Certificates.pem /usr/local/share/ca-certificates/azsCertificate.crt
sudo update-ca-certificates
}

ensure
13 changes: 6 additions & 7 deletions hack/ensure-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ set -o xtrace
installMoby() {
UBUNTU_RELEASE=$(lsb_release -r -s)
curl -s https://packages.microsoft.com/config/ubuntu/${UBUNTU_RELEASE}/prod.list >/tmp/microsoft-prod.list
cp /tmp/microsoft-prod.list /etc/apt/sources.list.d/
sudo cp /tmp/microsoft-prod.list /etc/apt/sources.list.d/
curl -s https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >/tmp/microsoft.gpg
cp /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/
apt-get update
apt-get install -y moby-engine moby-cli
groupadd docker
usermod -aG docker $USER
sudo cp /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/
sudo apt-get update
sudo apt-get install -y moby-engine moby-cli
sudo usermod -aG docker $USER
}

ensure_docker() {
if ! [ -x "$(command -v docker)" ]; then
if [[ "${OSTYPE}" == "linux-gnu" ]]; then
echo "docker not found, installing"
sudo installMoby
installMoby
else
echo "Missing required binary in path: $2"
return 2
Expand Down
6 changes: 3 additions & 3 deletions hack/ensure-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ensure_package() {
}

ensure_package jq jq

# ensure_package python3-pip pip3
# pip3 install -U certifi
ensure_package git git
ensure_package python3-pip pip3
pip3 install -U certifi
# CERT=$(python3 -c "import certifi; print(certifi.where())"); echo $CERT
6 changes: 1 addition & 5 deletions scripts/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ set -o xtrace
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
cd "${REPO_ROOT}" || exit 1

source "${REPO_ROOT}/hack/ensure-packages.sh"
source "${REPO_ROOT}/hack/ensure-docker.sh"
source "${REPO_ROOT}/hack/ensure-azcli.sh"

source "${REPO_ROOT}/hack/akse-clone.sh"
source "${REPO_ROOT}/hack/akse-build.sh"
source "${REPO_ROOT}/hack/ensure-azscert.sh"

source "${REPO_ROOT}/hack/cloud.sh" > env/cloud.env
source "${REPO_ROOT}/env/cloud.env"

source "${REPO_ROOT}/hack/cloud-register.sh"

source "${REPO_ROOT}/hack/akse-e2e.sh"
14 changes: 14 additions & 0 deletions scripts/setup-dvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail
set -o xtrace

git clone https://github.com/jadarsie/e2e-ci-poc -b one-time

REPO_ROOT=e2e-ci-poc
source "${REPO_ROOT}/hack/ensure-packages.sh"
source "${REPO_ROOT}/hack/ensure-docker.sh"
source "${REPO_ROOT}/hack/ensure-azcli.sh"
source "${REPO_ROOT}/hack/ensure-azscert.sh"
4 changes: 2 additions & 2 deletions scripts/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ KNOWN_HOSTS_OPTIONS='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
scp -i ${SSH_PRIVATE_KEY} ${KNOWN_HOSTS_OPTIONS} $1 azureuser@${DVM_HOST}:~/input.env &
wait

scp -i ${SSH_PRIVATE_KEY} ${KNOWN_HOSTS_OPTIONS} ${REPO_ROOT}/scripts/setup.sh azureuser@${DVM_HOST}:~/setup.sh &
scp -i ${SSH_PRIVATE_KEY} ${KNOWN_HOSTS_OPTIONS} ${REPO_ROOT}/scripts/setup-dvm.sh azureuser@${DVM_HOST}:~/setup-dvm.sh &
wait

ssh -q -t -i ${SSH_PRIVATE_KEY} ${KNOWN_HOSTS_OPTIONS} azureuser@${DVM_HOST} "sudo chmod +x ~/setup.sh; ~/setup.sh"
ssh -q -t -i ${SSH_PRIVATE_KEY} ${KNOWN_HOSTS_OPTIONS} azureuser@${DVM_HOST} "sudo chmod +x ~/setup-dvm.sh; ~/setup-dvm.sh"
6 changes: 3 additions & 3 deletions test_clusters/linux-azure-cni.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2",
"distro": "ubuntu"
"distro": "aks-ubuntu-16.04"
},
"agentPoolProfiles": [
{
"name": "linuxpool",
"count": 1,
"count": 2,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet",
"distro": "ubuntu",
"distro": "aks-ubuntu-16.04",
"acceleratedNetworkingEnabled": false
}
],
Expand Down
6 changes: 3 additions & 3 deletions test_clusters/linux-containerd.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2",
"distro": "ubuntu"
"distro": "aks-ubuntu-16.04"
},
"agentPoolProfiles": [
{
"name": "linuxpool",
"count": 1,
"count": 2,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet",
"distro": "ubuntu",
"distro": "aks-ubuntu-16.04",
"acceleratedNetworkingEnabled": false
}
],
Expand Down
6 changes: 3 additions & 3 deletions test_clusters/linux-kubenet.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2",
"distro": "ubuntu"
"distro": "aks-ubuntu-16.04"
},
"agentPoolProfiles": [
{
"name": "linuxpool",
"count": 1,
"count": 2,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet",
"distro": "ubuntu",
"distro": "aks-ubuntu-16.04",
"acceleratedNetworkingEnabled": false
}
],
Expand Down
8 changes: 4 additions & 4 deletions test_clusters/mixed-azure-cni.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2",
"distro": "ubuntu"
"distro": "aks-ubuntu-16.04"
},
"agentPoolProfiles": [
{
"name": "linuxpool",
"count": 1,
"count": 2,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet",
"distro": "ubuntu",
"distro": "aks-ubuntu-16.04",
"acceleratedNetworkingEnabled": false
},
{
"name": "windowspool",
"count": 1,
"count": 2,
"vmSize": "Standard_D2_v2",
"osType": "Windows",
"availabilityProfile": "AvailabilitySet",
Expand Down
4 changes: 2 additions & 2 deletions test_clusters/windows-azure-cni.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2",
"distro": "ubuntu"
"distro": "aks-ubuntu-16.04"
},
"agentPoolProfiles": [
{
"name": "windowspool",
"count": 1,
"count": 2,
"vmSize": "Standard_D2_v2",
"osType": "Windows",
"availabilityProfile": "AvailabilitySet",
Expand Down

0 comments on commit a6deb76

Please sign in to comment.