1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-18 22:17:44 +02:00

normalise runtime service status

This commit is contained in:
Asim Aslam
2020-01-10 21:54:28 +00:00
parent 61dd2b8489
commit e1e6199743
3 changed files with 52 additions and 1 deletions

View File

@ -114,7 +114,18 @@ func (k *kubernetes) getService(labels map[string]string) ([]*runtime.Service, e
// parse out deployment status and inject into service metadata
if len(kdep.Status.Conditions) > 0 {
status := kdep.Status.Conditions[0].Type
var status string
switch kdep.Status.Conditions[0].Type {
case "Available":
status = "running"
delete(svc.Metadata, "error")
case "Progressing":
status = "starting"
delete(svc.Metadata, "error")
default:
status = "error"
svc.Metadata["error"] = kdep.Status.Conditions[0].Message
}
// pick the last known condition type and mark the service status with it
log.Debugf("Runtime setting %s service deployment status: %v", name, status)
svc.Metadata["status"] = status