From 62398b5e2bc04f49a835e50ac528d7715c5efb85 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Mon, 13 Nov 2023 13:55:40 +0100
Subject: [PATCH] fix(dnsproxy): Use GOMAXPROCS and GOMEMLIMIT from Kubernetes
 resources

This patch implements some Go best practices for resource management.

References:
https://blog.howardjohn.info/posts/gomaxprocs/
---
 apps/k8s01/dns/dns.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/apps/k8s01/dns/dns.yaml b/apps/k8s01/dns/dns.yaml
index 587e7ff19..653e5e1df 100644
--- a/apps/k8s01/dns/dns.yaml
+++ b/apps/k8s01/dns/dns.yaml
@@ -31,6 +31,15 @@ spec:
             - --tls-port=853
             - --tls-crt=/etc/pki/dnsproxy/tls.crt
             - --tls-key=/etc/pki/dnsproxy/tls.key
+          env:
+            - name: GOMEMLIMIT
+              valueFrom:
+                resourceFieldRef:
+                  resource: limits.memory
+            - name: GOMAXPROCS
+              valueFrom:
+                resourceFieldRef:
+                  resource: limits.cpu
           ports:
             - containerPort: 53
               protocol: TCP
-- 
GitLab