Skip to content

Commit b212d48

Browse files
authored
Merge pull request #164 from consideRatio/pr/style-non-running-pods
Make non-running pods panels consistent and style them intuitively
2 parents dc63ff9 + 3e36c10 commit b212d48

File tree

3 files changed

+67
-13
lines changed

3 files changed

+67
-13
lines changed

dashboards/cluster.jsonnet

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -403,22 +403,23 @@ local nodeOOMKills =
403403
]);
404404

405405
local nonRunningPods =
406-
common.barChartOptions
407-
+ barChart.new('Pods not in Running state')
408-
+ barChart.panelOptions.withDescription(
406+
common.tsOptions
407+
+ common.tsPodStateStylingOverrides
408+
+ ts.new('Non Running Pods')
409+
+ ts.panelOptions.withDescription(
409410
|||
410-
Pods in states other than 'Running'.
411+
Pods in a non-running state in the hub's namespace.
411412
412-
In a functional clusters, pods should not be in non-Running states for long.
413-
|||,
413+
Pods stuck in non-running states often indicate an error condition
414+
|||
414415
)
415-
+ ts.fieldConfig.defaults.custom.stacking.withMode('normal')
416-
+ barChart.standardOptions.withDecimals(0)
417-
+ barChart.queryOptions.withTargets([
416+
+ ts.queryOptions.withTargets([
418417
prometheus.new(
419418
'$PROMETHEUS_DS',
420419
|||
421-
sum(kube_pod_status_phase{phase!="Running"}) by (phase)
420+
sum(
421+
kube_pod_status_phase{phase!="Running"}
422+
) by (phase)
422423
|||
423424
)
424425
+ prometheus.withLegendFormat('{{phase}}'),

dashboards/common.libsonnet

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,61 @@ local _getDashedLineOverride(pattern, color) = {
9898
])
9999
,
100100

101+
tsPodStateStylingOverrides:
102+
ts.standardOptions.withOverrides([
103+
{
104+
matcher: { id: 'byName', options: 'Pending' },
105+
properties: [{
106+
id: 'color',
107+
value: {
108+
fixedColor: 'yellow',
109+
mode: 'fixed',
110+
},
111+
}],
112+
},
113+
{
114+
matcher: { id: 'byName', options: 'Running' },
115+
properties: [{
116+
id: 'color',
117+
value: {
118+
fixedColor: 'blue',
119+
mode: 'fixed',
120+
},
121+
}],
122+
},
123+
{
124+
matcher: { id: 'byName', options: 'Succeeded' },
125+
properties: [{
126+
id: 'color',
127+
value: {
128+
fixedColor: 'green',
129+
mode: 'fixed',
130+
},
131+
}],
132+
},
133+
{
134+
matcher: { id: 'byName', options: 'Unknown' },
135+
properties: [{
136+
id: 'color',
137+
value: {
138+
fixedColor: 'orange',
139+
mode: 'fixed',
140+
},
141+
}],
142+
},
143+
{
144+
matcher: { id: 'byName', options: 'Failed' },
145+
properties: [{
146+
id: 'color',
147+
value: {
148+
fixedColor: 'red',
149+
mode: 'fixed',
150+
},
151+
}],
152+
},
153+
])
154+
,
155+
101156
// grafonnet ref: https://grafana.github.io/grafonnet/API/dashboard/variable.html
102157
variables: {
103158
prometheus:

dashboards/jupyterhub.jsonnet

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ local usersPerNode =
230230

231231
local nonRunningPods =
232232
common.tsOptions
233+
+ common.tsPodStateStylingOverrides
233234
+ ts.new('Non Running Pods')
234235
+ ts.panelOptions.withDescription(
235236
|||
@@ -238,8 +239,6 @@ local nonRunningPods =
238239
Pods stuck in non-running states often indicate an error condition
239240
|||
240241
)
241-
// decimalsY1=0,
242-
+ ts.fieldConfig.defaults.custom.stacking.withMode('normal')
243242
+ ts.queryOptions.withTargets([
244243
prometheus.new(
245244
'$PROMETHEUS_DS',
@@ -265,7 +264,6 @@ local sharedVolumeFreeSpace =
265264
what extra deployment is needed.
266265
|||
267266
)
268-
// decimalsY1=0,
269267
+ ts.standardOptions.withMax(1)
270268
+ ts.standardOptions.withUnit('percentunit')
271269
+ ts.queryOptions.withTargets([

0 commit comments

Comments
 (0)