Skip to content

Commit

Permalink
add aws integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Capuccini committed Jan 13, 2017
1 parent f3f1861 commit 5a58b71
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ install:
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg |
sudo apt-key add -
- sudo apt-get update && sudo apt-get install google-cloud-sdk
# Install AWS deps
- sudo pip install awscli

# TEST ENV LOGIN
# Source CityCloud RC file
Expand All @@ -76,7 +78,10 @@ install:
- >
gcloud auth login [email protected]
--project phenomenal-1145 -q
# AWS login
- source test/secrets-kubenow/host_cloud/aws.sh

script:
- ansible-playbook -e "host_cloud=openstack" test/integration-test.yml
- ansible-playbook -e "host_cloud=gce" test/integration-test.yml
- ansible-playbook -e "host_cloud=aws" test/integration-test.yml
6 changes: 3 additions & 3 deletions docs/getting_started/bootstrap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,19 @@ Start by creating a ``terraform.tfvars`` file. There is a template that you can

**Master configuration**

- **master_instance_type**: an instance type for the master (e.g. ``t2.micro``)
- **master_instance_type**: an instance type for the master (e.g. ``t2.medium``)
- **master_disk_size**: edges disk size in GB

**Node configuration**

- **node_count**: number of Kubernetes nodes to be created
- **node_instance_type**: an instance type for the Kubernetes nodes (e.g. ``t2.micro``)
- **node_instance_type**: an instance type for the Kubernetes nodes (e.g. ``t2.medium``)
- **node_disk_size**: edges disk size in GB

**Edge configuration**

- **edge_count**: number of egde nodes to be created
- **edge_instance_type**: an instance type for the edge nodes (e.g. ``t2.micro``)
- **edge_instance_type**: an instance type for the edge nodes (e.g. ``t2.medium``)
- **edge_disk_size**: edges disk size in GB

Once you are done with your settings you are ready to bootstrap the cluster using Terraform::
Expand Down
6 changes: 3 additions & 3 deletions terraform.tfvars.aws-template
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ aws_access_key_id = "your-acces-key-id"
aws_secret_access_key = "your-secret-access-key"

# Master configuration
master_instance_type = "t2.micro"
master_instance_type = "t2.medium"
master_disk_size = "10" # Size in GB

# Node configuration
node_count = "3"
node_instance_type = "t2.micro"
node_instance_type = "t2.medium"
node_disk_size = "10" # Size in GB

# Edge configuration
edge_count = "2"
edge_instance_type = "t2.micro"
edge_instance_type = "t2.medium"
edge_disk_size = "10" # Size in GB
14 changes: 14 additions & 0 deletions test/roles/test-packer/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,17 @@
gcloud compute images delete
'kubenow-{{current_version}}' -q
when: host_cloud == "gce"

- name: "deregister packer image (aws)"
listen: "delete image"
command: >
aws ec2 deregister-image
--image-id {{aws_ami_id}}
when: host_cloud == "aws"

- name: "delete packer snapshot (aws)"
listen: "delete image"
command: >
aws ec2 delete-snapshot
--snapshot-id {{aws_snap_id}}
when: host_cloud == "aws"
21 changes: 21 additions & 0 deletions test/roles/test-packer/tasks/get_ami_facts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- name: "get AMI id"
shell: >
aws ec2 describe-images --owners self
--query 'Images[*].{ID:ImageId}'
--filters "Name=name,Values=kubenow-{{current_version}}" |
grep -Eo "(?i)\\b[a-z]+-[a-z0-9]+"
register: get_ami_id

- set_fact:
aws_ami_id: "{{get_ami_id.stdout | replace('\n','')}}"

- name: "get AMI snapshot id"
shell: >
aws ec2 describe-images --owners self
--query 'Images[*].BlockDeviceMappings[*].Ebs.SnapshotId'
--filters "Name=name,Values=kubenow-{{current_version}}" |
grep -Eo "(?i)\\b[a-z]+-[a-z0-9]+"
register: get_snap_id

- set_fact:
aws_snap_id: "{{get_snap_id.stdout | replace('\n','')}}"
3 changes: 3 additions & 0 deletions test/roles/test-packer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
args:
chdir: "{{playbook_dir}}/.."
notify: "delete image"

- include: get_ami_facts.yml
when: host_cloud == "aws"
2 changes: 1 addition & 1 deletion test/secrets-kubenow

0 comments on commit 5a58b71

Please sign in to comment.