Create Kubernetes Probes for API Server[VOL-1731]
Change-Id: Ie289ffce77af284f2b8f62603f8570d80a598e50
diff --git a/internal/pkg/afrouterd/misc.go b/internal/pkg/afrouterd/misc.go
index 7946205..1f0b379 100644
--- a/internal/pkg/afrouterd/misc.go
+++ b/internal/pkg/afrouterd/misc.go
@@ -19,6 +19,7 @@
import (
"fmt"
"github.com/opencord/voltha-lib-go/v2/pkg/log"
+ "github.com/opencord/voltha-lib-go/v2/pkg/probe"
pb "github.com/opencord/voltha-protos/v2/go/afrouter"
"golang.org/x/net/context"
"google.golang.org/grpc"
@@ -110,7 +111,7 @@
}
// endOnClose cancels the context when the connection closes
-func ConnectionActiveContext(conn *grpc.ClientConn) context.Context {
+func ConnectionActiveContext(conn *grpc.ClientConn, p *probe.Probe) context.Context {
ctx, disconnected := context.WithCancel(context.Background())
go func() {
for state := conn.GetState(); state != connectivity.TransientFailure && state != connectivity.Shutdown; state = conn.GetState() {
@@ -119,6 +120,7 @@
}
}
log.Infof("Connection to afrouter lost")
+ p.UpdateStatus("affinity-router", probe.ServiceStatusStopped)
disconnected()
}()
return ctx