-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to deploy waggle-dance service on Kubernetes. (#69)
* deploy waggle-dance on Kubernetes * configure 90% memory as heapsize for k8s containers * configure AWS LoadBalancer for k8s service * configure waggle-dance cname * create kubernetes resources when wd_instance_type is k8s * create aws_instance when instance type is ec2 * waggle_dance_dns output * create ssm association only when deployment type is ec2 * add waggle_dance_load_balancers output * clean up ec2 deployment * terraform fmt * disable cloudwatch dashboard and alerts when instance type is not ecs * add k8s_namespace variable * update changelog, disable aws_cloudwatch_log_group when deploying on k8s * remove iam role when deploying to k8s * remove aws_sns_topic when deploying to k8s * fix aws_sns_topic reference * update README.md * disable waggle-dance dns for testing * Revert "disable waggle-dance dns for testing" This reverts commit f3d7ea8. * remove ami_id from README.md * update changelog
- Loading branch information
Showing
16 changed files
with
179 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/** | ||
* Copyright (C) 2018-2019 Expedia Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
*/ | ||
|
||
locals { | ||
heapsize = ceil((var.memory * 90) / 100) | ||
} | ||
resource "kubernetes_deployment" "waggle_dance" { | ||
count = var.wd_instance_type == "k8s" ? 1 : 0 | ||
metadata { | ||
name = "waggle-dance" | ||
namespace = var.k8s_namespace | ||
labels = { | ||
name = "waggle-dance" | ||
} | ||
} | ||
|
||
spec { | ||
replicas = 3 | ||
selector { | ||
match_labels = { | ||
name = "waggle-dance" | ||
} | ||
} | ||
|
||
template { | ||
metadata { | ||
labels = { | ||
name = "waggle-dance" | ||
} | ||
} | ||
|
||
spec { | ||
container { | ||
image = "${var.docker_image}:${var.docker_version}" | ||
name = "waggle-dance" | ||
env { | ||
name = "HEAPSIZE" | ||
value = local.heapsize | ||
} | ||
env { | ||
name = "SERVER_YAML" | ||
value = base64encode(data.template_file.server_yaml.rendered) | ||
} | ||
env { | ||
name = "FEDERATION_YAML" | ||
value = base64encode(data.template_file.federation_yaml.rendered) | ||
} | ||
resources { | ||
limits { | ||
memory = "${var.memory}Mi" | ||
} | ||
requests { | ||
memory = "${var.memory}Mi" | ||
} | ||
} | ||
} | ||
image_pull_secrets { | ||
name = var.k8s_docker_registry_secret | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "kubernetes_service" "waggle_dance" { | ||
count = var.wd_instance_type == "k8s" ? 1 : 0 | ||
metadata { | ||
name = "waggle-dance" | ||
namespace = var.k8s_namespace | ||
annotations = { | ||
"service.beta.kubernetes.io/aws-load-balancer-internal" = "true" | ||
"service.beta.kubernetes.io/aws-load-balancer-type" = "nlb" | ||
} | ||
} | ||
spec { | ||
selector = { | ||
name = "waggle-dance" | ||
} | ||
port { | ||
port = 48869 | ||
target_port = 48869 | ||
} | ||
type = "LoadBalancer" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "waggle_dance_load_balancers" { | ||
value = kubernetes_service.waggle_dance[0].load_balancer_ingress.*.hostname | ||
} |
Oops, something went wrong.