Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

builtin/k8s: Allow for defined resource limits for pods #1041

Merged
merged 3 commits into from
Jan 29, 2021

Conversation

briancain
Copy link
Member

This pull request introduces the ability to define resource limits for pods during deployment.

Tested with https://github.com/hashicorp/waypoint-examples/tree/main/kubernetes/nodejs

diff --git a/kubernetes/nodejs/waypoint.hcl b/kubernetes/nodejs/waypoint.hcl
index d3eb818..67ef4da 100644
--- a/kubernetes/nodejs/waypoint.hcl
+++ b/kubernetes/nodejs/waypoint.hcl
@@ -20,6 +20,13 @@ app "example-nodejs" {
   deploy {
     use "kubernetes" {
       probe_path = "/"
+
+      resources = {
+        limits_cpu = "500m"
+        limits_memory = "512Mi"
+        request_cpu = "100m"
+        request_memory = "256Mi"
+      }
     }
   }

After a waypoint up, describing the pod deployed you can see the resources are updated:

Containers:
  example-nodejs-01ex7nsq75ndyevxqrxajqb4rq:
    Container ID:
    Image:          example-nodejs:1
    Image ID:
    Port:           3000/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ErrImagePull
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     500m
      memory:  512Mi
    Requests:
      cpu:      500m
      memory:   512Mi

Fixes #677

This commit introduces the ability for waypoint.hcl to define resource
limits per deployment for its pod.
@briancain briancain requested a review from a team January 29, 2021 18:50
@briancain briancain added this to the 0.2.x milestone Jan 29, 2021
Copy link
Contributor

@krantzinator krantzinator left a comment

Choose a reason for hiding this comment

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

👏🏻

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

Successfully merging this pull request may close these issues.

Support for declaring resource limits, requests in Kubernetes (platform) deploy variables
3 participants