move resources requests/limits to _config and simplify mixin
This commit is contained in:
@@ -1,21 +1,16 @@
|
|||||||
// Strips spec.containers[].limits for certain containers
|
// Strips spec.containers[].limits for certain containers
|
||||||
// https://github.com/coreos/kube-prometheus/issues/72
|
// https://github.com/coreos/kube-prometheus/issues/72
|
||||||
{
|
{
|
||||||
nodeExporter+: {
|
_config+:: {
|
||||||
daemonset+: {
|
resources+:: {
|
||||||
spec+: {
|
'addon-resizer': {
|
||||||
template+: {
|
limits: {},
|
||||||
spec+: {
|
},
|
||||||
local stripLimits(c) =
|
'kube-rbac-proxy': {
|
||||||
if std.setMember(c.name, [
|
limits: {},
|
||||||
'kube-rbac-proxy',
|
},
|
||||||
'node-exporter',
|
'node-exporter': {
|
||||||
])
|
limits: {},
|
||||||
then c + {resources+: {limits: {}}}
|
|
||||||
else c,
|
|
||||||
containers: std.map(stripLimits, super.containers),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -34,23 +29,4 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
kubeStateMetrics+: {
|
|
||||||
deployment+: {
|
|
||||||
spec+: {
|
|
||||||
template+: {
|
|
||||||
spec+: {
|
|
||||||
local stripLimits(c) =
|
|
||||||
if std.setMember(c.name, [
|
|
||||||
'addon-resizer',
|
|
||||||
'kube-rbac-proxy-main',
|
|
||||||
'kube-rbac-proxy-self',
|
|
||||||
])
|
|
||||||
then c + {resources+: {limits: {}}}
|
|
||||||
else c,
|
|
||||||
containers: std.map(stripLimits, super.containers),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
@@ -104,6 +104,20 @@ local configMapList = k3.core.v1.configMapList;
|
|||||||
CoreDNS: $._config.coreDNSSelector,
|
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+:: {
|
prometheus+:: {
|
||||||
rules: $.prometheusRules + $.prometheusAlerts,
|
rules: $.prometheusRules + $.prometheusAlerts,
|
||||||
},
|
},
|
||||||
|
@@ -140,8 +140,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
|
|||||||
'--upstream=http://127.0.0.1:8081/',
|
'--upstream=http://127.0.0.1:8081/',
|
||||||
]) +
|
]) +
|
||||||
container.withPorts(containerPort.newNamed(8443, 'https-main',)) +
|
container.withPorts(containerPort.newNamed(8443, 'https-main',)) +
|
||||||
container.mixin.resources.withRequests({ cpu: '10m', memory: '20Mi' }) +
|
container.mixin.resources.withRequests($._config.resources['kube-rbac-proxy'].requests) +
|
||||||
container.mixin.resources.withLimits({ cpu: '20m', memory: '40Mi' });
|
container.mixin.resources.withLimits($._config.resources['kube-rbac-proxy'].limits);
|
||||||
|
|
||||||
local proxySelfMetrics =
|
local proxySelfMetrics =
|
||||||
container.new('kube-rbac-proxy-self', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) +
|
container.new('kube-rbac-proxy-self', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) +
|
||||||
@@ -152,8 +152,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
|
|||||||
'--upstream=http://127.0.0.1:8082/',
|
'--upstream=http://127.0.0.1:8082/',
|
||||||
]) +
|
]) +
|
||||||
container.withPorts(containerPort.newNamed(9443, 'https-self',)) +
|
container.withPorts(containerPort.newNamed(9443, 'https-self',)) +
|
||||||
container.mixin.resources.withRequests({ cpu: '10m', memory: '20Mi' }) +
|
container.mixin.resources.withRequests($._config.resources['kube-rbac-proxy'].requests) +
|
||||||
container.mixin.resources.withLimits({ cpu: '20m', memory: '40Mi' });
|
container.mixin.resources.withLimits($._config.resources['kube-rbac-proxy'].limits);
|
||||||
|
|
||||||
local kubeStateMetrics =
|
local kubeStateMetrics =
|
||||||
container.new('kube-state-metrics', $._config.imageRepos.kubeStateMetrics + ':' + $._config.versions.kubeStateMetrics) +
|
container.new('kube-state-metrics', $._config.imageRepos.kubeStateMetrics + ':' + $._config.versions.kubeStateMetrics) +
|
||||||
@@ -192,8 +192,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
]) +
|
]) +
|
||||||
container.mixin.resources.withRequests({ cpu: '10m', memory: '30Mi' }) +
|
container.mixin.resources.withRequests($._config.resources['addon-resizer'].requests) +
|
||||||
container.mixin.resources.withLimits({ cpu: '50m', memory: '30Mi' });
|
container.mixin.resources.withLimits($._config.resources['addon-resizer'].limits);
|
||||||
|
|
||||||
local c = [proxyClusterMetrics, proxySelfMetrics, kubeStateMetrics, addonResizer];
|
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)$',
|
'--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.withVolumeMounts([procVolumeMount, sysVolumeMount, rootVolumeMount]) +
|
||||||
container.mixin.resources.withRequests({ cpu: '102m', memory: '180Mi' }) +
|
container.mixin.resources.withRequests($._config.resources['node-exporter'].requests) +
|
||||||
container.mixin.resources.withLimits({ cpu: '250m', memory: '180Mi' });
|
container.mixin.resources.withLimits($._config.resources['node-exporter'].requests);
|
||||||
|
|
||||||
local ip = containerEnv.fromFieldPath('IP', 'status.podIP');
|
local ip = containerEnv.fromFieldPath('IP', 'status.podIP');
|
||||||
local proxy =
|
local proxy =
|
||||||
|
Reference in New Issue
Block a user