Skip to content

Commit

Permalink
Merge pull request #856 from aslafy-z/fix/scalar-quotas
Browse files Browse the repository at this point in the history
fix: correct quotas on prometheus federation HA
  • Loading branch information
povilasv authored Oct 11, 2024
2 parents cb72d73 + b41eb2a commit 6e24b64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions dashboards/resources/namespace.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ local var = g.dashboard.variable;

prometheus.new(
'${datasource}',
'scalar(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource="requests.cpu"})' % $._config
'scalar(max(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource="requests.cpu"}))' % $._config
)
+ prometheus.withLegendFormat('quota - requests'),

prometheus.new(
'${datasource}',
'scalar(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource="limits.cpu"})' % $._config
'scalar(max(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource="limits.cpu"}))' % $._config
)
+ prometheus.withLegendFormat('quota - limits'),
])
Expand Down Expand Up @@ -293,13 +293,13 @@ local var = g.dashboard.variable;

prometheus.new(
'${datasource}',
'scalar(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource="requests.memory"})' % $._config
'scalar(max(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource="requests.memory"}))' % $._config
)
+ prometheus.withLegendFormat('quota - requests'),

prometheus.new(
'${datasource}',
'scalar(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource="limits.memory"})' % $._config
'scalar(max(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource="limits.memory"}))' % $._config
)
+ prometheus.withLegendFormat('quota - limits'),
])
Expand Down
2 changes: 1 addition & 1 deletion dashboards/resources/workload-namespace.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ local var = g.dashboard.variable;
local memRequestsQuery = std.strReplace(cpuRequestsQuery, 'cpu', 'memory');
local memLimitsQuery = std.strReplace(cpuLimitsQuery, 'cpu', 'memory');

local cpuQuotaRequestsQuery = 'scalar(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource=~"requests.cpu|cpu"})' % $._config;
local cpuQuotaRequestsQuery = 'scalar(max(kube_resourcequota{%(clusterLabel)s="$cluster", namespace="$namespace", type="hard",resource=~"requests.cpu|cpu"}))' % $._config;
local cpuQuotaLimitsQuery = std.strReplace(cpuQuotaRequestsQuery, 'requests.cpu|cpu', 'limits.cpu');
local memoryQuotaRequestsQuery = std.strReplace(cpuQuotaRequestsQuery, 'requests.cpu|cpu', 'requests.memory|memory');
local memoryQuotaLimitsQuery = std.strReplace(cpuQuotaRequestsQuery, 'requests.cpu|cpu', 'limits.memory');
Expand Down

0 comments on commit 6e24b64

Please sign in to comment.