Add mixin to strip cpu/memory limits (issue #72)

This commit is contained in:
Benoit Gagnon
2019-06-24 11:39:47 -04:00
parent 291f7c64fa
commit 8e7d55d795

View File

@@ -0,0 +1,56 @@
// Strips spec.containers[].limits for certain containers
// https://github.com/coreos/kube-prometheus/issues/72
{
nodeExporter+: {
daemonset+: {
spec+: {
template+: {
spec+: {
local stripLimits(c) =
if std.count([
'node-exporter',
'kube-rbac-proxy'
], c.name) > 0
then c + {resources+: {limits: {}}}
else c,
containers: std.map(stripLimits, super.containers),
},
},
},
},
},
prometheusOperator+: {
deployment+: {
spec+: {
template+: {
spec+: {
local addArgs(c) =
if c.name == 'prometheus-operator'
then c + {args+: ['--config-reloader-cpu=0']}
else c,
containers: std.map(addArgs, super.containers),
},
},
},
},
},
kubeStateMetrics+: {
deployment+: {
spec+: {
template+: {
spec+: {
local stripLimits(c) =
if std.count([
'kube-rbac-proxy-main',
'kube-rbac-proxy-self',
'addon-resizer'
], c.name) > 0
then c + {resources+: {limits: {}}}
else c,
containers: std.map(stripLimits, super.containers),
},
},
},
},
},
}