Skip to content

Commit

Permalink
tests/e2e.sh: Adjust to new Makefile target
Browse files Browse the repository at this point in the history
* DRY on image name

* Enable e2e testing possibility on other architectures as well

* Replace correct image name in manifest

* Don't build binary anymore, it's now included in the image build
  process

Signed-off-by: Manuel Rüger <[email protected]>
  • Loading branch information
mrueg committed Jul 30, 2020
1 parent 07b5d0c commit c9d367c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@
set -e
set -o pipefail

case $(uname -m) in
aarch64) ARCH="arm64";;
x86_64) ARCH="amd64";;
*) ARCH="$(uname -m)";;
esac

KUBERNETES_VERSION=v1.18.1
KUBE_STATE_METRICS_LOG_DIR=./log
KUBE_STATE_METRICS_IMAGE_NAME='quay.io/coreos/kube-state-metrics'
KUBE_STATE_METRICS_IMAGE_NAME="quay.io/coreos/kube-state-metrics-${ARCH}"
E2E_SETUP_MINIKUBE=${E2E_SETUP_MINIKUBE:-}
E2E_SETUP_KUBECTL=${E2E_SETUP_KUBECTL:-}
MINIKUBE_VERSION=v1.8.1
Expand All @@ -41,13 +47,13 @@ function finish() {
}

function setup_minikube() {
curl -sLo minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-"${OS}"-amd64 \
curl -sLo minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-"${OS}"-"${ARCH}" \
&& chmod +x minikube \
&& ${SUDO} mv minikube /usr/local/bin/
}

function setup_kubectl() {
curl -sLo kubectl https://storage.googleapis.com/kubernetes-release/release/"$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)"/bin/"${OS}"/amd64/kubectl \
curl -sLo kubectl https://storage.googleapis.com/kubernetes-release/release/"$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)"/bin/"${OS}"/"${ARCH}"/kubectl \
&& chmod +x kubectl \
&& ${SUDO} mv kubectl /usr/local/bin/
}
Expand Down Expand Up @@ -104,20 +110,17 @@ set -e

kubectl version

# Build binary
make build

# ensure that we build docker image in minikube
[[ "$MINIKUBE_DRIVER" != "none" ]] && eval "$(minikube docker-env --profile="${MINIKUBE_PROFILE_ARG}")" && export DOCKER_CLI='docker'

# query kube-state-metrics image tag
make container
docker images -a
KUBE_STATE_METRICS_IMAGE_TAG=$(docker images -a|grep 'quay.io/coreos/kube-state-metrics'|grep -v 'latest'|awk '{print $2}'|sort -u)
KUBE_STATE_METRICS_IMAGE_TAG=$(docker images -a|grep "${KUBE_STATE_METRICS_IMAGE_NAME}" |grep -v 'latest'|awk '{print $2}'|sort -u)
echo "local kube-state-metrics image tag: $KUBE_STATE_METRICS_IMAGE_TAG"

# update kube-state-metrics image tag in deployment.yaml
sed -i.bak "s|${KUBE_STATE_METRICS_IMAGE_NAME}:v.*|${KUBE_STATE_METRICS_IMAGE_NAME}:${KUBE_STATE_METRICS_IMAGE_TAG}|g" ./examples/standard/deployment.yaml
sed -i.bak "s|${KUBE_STATE_METRICS_IMAGE_NAME%-*}:v.*|${KUBE_STATE_METRICS_IMAGE_NAME}:${KUBE_STATE_METRICS_IMAGE_TAG}|g" ./examples/standard/deployment.yaml
cat ./examples/standard/deployment.yaml

trap finish EXIT
Expand Down

0 comments on commit c9d367c

Please sign in to comment.