Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fargate ha consul cluster backed by efs #139

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fdr2
Copy link

@fdr2 fdr2 commented Nov 8, 2022

Changes proposed in this PR:

  • add an additional module implementing consul on ecs backed by efs storage
  • add a load test for consul kv

How I've tested this PR:

After building consul with PR: 13782 to support ECS for Go Discover, create a variables file as described within the README.md to point your consul image variable at the image url for the image you have built (until consul is updated with the necessary go-discover version).

How I expect reviewers to test this PR:

Using the example ha-cluster-fargate, create ca and certs, deploy resources to AWS and load test.

Checklist:

  • Tests added
  • CHANGELOG entry added
  • Tag @pglass for visibility

Copy link

@pglass pglass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fdr2. I've (finally) taken an initial pass through this, but have not reviewed everything.

Thank you so much for doing this!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to add only one additional module at the top of the modules/ directory for deploying a consul server cluster.

I'd suggest the following:

  • Move both ecs-service and efs-cluster modules to be submodules of the ha-cluster module
    • Move modules/ecs-service to modules/ha-cluster/ecs-service
    • Move modules/efs-cluster to modules/ha-cluster/efs-cluster
  • Rename modules/ha-cluster to modules/dev-server-ha (or modules/dev-server-cluster) to better fit alongside the existing modules/dev-server module

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stated in another comment, but please rename this module to modules/dev-server-ha (or modules/dev-server-cluster or similar) to better fit alongside the existing modules/dev-server module, and indicate that the module is for dev/testing and not (yet) for production use.

Comment on lines +1 to +13
# ---------------------------------------------------------------------------------------------------------------------
# ENVIRONMENT VARIABLES
# Define these secrets as environment variables
# ---------------------------------------------------------------------------------------------------------------------

# AWS_ACCESS_KEY_ID
# AWS_SECRET_ACCESS_KEY
# AWS_DEFAULT_REGION

# ---------------------------------------------------------------------------------------------------------------------
# OPTIONAL PARAMETERS
# These parameters have reasonable defaults.
# ---------------------------------------------------------------------------------------------------------------------
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest removing these comments. Instead, we should update the README with any requirements for using this module.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this lambda-k6 module out of the modules directory. I'd suggest either examples/lambda-k6 or test/performance/lambda-k6 for the new location.

}

variable "operating_system_family" {
default = "LINUX"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add type = string.

containerPort : 8502,
hostPort : 8502,
protocol : "tcp"
}, {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice you have ports.grpc_tls = 8503 above, so probably add 8503 to the list of container ports here for consistency. (Note that ports.grpc_tls is only supported in Consul 1.14+)

consul_portmap = [{
containerPort : 8300,
hostPort : 8300,
protocol : "tcp"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Please remove the hostPort field from these port mappings. We only support the awsvpc network mode for our other modules, so we can assume the same here (for now). In awsvpc network mode, the host port cannot be different than the container port, so I'd prefer to leave the field out (similar to the dev-server module)

default = ""
}

variable "sidecar_name" {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sidecar_name variable appears to be unused? Can it be removed?

Comment on lines +121 to +129
variable "datadog_task_cpu" {
description = "Set the Consul Server task CPU limit. Default is 1792."
default = 256
}

variable "datadog_task_memory" {
description = "Set the Consul Server container Memory limit. Default is 3584."
default = 512
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the datadog specific functionality.

Instead, we can support generic variables, like additional_container_definitions, additional_task_role_policies, etc, in order to inject an additional container into the task definition. That way we can support any kind of additional "sidecar" container.


variable "consul_count" {
description = "Number of consul servers to deploy. Default 3"
default = 3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor / non-blocking: Validate the consul_count is odd and greater than 0. Something like the following:

Suggested change
default = 3
default = 3
validation {
error_message = "The consul_count must be odd and must be greater than 0."
condition = var.consul_count % 2 == 1 && var.consul_count > 0
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants