From 2f4a3df57dc59c5a86751521a5ae07f24ba5bc94 Mon Sep 17 00:00:00 2001 From: Ben Napolitan Date: Thu, 16 Jul 2020 13:54:22 -0400 Subject: [PATCH 1/8] Attempt first bottlerocket test. --- scripts/run-integration-tests.sh | 7 +++++++ testdata/bottlerocket.yaml | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 testdata/bottlerocket.yaml diff --git a/scripts/run-integration-tests.sh b/scripts/run-integration-tests.sh index 0abac20081..9a2806100e 100755 --- a/scripts/run-integration-tests.sh +++ b/scripts/run-integration-tests.sh @@ -19,6 +19,7 @@ ARCH=$(go env GOARCH) : "${DEPROVISION:=true}" : "${BUILD:=true}" : "${RUN_CONFORMANCE:=false}" +: "${RUN_BOTTLEROCKET_TEST:=false}" __cluster_created=0 __cluster_deprovisioned=0 @@ -142,6 +143,12 @@ mkdir -p "$TEST_CONFIG_DIR" if [[ "$PROVISION" == true ]]; then START=$SECONDS + if [[ "$RUN_BOTTLEROCKET_TEST" == true ]]; then + echo "TESTING downloading eksctl" + curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp + sudo mv -v /tmp/eksctl /usr/local/bin + eksctl create cluster --config-file ./testdata/bottlerocket.yaml + fi up-test-cluster UP_CLUSTER_DURATION=$((SECONDS - START)) echo "TIMELINE: Upping test cluster took $UP_CLUSTER_DURATION seconds." diff --git a/testdata/bottlerocket.yaml b/testdata/bottlerocket.yaml new file mode 100644 index 0000000000..ad7c08b2ff --- /dev/null +++ b/testdata/bottlerocket.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: eksctl.io/v1alpha5 +kind: ClusterConfig + +metadata: + name: bottlerocket + region: us-west-2 + version: '1.15' + +nodeGroups: + - name: ng-bottlerocket + instanceType: m5.large + desiredCapacity: 4 + amiFamily: Bottlerocket + iam: + attachPolicyARNs: + - arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy + - arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy + - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly + - arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore + bottlerocket: + settings: + motd: "Hello from eksctl!" From 05b513692e57b0a88a9be8965dca67629f03e365 Mon Sep 17 00:00:00 2001 From: Ben Napolitan Date: Thu, 16 Jul 2020 19:55:01 -0400 Subject: [PATCH 2/8] Increase no output timeout. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 313f810f6b..da8bb249ea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,7 +73,7 @@ jobs: - run: name: Run the integration tests command: ./scripts/run-integration-tests.sh - no_output_timeout: 15m + no_output_timeout: 20m - save_cache: key: dependency-packages-store-{{ checksum "test/integration/go.mod" }} paths: From ccf0a16fc2722d9a0b70ed280f6d4cf402856f48 Mon Sep 17 00:00:00 2001 From: Ben Napolitan Date: Fri, 17 Jul 2020 01:10:56 -0400 Subject: [PATCH 3/8] Fix up test cluster. --- scripts/run-integration-tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/run-integration-tests.sh b/scripts/run-integration-tests.sh index 9a2806100e..002550455d 100755 --- a/scripts/run-integration-tests.sh +++ b/scripts/run-integration-tests.sh @@ -148,8 +148,9 @@ if [[ "$PROVISION" == true ]]; then curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp sudo mv -v /tmp/eksctl /usr/local/bin eksctl create cluster --config-file ./testdata/bottlerocket.yaml + else + up-test-cluster fi - up-test-cluster UP_CLUSTER_DURATION=$((SECONDS - START)) echo "TIMELINE: Upping test cluster took $UP_CLUSTER_DURATION seconds." __cluster_created=1 From 821067fcec8a69f4323a3075daeccce9eb1f2ce4 Mon Sep 17 00:00:00 2001 From: Ben Napolitan Date: Fri, 17 Jul 2020 13:22:23 -0400 Subject: [PATCH 4/8] Attempt bottlerocket test with proper configs. --- scripts/run-integration-tests.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/run-integration-tests.sh b/scripts/run-integration-tests.sh index 69a5a04279..cdcd995ede 100755 --- a/scripts/run-integration-tests.sh +++ b/scripts/run-integration-tests.sh @@ -182,11 +182,14 @@ sed -i'.bak' "s,:$MANIFEST_IMAGE_VERSION,:$TEST_IMAGE_VERSION," "$TEST_CONFIG_PA sed -i'.bak' "s,602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon-k8s-cni-init,$INIT_IMAGE_NAME," "$TEST_CONFIG_PATH" sed -i'.bak' "s,:$MANIFEST_IMAGE_VERSION,:$TEST_IMAGE_VERSION," "$TEST_CONFIG_PATH" -if [[ $RUN_KOPS_TEST != true ]]; then - export KUBECONFIG=$KUBECONFIG_PATH +if [[ $RUN_KOPS_TEST == true || $RUN_BOTTLEROCKET_TEST == true ]]; then + KUBECTL_PATH=kubectl else + export KUBECONFIG=$KUBECONFIG_PATH +fi + +if [[ $RUN_KOPS_TEST == true ]]; then run_kops_conformance - KUBECTL_PATH=kubectl fi ADDONS_CNI_IMAGE=$($KUBECTL_PATH describe daemonset aws-node -n kube-system | grep Image | cut -d ":" -f 2-3 | tr -d '[:space:]') From d82b0de04f1dda2114208d62ea0695f7f0ee5b38 Mon Sep 17 00:00:00 2001 From: Ben Napolitan Date: Fri, 17 Jul 2020 15:02:48 -0400 Subject: [PATCH 5/8] Retry bottlerocket with kubeconfig. --- scripts/run-integration-tests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/run-integration-tests.sh b/scripts/run-integration-tests.sh index cdcd995ede..773a82fcf6 100755 --- a/scripts/run-integration-tests.sh +++ b/scripts/run-integration-tests.sh @@ -184,6 +184,7 @@ sed -i'.bak' "s,:$MANIFEST_IMAGE_VERSION,:$TEST_IMAGE_VERSION," "$TEST_CONFIG_PA if [[ $RUN_KOPS_TEST == true || $RUN_BOTTLEROCKET_TEST == true ]]; then KUBECTL_PATH=kubectl + export KUBECONFIG=~/.kube/config else export KUBECONFIG=$KUBECONFIG_PATH fi From 57089ad3d48074a4740d1cdd17c14d22f9cd9d3d Mon Sep 17 00:00:00 2001 From: Ben Napolitan Date: Fri, 17 Jul 2020 15:06:20 -0400 Subject: [PATCH 6/8] Delete cluster on fail. --- scripts/run-integration-tests.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/run-integration-tests.sh b/scripts/run-integration-tests.sh index 773a82fcf6..1c11bd158c 100755 --- a/scripts/run-integration-tests.sh +++ b/scripts/run-integration-tests.sh @@ -30,13 +30,15 @@ on_error() { # Make sure we destroy any cluster that was created if we hit run into an # error when attempting to run tests against the cluster if [[ $__cluster_created -eq 1 && $__cluster_deprovisioned -eq 0 && "$DEPROVISION" == true ]]; then + echo "Cluster was provisioned already. Deprovisioning it..." + __cluster_deprovisioned=1 if [[ $RUN_KOPS_TEST == true ]]; then - __cluster_deprovisioned=1 echo "Cluster was provisioned already. Deprovisioning it..." down-kops-cluster + elif [[ $RUN_BOTTLEROCKET_TEST == true ]]; then + eksctl delete cluster bottlerocket else # prevent double-deprovisioning with ctrl-c during deprovisioning... - __cluster_deprovisioned=1 echo "Cluster was provisioned already. Deprovisioning it..." down-test-cluster fi From 61ede1c92e10d624476d60fa11c35ecf32bda715 Mon Sep 17 00:00:00 2001 From: Ben Napolitan Date: Fri, 17 Jul 2020 16:14:30 -0400 Subject: [PATCH 7/8] Remove erroneous 'fi'. --- scripts/run-integration-tests.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/run-integration-tests.sh b/scripts/run-integration-tests.sh index 1c11bd158c..d4f7cf339a 100755 --- a/scripts/run-integration-tests.sh +++ b/scripts/run-integration-tests.sh @@ -259,7 +259,6 @@ if [[ "$DEPROVISION" == true ]]; then down-kops-cluster elif [[ "$RUN_BOTTLEROCKET_TEST" == true ]]; then eksctl delete cluster bottlerocket - fi else down-test-cluster fi From 56a9817235633573a6a8d0977fb83c2e95146e02 Mon Sep 17 00:00:00 2001 From: Ben Napolitan Date: Tue, 21 Jul 2020 12:25:12 -0400 Subject: [PATCH 8/8] Move into ensure_eksctl, remove extra flag set. --- scripts/lib/aws.sh | 5 +++++ scripts/run-integration-tests.sh | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/lib/aws.sh b/scripts/lib/aws.sh index cb74a10925..29ce6066d3 100644 --- a/scripts/lib/aws.sh +++ b/scripts/lib/aws.sh @@ -26,3 +26,8 @@ ensure_aws_k8s_tester() { chmod +x $TESTER_PATH fi } + +ensure_eksctl() { + curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp + sudo mv -v /tmp/eksctl /usr/local/bin +} diff --git a/scripts/run-integration-tests.sh b/scripts/run-integration-tests.sh index d4f7cf339a..6ffc15cdba 100755 --- a/scripts/run-integration-tests.sh +++ b/scripts/run-integration-tests.sh @@ -157,9 +157,7 @@ START=$SECONDS if [[ "$PROVISION" == true ]]; then START=$SECONDS if [[ "$RUN_BOTTLEROCKET_TEST" == true ]]; then - echo "TESTING downloading eksctl" - curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp - sudo mv -v /tmp/eksctl /usr/local/bin + ensure_eksctl eksctl create cluster --config-file ./testdata/bottlerocket.yaml elif [[ "$RUN_KOPS_TEST" == true ]]; then up-kops-cluster @@ -168,7 +166,6 @@ if [[ "$PROVISION" == true ]]; then fi UP_CLUSTER_DURATION=$((SECONDS - START)) echo "TIMELINE: Upping test cluster took $UP_CLUSTER_DURATION seconds." - __cluster_created=1 fi __cluster_created=1