nuuday/terraform-aws-eks-addons

Uniform way of declaring resource requests

Closed this issue · 5 comments

Instead of having two variables for accepting resource requests for pods, perhaps we could come up with another way.

Instead of

variable "resource_requests_cpu" {
  type = number
}

variable "resource_requests_memory" {
  type = number
}

then something like

variable "resource_requests" {
  type = map(number)
  default = {
    cpu = 100
    memory = 100
  }
}

I think it is a great idea.

We can actually go a bit further with the type annotation and validate the object keys too

variable "resource_requests" {
  type = object({
    cpu    = number
    memory = number
  })  

  default = { 
    cpu    = 100 
    memory = 100 
  }
}

cc @wolffberg

How would you suggest we define limits, cpu should be optional and omittet if not set

IMO our add-ons must define, although low, default resource requests. Otherwise they'll get their QoS classified as best effort, which we probably don't want for components we consider "must-haves".

I agree, requests must always be set, however in some cases it could make sense not to set cpu limit.