|
70 | 70 | annotations+: { |
71 | 71 | description: 'Cluster {{ $labels.%(clusterLabel)s }} has overcommitted memory resource requests for Pods by {{ $value | humanize }} bytes and cannot tolerate node failure.' % $._config, |
72 | 72 | }, |
73 | | - } else |
74 | | - { |
75 | | - expr: ||| |
76 | | - sum(namespace_memory:kube_pod_container_resource_requests:sum{%(ignoringOverprovisionedWorkloadSelector)s}) - (sum(kube_node_status_allocatable{resource="memory"}) - max(kube_node_status_allocatable{resource="memory"})) > 0 |
77 | | - and |
78 | | - (sum(kube_node_status_allocatable{resource="memory"}) - max(kube_node_status_allocatable{resource="memory"})) > 0 |
79 | | - ||| % $._config, |
80 | | - annotations+: { |
81 | | - description: 'Cluster has overcommitted memory resource requests for Pods by {{ $value | humanize }} bytes and cannot tolerate node failure.', |
| 73 | + } else |
| 74 | + { |
| 75 | + expr: ||| |
| 76 | + sum(namespace_memory:kube_pod_container_resource_requests:sum{%(ignoringOverprovisionedWorkloadSelector)s}) - (sum(kube_node_status_allocatable{resource="memory"}) - max(kube_node_status_allocatable{resource="memory"})) > 0 |
| 77 | + and |
| 78 | + (sum(kube_node_status_allocatable{resource="memory"}) - max(kube_node_status_allocatable{resource="memory"})) > 0 |
| 79 | + ||| % $._config, |
| 80 | + annotations+: { |
| 81 | + description: 'Cluster has overcommitted memory resource requests for Pods by {{ $value | humanize }} bytes and cannot tolerate node failure.', |
| 82 | + }, |
82 | 83 | }, |
83 | | - }, |
84 | 84 | { |
85 | 85 | alert: 'KubeCPUQuotaOvercommit', |
86 | 86 | labels: { |
|
101 | 101 | annotations+: { |
102 | 102 | description: 'Cluster {{ $labels.%(clusterLabel)s }} has overcommitted CPU resource requests for Namespaces.' % $._config, |
103 | 103 | }, |
104 | | - } else |
105 | | - { |
106 | | - expr: ||| |
107 | | - sum(min without(resource) (kube_resourcequota{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s, type="hard", resource=~"(cpu|requests.cpu)"})) |
108 | | - / |
109 | | - sum(kube_node_status_allocatable{resource="cpu", %(kubeStateMetricsSelector)s}) |
110 | | - > %(namespaceOvercommitFactor)s |
111 | | - ||| % $._config, |
112 | | - annotations+: { |
113 | | - description: 'Cluster has overcommitted CPU resource requests for Namespaces.', |
| 104 | + } else |
| 105 | + { |
| 106 | + expr: ||| |
| 107 | + sum(min without(resource) (kube_resourcequota{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s, type="hard", resource=~"(cpu|requests.cpu)"})) |
| 108 | + / |
| 109 | + sum(kube_node_status_allocatable{resource="cpu", %(kubeStateMetricsSelector)s}) |
| 110 | + > %(namespaceOvercommitFactor)s |
| 111 | + ||| % $._config, |
| 112 | + annotations+: { |
| 113 | + description: 'Cluster has overcommitted CPU resource requests for Namespaces.', |
| 114 | + }, |
114 | 115 | }, |
115 | | - }, |
116 | 116 | { |
117 | 117 | alert: 'KubeMemoryQuotaOvercommit', |
118 | 118 | labels: { |
|
133 | 133 | annotations+: { |
134 | 134 | description: 'Cluster {{ $labels.%(clusterLabel)s }} has overcommitted memory resource requests for Namespaces.' % $._config, |
135 | 135 | }, |
136 | | - } else |
137 | | - { |
138 | | - expr: ||| |
139 | | - sum(min without(resource) (kube_resourcequota{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s, type="hard", resource=~"(memory|requests.memory)"})) |
140 | | - / |
141 | | - sum(kube_node_status_allocatable{resource="memory", %(kubeStateMetricsSelector)s}) |
142 | | - > %(namespaceOvercommitFactor)s |
143 | | - ||| % $._config, |
144 | | - annotations+: { |
145 | | - description: 'Cluster has overcommitted memory resource requests for Namespaces.', |
| 136 | + } else |
| 137 | + { |
| 138 | + expr: ||| |
| 139 | + sum(min without(resource) (kube_resourcequota{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s, type="hard", resource=~"(memory|requests.memory)"})) |
| 140 | + / |
| 141 | + sum(kube_node_status_allocatable{resource="memory", %(kubeStateMetricsSelector)s}) |
| 142 | + > %(namespaceOvercommitFactor)s |
| 143 | + ||| % $._config, |
| 144 | + annotations+: { |
| 145 | + description: 'Cluster has overcommitted memory resource requests for Namespaces.', |
| 146 | + }, |
146 | 147 | }, |
147 | | - }, |
148 | 148 | { |
149 | 149 | alert: 'KubeQuotaAlmostFull', |
150 | 150 | expr: ||| |
|
0 commit comments