Skip to content

Commit

Permalink
Add k8s deployment resources limits
Browse files Browse the repository at this point in the history
  • Loading branch information
trottomv authored and pauloxnet committed Jan 11, 2023
1 parent 56ea0aa commit 72a391d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ resource "kubernetes_deployment_v1" "main" {
container {
image = var.service_container_image
name = var.service_slug
resources {
requests {
memory = var.service_requests_memory
cpu = var.service_requests_cpu
}
limits {
memory = var.service_limits_memory
cpu = var.service_limits_cpu
}
}
port {
container_port = var.service_container_port
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,32 @@ variable "service_container_port" {
default = ""
}

variable "service_limits_cpu" {
description = "The service limits cpu value."
type = string
}

variable "service_limits_memory" {
description = "The service limits memory value."
type = string
}

variable "service_replicas" {
description = "The desired numbers of replicas to deploy."
type = number
default = 1
}

variable "service_requests_cpu" {
description = "The service requests cpu value."
type = string
}

variable "service_requests_memory" {
description = "The service requests memory value."
type = string
}

variable "service_slug" {
description = "The service slug."
type = string
Expand Down
4 changes: 4 additions & 0 deletions {{cookiecutter.project_dirname}}/terraform/vars/.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
# django_server_email=""
# s3_file_overwrite="False"
# service_container_port="{{ cookiecutter.internal_service_port }}"
service_limits_cpu="225m"
service_limits_memory="256Mi"
# service_replicas=1
service_requests_cpu="25m"
service_requests_memory="115Mi"
# web_concurrency=""

0 comments on commit 72a391d

Please sign in to comment.