From: Tuan Nguyen Date: Wed, 22 May 2024 09:57:31 +0000 (+0000) Subject: RICAPP-233: Missing Readiness and Liveness Probes in kpimon-go xApp Deployment Config... X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=8bbbbbb90093db01f88820de755bce0ee2189c88;p=ric-app%2Fkpimon-go.git RICAPP-233: Missing Readiness and Liveness Probes in kpimon-go xApp Deployment Configuration Change-Id: I5ed314b37bbc9021efa7cd217a74e8350580a66a Signed-off-by: Tuan Nguyen --- diff --git a/control/control.go b/control/control.go index 10e6e99..92b2098 100644 --- a/control/control.go +++ b/control/control.go @@ -17,6 +17,7 @@ import ( "strconv" "time" "unsafe" + "strings" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" @@ -67,9 +68,9 @@ func (c Control) Consume(msg *xapp.RMRParams) error { } func NewControl() Control { - xapp.Logger.Info("In new control\n") + xapp.Logger.Info("In new control") create_db() - xapp.Logger.Info("returning control\n") + xapp.Logger.Info("returning control") return Control{ make(chan *xapp.RMRParams), influxdb2.NewClient("http://ricplt-influxdb.ricplt:8086", "client"), @@ -77,12 +78,12 @@ func NewControl() Control { } func create_db() { //Create a database named kpimon in influxDB - xapp.Logger.Info("In create_db\n") + xapp.Logger.Info("In create_db") _, err := http.Post("http://ricplt-influxdb.ricplt:8086/query?q=create%20database%20kpimon", "", nil) if err != nil { xapp.Logger.Error("Create database failed!") } - xapp.Logger.Info("exiting create_db\n") + xapp.Logger.Info("exiting create_db") } func (c Control) getEnbList() ([]*xapp.RNIBNbIdentity, error) { @@ -92,10 +93,12 @@ func (c Control) getEnbList() ([]*xapp.RNIBNbIdentity, error) { return nil, err } - xapp.Logger.Info("List for connected eNBs :") - for index, enb := range enbs { - xapp.Logger.Info("%d. enbid: %s", index+1, enb.InventoryName) + var connected_enb_names []string + for _, enb := range enbs { + connected_enb_names = append(connected_enb_names, enb.InventoryName) } + xapp.Logger.Info("List for connected eNBs: [%s]", strings.Join(connected_enb_names, ", ")) + return enbs, nil } @@ -106,10 +109,13 @@ func (c *Control) getGnbList() ([]*xapp.RNIBNbIdentity, error) { xapp.Logger.Error("err: %s", err) return nil, err } - xapp.Logger.Info("List of connected gNBs :") - for index, gnb := range gnbs { - xapp.Logger.Info("%d. gnbid : %s", index+1, gnb.InventoryName) + + var connected_gnb_names []string + for _, gnb := range gnbs { + connected_gnb_names = append(connected_gnb_names, gnb.InventoryName) } + xapp.Logger.Info("List for connected gNBs: [%s]", strings.Join(connected_gnb_names, ", ")) + return gnbs, nil } diff --git a/deploy/config.json b/deploy/config.json index 553c786..6563e7c 100644 --- a/deploy/config.json +++ b/deploy/config.json @@ -1,6 +1,6 @@ { "xapp_name": "kpimon-go", - "version": "2.0.1", + "version": "2.0.2-alpha", "containers": [ { "name": "kpimon-go", @@ -11,6 +11,22 @@ } } ], + "livenessProbe": { + "httpGet": { + "path": "ric/v1/health/alive", + "port": 8080 + }, + "initialDelaySeconds": 5, + "periodSeconds": 15 + }, + "readinessProbe": { + "httpGet": { + "path": "ric/v1/health/ready", + "port": 8080 + }, + "initialDelaySeconds": 5, + "periodSeconds": 15 + }, "messaging": { "ports": [ {