From 42921d8375580d2c428ac8917a95bbbca289208b Mon Sep 17 00:00:00 2001 From: "M. Mert Yildiran" Date: Fri, 30 Dec 2022 05:32:46 +0300 Subject: [PATCH] :zap: Add profiling environment variables if `debug` is `true` --- kubernetes/provider.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kubernetes/provider.go b/kubernetes/provider.go index 9fe7c327e..fe4e8d5d8 100644 --- a/kubernetes/provider.go +++ b/kubernetes/provider.go @@ -724,6 +724,14 @@ func (provider *Provider) ApplyWorkerDaemonSet( workerContainer.WithCommand(command...) + if debug { + workerContainer.WithEnv( + applyconfcore.EnvVar().WithName("MEMORY_PROFILING_ENABLED").WithValue("true"), + applyconfcore.EnvVar().WithName("MEMORY_PROFILING_INTERVAL_SECONDS").WithValue("10"), + applyconfcore.EnvVar().WithName("MEMORY_USAGE_INTERVAL_MILLISECONDS").WithValue("500"), + ) + } + cpuLimit, err := resource.ParseQuantity(resources.CpuLimit) if err != nil { return fmt.Errorf("invalid cpu limit for %s container", workerPodName)