#2 pods with non-ready containers are flashing green

This commit is contained in:
Henning Jacobs
2016-12-20 21:31:45 +01:00
parent e795f5145b
commit 869b40e6b4
2 changed files with 19 additions and 0 deletions

View File

@@ -11,12 +11,17 @@ export default class Pod extends PIXI.Graphics {
// pod.status.containerStatuses might be undefined! // pod.status.containerStatuses might be undefined!
const containerStatuses = this.pod.status.containerStatuses || [] const containerStatuses = this.pod.status.containerStatuses || []
var ready = 0 var ready = 0
var running = 0
for (const containerStatus of containerStatuses) { for (const containerStatus of containerStatuses) {
if (containerStatus.ready) { if (containerStatus.ready) {
ready++ ready++
} }
if (containerStatus.state.running) {
running++
}
} }
const allReady = ready >= containerStatuses.length const allReady = ready >= containerStatuses.length
const allRunning = running >= containerStatuses.length
const podBox = this const podBox = this
podBox.interactive = true podBox.interactive = true
@@ -62,6 +67,13 @@ export default class Pod extends PIXI.Graphics {
podBox.lineStyle(2, 0xaaaaff, 1); podBox.lineStyle(2, 0xaaaaff, 1);
} else if (this.pod.status.phase == 'Running' && allReady) { } else if (this.pod.status.phase == 'Running' && allReady) {
podBox.lineStyle(2, 0xaaffaa, 1); podBox.lineStyle(2, 0xaaffaa, 1);
} else if (this.pod.status.phase == 'Running' && allRunning && !allReady) {
// all containers running, but some not ready (readinessProbe)
PIXI.ticker.shared.add(function(_) {
var v = Math.sin((PIXI.ticker.shared.lastTime % 1000)/1000.* Math.PI)
podBox.alpha = v
})
podBox.lineStyle(2, 0xaaffaa, 1);
} else if (this.pod.status.phase == 'Pending') { } else if (this.pod.status.phase == 'Pending') {
PIXI.ticker.shared.add(function(_) { PIXI.ticker.shared.add(function(_) {
var v = Math.sin((PIXI.ticker.shared.lastTime % 1000)/1000.* Math.PI) var v = Math.sin((PIXI.ticker.shared.lastTime % 1000)/1000.* Math.PI)
@@ -69,6 +81,7 @@ export default class Pod extends PIXI.Graphics {
}) })
podBox.lineStyle(2, 0xffffaa, 1); podBox.lineStyle(2, 0xffffaa, 1);
} else { } else {
// CrashLoopBackOff, ImagePullBackOff or other unknown state
PIXI.ticker.shared.add(function(_) { PIXI.ticker.shared.add(function(_) {
var v = Math.sin((PIXI.ticker.shared.lastTime % 1000)/1000.* Math.PI) var v = Math.sin((PIXI.ticker.shared.lastTime % 1000)/1000.* Math.PI)

View File

@@ -22,6 +22,12 @@ spec:
ports: ports:
- containerPort: 8080 - containerPort: 8080
protocol: TCP protocol: TCP
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
timeoutSeconds: 1
resources: resources:
limits: limits:
cpu: 200m cpu: 200m