Create Kubernetes Probes for API Server[VOL-1731]
Change-Id: Ie289ffce77af284f2b8f62603f8570d80a598e50
diff --git a/cmd/arouter/arouter.go b/cmd/arouter/arouter.go
index 6fd9dbf..73f8782 100644
--- a/cmd/arouter/arouter.go
+++ b/cmd/arouter/arouter.go
@@ -20,6 +20,7 @@
"fmt"
"github.com/opencord/voltha-api-server/internal/pkg/afrouter"
"github.com/opencord/voltha-lib-go/v2/pkg/log"
+ "github.com/opencord/voltha-lib-go/v2/pkg/probe"
"github.com/opencord/voltha-lib-go/v2/pkg/version"
_ "github.com/opencord/voltha-protos/v2"
"google.golang.org/grpc/grpclog"
@@ -70,6 +71,18 @@
grpclog.SetLoggerV2(grpclog.NewLoggerV2(os.Stderr, ioutil.Discard, ioutil.Discard))
}
+ /*
+ * Create and start the liveness and readiness container management probes. This
+ * is done in the main function so just in case the main starts multiple other
+ * objects there can be a single probe end point for the process.
+ */
+ p := &probe.Probe{}
+ go p.ListenAndServe(fmt.Sprintf("%s:%d", conf.Api.ProbeHost, conf.Api.ProbePort))
+
+ p.RegisterService(
+ "affinity-router-proxy",
+ )
+
// Install the signal and error handlers.
err = afrouter.InitExitHandler()
if err != nil {
@@ -78,7 +91,7 @@
}
// Create the affinity router proxy...
- if ap, err := afrouter.NewArouterProxy(conf); err != nil {
+ if ap, err := afrouter.NewArouterProxy(conf, p); err != nil {
log.Errorf("Failed to create the arouter proxy, exiting:%v", err)
return 1
// and start it.