From d9c63b3709ba2208b61f23ba07cccabaf35cff56 Mon Sep 17 00:00:00 2001 From: Anders Larsson Date: Fri, 16 Mar 2018 09:19:11 +0100 Subject: [PATCH 1/6] checks md5-sum before up and download --- bin/image-create-openstack.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/bin/image-create-openstack.sh b/bin/image-create-openstack.sh index 1af8f93f..e047afd2 100755 --- a/bin/image-create-openstack.sh +++ b/bin/image-create-openstack.sh @@ -30,6 +30,33 @@ image_id="$(printf '%s' "$image_list" | awk -F "|" '{print $2;}' | tr -d '[:space:]')" +# If it did exist then check md5sum +if [ -n "$image_id" ]; then + # Get checksum of image file + image_details="$(glance image-show "$image_id")" + checksum="$(printf '%s' "$image_details" | + grep -w "checksum" | + awk -F "|" '{print $3;}' | + tr -d '[:space:]')" + + # Get checksum of bucket image + echo "Download md5 sum file" + curl "$KN_IMAGE_BUCKET_URL/$file_name.md5" \ + -o "/tmp/$file_name.md5" \ + --connect-timeout 30 \ + --max-time 1800 + + md5only=$(cut -f1 -d ' ' "/tmp/$file_name.md5") + if [ "$md5only" != "$checksum" ]; then + # try to delete image + echo "Wrong checksum, - deleting old version of image" + glance image-delete "$image_id" + image_id="" + else + echo "Checksum OK" + fi +fi + # If it doesn't exist then download it if [ -z "$image_id" ]; then echo "Image not present in OpenStack" @@ -64,6 +91,8 @@ if [ -z "$image_id" ]; then --progress else echo "file exists - no need to upload" + echo "this version skips md5 verification - exit here" + exit 0 fi echo "Verify md5 of present/uploaded image..." From 5cd7091d9e3e2288de13b0476a318685ea4e2646 Mon Sep 17 00:00:00 2001 From: Anders Larsson Date: Fri, 16 Mar 2018 11:23:04 +0100 Subject: [PATCH 2/6] fix image upload on OpenStack so it only uploads image if it doesn't exist --- bin/image-create-openstack.sh | 94 ++++++++++++++--------------------- 1 file changed, 37 insertions(+), 57 deletions(-) diff --git a/bin/image-create-openstack.sh b/bin/image-create-openstack.sh index e047afd2..c89f4769 100755 --- a/bin/image-create-openstack.sh +++ b/bin/image-create-openstack.sh @@ -30,71 +30,51 @@ image_id="$(printf '%s' "$image_list" | awk -F "|" '{print $2;}' | tr -d '[:space:]')" -# If it did exist then check md5sum +# If it exist then exit here if [ -n "$image_id" ]; then - # Get checksum of image file - image_details="$(glance image-show "$image_id")" - checksum="$(printf '%s' "$image_details" | - grep -w "checksum" | - awk -F "|" '{print $3;}' | - tr -d '[:space:]')" - - # Get checksum of bucket image - echo "Download md5 sum file" - curl "$KN_IMAGE_BUCKET_URL/$file_name.md5" \ - -o "/tmp/$file_name.md5" \ - --connect-timeout 30 \ - --max-time 1800 - - md5only=$(cut -f1 -d ' ' "/tmp/$file_name.md5") - if [ "$md5only" != "$checksum" ]; then - # try to delete image - echo "Wrong checksum, - deleting old version of image" - glance image-delete "$image_id" - image_id="" - else - echo "Checksum OK" - fi + echo "file exists - no need to upload, exit image-upload script" + exit 0 fi # If it doesn't exist then download it -if [ -z "$image_id" ]; then - echo "Image not present in OpenStack" - echo "Downloading image to local /tmp/" - curl "$KN_IMAGE_BUCKET_URL/$file_name" \ - -o "/tmp/$file_name" \ - --connect-timeout 30 \ - --max-time 1800 - - echo "Download md5 sum file" - curl "$KN_IMAGE_BUCKET_URL/$file_name.md5" \ - -o "/tmp/$file_name.md5" \ - --connect-timeout 30 \ - --max-time 1800 - - echo "Check md5 sum" - md5only=$(cut -f1 -d ' ' "/tmp/$file_name.md5") - printf '%s' "$md5only /tmp/$file_name" | md5sum -c -else - echo "File exists - no need to download" -fi +echo "Image not present in OpenStack" +echo "Downloading image to local /tmp/" +curl "$KN_IMAGE_BUCKET_URL/$file_name" \ + -o "/tmp/$file_name" \ + --connect-timeout 30 \ + --max-time 1800 -# If it didn't exist then upload it -if [ -z "$image_id" ]; then - echo "Uploading image" - glance image-create \ - --file "/tmp/$file_name" \ - --disk-format qcow2 \ - --min-disk 20 \ - --container-format bare \ - --name "$KN_IMAGE_NAME" \ - --progress +echo "Download md5 sum file" +curl "$KN_IMAGE_BUCKET_URL/$file_name.md5" \ + -o "/tmp/$file_name.md5" \ + --connect-timeout 30 \ + --max-time 1800 + +# Verify md5sum of downloaded file +echo "Check md5 sum" +md5result=$( + cd /tmp + md5sum -c "$file_name.md5" +) +if [[ "$md5result" != *": OK"* ]]; then + echo >&2 "Wrong checksum of downloaded image." + echo >&2 "Something might have failed on file transfer." + echo >&2 "Please try again." + exit 1 else - echo "file exists - no need to upload" - echo "this version skips md5 verification - exit here" - exit 0 + echo "Checksum of downloaded image OK" fi +# Upload image +echo "Uploading image" +glance image-create \ + --file "/tmp/$file_name" \ + --disk-format qcow2 \ + --min-disk 20 \ + --container-format bare \ + --name "$KN_IMAGE_NAME" \ + --progress + echo "Verify md5 of present/uploaded image..." echo "List images available in OpenStack..." image_list="$(glance image-list)" From 6818b023c19f1f92d296a91fae428e90b42dd403 Mon Sep 17 00:00:00 2001 From: Anders Larsson Date: Fri, 16 Mar 2018 16:27:29 +0100 Subject: [PATCH 3/6] reverted image version on aws and openstack --- templates/terraform.tfvars.aws-template | 2 +- templates/terraform.tfvars.openstack-template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/terraform.tfvars.aws-template b/templates/terraform.tfvars.aws-template index 7a53f0fa..e543f13b 100644 --- a/templates/terraform.tfvars.aws-template +++ b/templates/terraform.tfvars.aws-template @@ -4,7 +4,7 @@ cluster_prefix = "your-cluster-prefix" # Your cluster prefix kubeadm_token = "your-kubeadm-token" # Autogenerated kubeadm token (don't change it) aws_region = "eu-west-1" # Some region availability_zone = "eu-west-1a" # Some availability zone -boot_image = "kubenow-v050" +boot_image = "kubenow-v050b1" # Credentials aws_access_key_id = "your-acces-key-id" diff --git a/templates/terraform.tfvars.openstack-template b/templates/terraform.tfvars.openstack-template index 33d8744d..f540572b 100644 --- a/templates/terraform.tfvars.openstack-template +++ b/templates/terraform.tfvars.openstack-template @@ -4,7 +4,7 @@ cluster_prefix = "your-cluster-prefix" # Your cluster prefix kubeadm_token = "your-kubeadm-token" # Autogenerated kubeadm token (don't change it) floating_ip_pool = "your-pool-name" external_network_uuid = "external-net-uuid" # The uuid of the external network in the OpenStack tenancy -boot_image = "kubenow-v050" +boot_image = "kubenow-v050b1" # Master configuration # obs: too small flavors might cause diffuse errors on your installation From 9820e167f9b7af0035659a021271b7b1d6af6e88 Mon Sep 17 00:00:00 2001 From: Anders Larsson Date: Fri, 23 Mar 2018 18:05:52 +0100 Subject: [PATCH 4/6] back to image version kubenow-v050 --- templates/terraform.tfvars.aws-template | 2 +- templates/terraform.tfvars.openstack-template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/terraform.tfvars.aws-template b/templates/terraform.tfvars.aws-template index e543f13b..7a53f0fa 100644 --- a/templates/terraform.tfvars.aws-template +++ b/templates/terraform.tfvars.aws-template @@ -4,7 +4,7 @@ cluster_prefix = "your-cluster-prefix" # Your cluster prefix kubeadm_token = "your-kubeadm-token" # Autogenerated kubeadm token (don't change it) aws_region = "eu-west-1" # Some region availability_zone = "eu-west-1a" # Some availability zone -boot_image = "kubenow-v050b1" +boot_image = "kubenow-v050" # Credentials aws_access_key_id = "your-acces-key-id" diff --git a/templates/terraform.tfvars.openstack-template b/templates/terraform.tfvars.openstack-template index f540572b..33d8744d 100644 --- a/templates/terraform.tfvars.openstack-template +++ b/templates/terraform.tfvars.openstack-template @@ -4,7 +4,7 @@ cluster_prefix = "your-cluster-prefix" # Your cluster prefix kubeadm_token = "your-kubeadm-token" # Autogenerated kubeadm token (don't change it) floating_ip_pool = "your-pool-name" external_network_uuid = "external-net-uuid" # The uuid of the external network in the OpenStack tenancy -boot_image = "kubenow-v050b1" +boot_image = "kubenow-v050" # Master configuration # obs: too small flavors might cause diffuse errors on your installation From 15dbf32adeab0c286103fcc3dd53abb9f956b5f4 Mon Sep 17 00:00:00 2001 From: Anders Larsson Date: Sat, 24 Mar 2018 11:28:35 +0100 Subject: [PATCH 5/6] add forgotten subdomain variable in azure template --- templates/terraform.tfvars.azure-template | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/terraform.tfvars.azure-template b/templates/terraform.tfvars.azure-template index a9dbcc99..99822a40 100644 --- a/templates/terraform.tfvars.azure-template +++ b/templates/terraform.tfvars.azure-template @@ -33,6 +33,7 @@ node_vm_size = "Standard_DS2_v2" # cloudflare_email = "your-cloudflare-email" # cloudflare_token = "your-cloudflare-token" # cloudflare_domain = "your-domain-name" +# cloudflare_subdomain = "your-subdomain-name" # Cloudflare proxy (optional) # cloudflare_proxied = "true" From ccf0adf0451982606fdaff1a60d311db9da39ff8 Mon Sep 17 00:00:00 2001 From: Anders Larsson Date: Sat, 24 Mar 2018 11:31:14 +0100 Subject: [PATCH 6/6] add test url in ansible task name --- playbooks/roles/traefik-test/tasks/test-page.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/roles/traefik-test/tasks/test-page.yml b/playbooks/roles/traefik-test/tasks/test-page.yml index 7a94385c..bd6c1762 100644 --- a/playbooks/roles/traefik-test/tasks/test-page.yml +++ b/playbooks/roles/traefik-test/tasks/test-page.yml @@ -1,5 +1,5 @@ --- -- name: "test endpoint" +- name: "test endpoint: http://{{cheese}}.{{cheese_domain_name}}" command: > curl --silent --head -H "host: {{cheese}}.{{cheese_domain_name}}" @@ -9,7 +9,7 @@ retries: 5 delay: 30 -- name: "test page" +- name: "test page: http://{{cheese}}.{{cheese_domain_name}}" action: > uri url=http://{{cheese}}.{{cheese_domain_name}}