Skip to content
Snippets Groups Projects
Unverified Commit 636f2b6e authored by Frederic Branczyk's avatar Frederic Branczyk Committed by GitHub
Browse files

Merge pull request #132 from bgagnon/fix-72

Add mixin to strip cpu/memory limits (issue #72)
parents 517aded2 da644166
No related branches found
No related tags found
No related merge requests found
// Strips spec.containers[].limits for certain containers
// https://github.com/coreos/kube-prometheus/issues/72
{
_config+:: {
resources+:: {
'addon-resizer'+: {
limits: {},
},
'kube-rbac-proxy'+: {
limits: {},
},
'node-exporter'+: {
limits: {},
},
},
},
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),
},
},
},
},
},
}
......@@ -106,6 +106,20 @@ local configMapList = k3.core.v1.configMapList;
CoreDNS: $._config.coreDNSSelector,
},
resources+:: {
'addon-resizer': {
requests: { cpu: '10m', memory: '30Mi' },
limits: { cpu: '50m', memory: '30Mi' },
},
'kube-rbac-proxy': {
requests: { cpu: '10m', memory: '20Mi' },
limits: { cpu: '20m', memory: '40Mi' },
},
'node-exporter': {
requests: { cpu: '102m', memory: '180Mi' },
limits: { cpu: '250m', memory: '180Mi' },
},
},
prometheus+:: {
rules: $.prometheusRules + $.prometheusAlerts,
},
......
......@@ -155,8 +155,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
'--upstream=http://127.0.0.1:8081/',
]) +
container.withPorts(containerPort.newNamed(8443, 'https-main',)) +
container.mixin.resources.withRequests({ cpu: '10m', memory: '20Mi' }) +
container.mixin.resources.withLimits({ cpu: '20m', memory: '40Mi' });
container.mixin.resources.withRequests($._config.resources['kube-rbac-proxy'].requests) +
container.mixin.resources.withLimits($._config.resources['kube-rbac-proxy'].limits);
local proxySelfMetrics =
container.new('kube-rbac-proxy-self', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) +
......@@ -167,8 +167,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
'--upstream=http://127.0.0.1:8082/',
]) +
container.withPorts(containerPort.newNamed(9443, 'https-self',)) +
container.mixin.resources.withRequests({ cpu: '10m', memory: '20Mi' }) +
container.mixin.resources.withLimits({ cpu: '20m', memory: '40Mi' });
container.mixin.resources.withRequests($._config.resources['kube-rbac-proxy'].requests) +
container.mixin.resources.withLimits($._config.resources['kube-rbac-proxy'].limits);
local kubeStateMetrics =
container.new('kube-state-metrics', $._config.imageRepos.kubeStateMetrics + ':' + $._config.versions.kubeStateMetrics) +
......@@ -207,8 +207,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
},
},
]) +
container.mixin.resources.withRequests({ cpu: '10m', memory: '30Mi' }) +
container.mixin.resources.withLimits({ cpu: '50m', memory: '30Mi' });
container.mixin.resources.withRequests($._config.resources['addon-resizer'].requests) +
container.mixin.resources.withLimits($._config.resources['addon-resizer'].limits);
local c = [proxyClusterMetrics, proxySelfMetrics, kubeStateMetrics, addonResizer];
......
......@@ -97,8 +97,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
'--collector.filesystem.ignored-fs-types=^(autofs|binfmt_misc|cgroup|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|mqueue|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|sysfs|tracefs)$',
]) +
container.withVolumeMounts([procVolumeMount, sysVolumeMount, rootVolumeMount]) +
container.mixin.resources.withRequests({ cpu: '102m', memory: '180Mi' }) +
container.mixin.resources.withLimits({ cpu: '250m', memory: '180Mi' });
container.mixin.resources.withRequests($._config.resources['node-exporter'].requests) +
container.mixin.resources.withLimits($._config.resources['node-exporter'].requests);
local ip = containerEnv.fromFieldPath('IP', 'status.podIP');
local proxy =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment