Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 1b54036

Browse files
author
Patrick Baxter
authored
Merge pull request #574 from pbx0/script
add conformance script shim for terraform setup
2 parents 0e92bf6 + 5b3ed8a commit 1b54036

File tree

5 files changed

+53
-6
lines changed

5 files changed

+53
-6
lines changed

hack/terraform-quickstart/main.tf

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,52 @@ provider "aws" {
66

77
resource "aws_instance" "bootstrap_node" {
88
ami = "${data.aws_ami.coreos_ami.image_id}"
9-
instance_type = "m3.medium"
9+
instance_type = "${var.instance_type}"
1010
key_name = "${var.ssh_key}"
1111
iam_instance_profile = "${aws_iam_instance_profile.bk_profile.id}"
1212

1313
tags {
1414
Name = "${var.instance_tags}"
1515
}
16+
17+
root_block_device {
18+
volume_type = "gp2"
19+
volume_size = "30"
20+
}
1621
}
1722

1823
resource "aws_instance" "worker_node" {
1924
ami = "${data.aws_ami.coreos_ami.image_id}"
20-
instance_type = "m3.medium"
25+
instance_type = "${var.instance_type}"
2126
key_name = "${var.ssh_key}"
2227
count = "${var.num_workers}"
2328
iam_instance_profile = "${aws_iam_instance_profile.bk_profile.id}"
2429

2530
tags {
2631
Name = "${var.instance_tags}"
2732
}
33+
34+
root_block_device {
35+
volume_type = "gp2"
36+
volume_size = "30"
37+
}
2838
}
2939

3040
resource "aws_instance" "master_node" {
3141
ami = "${data.aws_ami.coreos_ami.image_id}"
32-
instance_type = "m3.medium"
42+
instance_type = "${var.instance_type}"
3343
key_name = "${var.ssh_key}"
3444
count = "${var.additional_masters}"
3545
iam_instance_profile = "${aws_iam_instance_profile.bk_profile.id}"
3646

3747
tags {
3848
Name = "${var.instance_tags}"
3949
}
50+
51+
root_block_device {
52+
volume_type = "gp2"
53+
volume_size = "30"
54+
}
4055
}
4156

4257
data "aws_ami" "coreos_ami" {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# This is a small shim to run the conformance runner script in
5+
# /hack/tests/conformance-test.sh. More option defaults such as
6+
# CONFORMANCE_VERSION are set in that script. If the SSH key you use to
7+
# access the nodes setup by terraform is not available via the ssh agent then
8+
# you must specify which keyfile to use.
9+
10+
export BOOTSTRAP_IP=`terraform output bootstrap_node_ip`
11+
export KUBECONFIG=/etc/kubernetes/kubeconfig
12+
export SSH_KEY_FILE=${SSH_KEY_FILE:-/fake/keyfile/have/agent}
13+
14+
cd ../tests
15+
./conformance-test.sh $BOOTSTRAP_IP 22 ${SSH_KEY_FILE}
16+

hack/terraform-quickstart/start-cluster.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ export WORKER_IPS=`terraform output -json worker_ips | jq -r '.value[]'`
66
export MASTER_IPS=`terraform output -json master_ips | jq -r '.value[]'`
77
export SELF_HOST_ETCD=`terraform output self_host_etcd`
88
export SSH_OPTS=${SSH_OPTS:-}" -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
9-
export CLOUD_PROVIDER=aws
9+
export CLOUD_PROVIDER=${CLOUD_PROVIDER:-aws}
10+
11+
# Normally we want to default to aws here since that is all terraform
12+
# supports and it is required for the e2e tests. However because of an
13+
# upstream bug, conformance tests won't pass with cloud provider integration
14+
# set to aws. So we need a knob to set the CLOUD_PROVIDER to nothing while
15+
# keeping aws as the default as to not mess up people using the e2e tests.
16+
if [ "$CLOUD_PROVIDER" == "none" ] ; then
17+
echo "cloud provider integration disabled"
18+
CLOUD_PROVIDER=
19+
fi
1020

1121
cd ../quickstart
1222
./init-master.sh $BOOTSTRAP_IP

hack/terraform-quickstart/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ variable "instance_tags" {
1616
type = "string"
1717
}
1818

19+
variable "instance_type" {
20+
description = "Name all instances behind a single tag based on who/what is running terraform"
21+
type = "string"
22+
default = "m3.medium"
23+
}
24+
1925
variable "self_host_etcd" {
2026
type = "string"
2127
default = "true"

hack/tests/conformance-test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ssh_key=$3
2222

2323
KUBECONFIG=${KUBECONFIG:-/home/core/cluster/auth/kubeconfig}
2424
K8S_SRC=/home/core/go/src/k8s.io/kubernetes
25-
ssh -q -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} \
25+
ssh -q -o UserKnownHostsFile=/dev/null -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} \
2626
"mkdir -p ${K8S_SRC} && [[ -d ${K8S_SRC}/.git ]] || git clone https://${CONFORMANCE_REPO} ${K8S_SRC}"
2727

2828
RKT_OPTS="\
@@ -45,4 +45,4 @@ CONFORMANCE="\
4545
-v --test -check_version_skew=false --test_args='--ginkgo.focus=\[Conformance\]'"
4646

4747
CMD="sudo rkt run --insecure-options=image ${RKT_OPTS} docker://golang:1.7.5 --exec /bin/bash -- -c \"${INIT} && ${BUILD} && ${CONFORMANCE}\""
48-
ssh -q -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} "${CMD}"
48+
ssh -q -o UserKnownHostsFile=/dev/null -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} "${CMD}"

0 commit comments

Comments
 (0)