Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankorn committed Sep 11, 2019
1 parent 85f8204 commit 3863b4b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Modular Global HTTP Load Balancer for GCE using forwarding rules.

## Usage

```ruby
```HCL
module "gce-lb-http" {
source = "GoogleCloudPlatform/lb-http/google"
name = "group-http-lb"
target_tags = ["${module.mig1.target_tags}", "${module.mig2.target_tags}"]
target_tags = [module.mig1.target_tags, module.mig2.target_tags]
backends = {
"0" = [
{ group = "${module.mig1.instance_group}" },
{ group = "${module.mig2.instance_group}" }
{ group = module.mig1.instance_group },
{ group = module.mig2.instance_group }
],
}
backend_params = [
Expand Down
2 changes: 1 addition & 1 deletion examples/https-gke/gke-node-port/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -x
set -x
set -e

EXP_NAME=$(terraform output port_name)
Expand Down
6 changes: 3 additions & 3 deletions examples/https-gke/test.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash

set -x
set -x
set -e

URL="https://$(terraform output load-balancer-ip)"
status=0
count=0
while [[ $count -lt 720 && $status -ne 200 ]]; do
while [[ ${count} -lt 720 && ${status} -ne 200 ]]; do
echo "INFO: Waiting for load balancer..."
status=$(curl -sfk -m 5 -o /dev/null -w "%{http_code}" "${URL}" || true)
((count=count+1))
sleep 5
done
if [[ $count -lt 720 ]]; then
if [[ ${count} -lt 720 ]]; then
echo "INFO: PASS. Load balancer is ready."
else
echo "ERROR: Failed. Load balancer never became ready."
Expand Down
6 changes: 3 additions & 3 deletions examples/mig-nat-http-lb/test.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash

set -x
set -x
set -e

URL="http://$(terraform output load-balancer-ip)"
status=0
count=0
while [[ $count -lt 720 && $status -ne 200 ]]; do
while [[ ${count} -lt 720 && ${status} -ne 200 ]]; do
echo "INFO: Waiting for load balancer..."
status=$(curl -sf -m 5 -o /dev/null -w "%{http_code}" "${URL}" || true)
((count=count+1))
sleep 5
done
if [[ $count -lt 720 ]]; then
if [[ ${count} -lt 720 ]]; then
echo "INFO: PASS"
else
echo "ERROR: Failed"
Expand Down
12 changes: 6 additions & 6 deletions examples/multi-backend-multi-mig-bucket-https-lb/test.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash

set -x
set -x
set -e

URL="https://$(terraform output load-balancer-ip)"
status=0
count=0
while [[ $count -lt 720 && $status -ne 200 ]]; do
while [[ ${count} -lt 720 && ${status} -ne 200 ]]; do
echo "INFO: Waiting for load balancer..."
status=$(curl -sfk -m 5 -o /dev/null -w "%{http_code}" "${URL}" || true)
((count=count+1))
sleep 5
done
if [[ $count -lt 720 ]]; then
if [[ ${count} -lt 720 ]]; then
echo "INFO: PASS. Load balancer is ready."
else
echo "ERROR: Failed. Load balancer never became ready."
Expand All @@ -23,7 +23,7 @@ function checkPattern() {
local URL=$1
local pattern="$2"
local count=0
while [[ $count -lt 120 ]]; do
while [[ ${count} -lt 120 ]]; do
echo "INFO: Checking ${URL} for text: '$pattern'..."
if curl -sfkL -m 5 "${URL}" | egrep -q "${pattern}"; then
echo "INFO: PASS. Found pattern: '$pattern'"
Expand All @@ -38,10 +38,10 @@ function checkPattern() {
function checkFile() {
local URL=$1
local count=0
while [[ $count -lt 120 ]]; do
while [[ ${count} -lt 120 ]]; do
echo "INFO: Checking ${URL}..."
status=$(curl -sfk -m 5 -o /dev/null -w "%{http_code}" "${URL}" || true)
if [[ $status -eq 200 ]]; then
if [[ ${status} -eq 200 ]]; then
echo "INFO: PASS"
return 0
fi
Expand Down
6 changes: 3 additions & 3 deletions examples/multi-mig-http-lb/test.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash

set -x
set -x
set -e

URL="http://$(terraform output load-balancer-ip)"
status=0
count=0
while [[ $count -lt 720 && $status -ne 200 ]]; do
while [[ ${count} -lt 720 && ${status} -ne 200 ]]; do
echo "INFO: Waiting for load balancer..."
status=$(curl -sf -m 5 -o /dev/null -w "%{http_code}" "${URL}" || true)
((count=count+1))
sleep 5
done
if [[ $count -lt 720 ]]; then
if [[ ${count} -lt 720 ]]; then
echo "INFO: PASS"
else
echo "ERROR: Failed"
Expand Down
10 changes: 5 additions & 5 deletions examples/multiple-certs/test.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash

set -x
set -x
set -e

URL="https://$(terraform output load-balancer-ip)"
status=0
count=0
while [[ $count -lt 720 && $status -ne 200 ]]; do
while [[ ${count} -lt 720 && ${status} -ne 200 ]]; do
echo "INFO: Waiting for load balancer..."
status=$(curl -sfk -m 5 -o /dev/null -w "%{http_code}" "${URL}" || true)
((count=count+1))
sleep 5
done
if [[ $count -lt 720 ]]; then
if [[ ${count} -lt 720 ]]; then
echo "INFO: PASS. Load balancer is ready."
else
echo "ERROR: Failed. Load balancer never became ready."
Expand All @@ -23,7 +23,7 @@ function checkPattern() {
local URL=$1
local pattern="$2"
local count=0
while [[ $count -lt 120 ]]; do
while [[ ${count} -lt 120 ]]; do
echo "INFO: Checking ${URL} for text: '$pattern'..."
if curl -sfkL -m 5 "${URL}" | egrep -q "${pattern}"; then
echo "INFO: PASS. Found pattern: '$pattern'"
Expand All @@ -41,7 +41,7 @@ checkPattern ${URL}/group3 "$(terraform output group3_region)"

status=0
status=$(curl -sfk -m 5 -o /dev/null -w "%{http_code}" "$(terraform output asset-url)" || true)
if [[ $status -eq 200 ]]; then
if [[ ${status} -eq 200 ]]; then
echo "INFO: PASS. Assets served from GCS bucket."
else
echo "ERROR: Failed, could not get asset from bucket."
Expand Down
8 changes: 4 additions & 4 deletions examples/terraform-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ function terraform-install() {
if [[ -z $(grep 'export PATH=${HOME}/bin:${PATH}' ~/.bashrc 2>/dev/null) ]]; then
echo 'export PATH=${HOME}/bin:${PATH}' >> ~/.bashrc
fi

echo "Installed: `${HOME}/bin/terraform version`"
cat - << EOF

cat - << EOF
Run the following to reload your PATH with terraform:
source ~/.bashrc
Expand Down

0 comments on commit 3863b4b

Please sign in to comment.