diff --git a/controllers/taskrun_controller.go b/controllers/taskrun_controller.go index 0bf05ba8..b0b83f78 100644 --- a/controllers/taskrun_controller.go +++ b/controllers/taskrun_controller.go @@ -247,7 +247,7 @@ func (r *TaskRunReconciler) runTaskOnHost(logger *opslog.Logger, ctx context.Con vars["TASK"] = t.Name vars["TASKRUN"] = tr.Name vars["HOSTNAME"] = h.GetHostname() - vars["OPSSERVER_ENDPOINT"] = r.getEventBusNodePortAddress(t.Namespace) + vars["OPSSERVER_ENDPOINT"] = r.getOpsServerEndpoint(t.Namespace) vars["EVENT_CLUSTER"] = opsconstants.GetEnvEventCluster() vars["UUID"] = uuid.New().String() @@ -317,7 +317,7 @@ func (r *TaskRunReconciler) runTaskOnKube(logger *opslog.Logger, ctx context.Con vars := tr.Spec.Variables vars["HOSTNAME"] = node.Name vars["NAEMSPACE"] = tr.Namespace - vars["OPSSERVER_ENDPOINT"] = r.getEventBusNodePortAddress(t.Namespace) + vars["OPSSERVER_ENDPOINT"] = r.getOpsServerEndpoint(t.Namespace) vars["TASK"] = t.Name vars["TASKRUN"] = tr.Name vars["UUID"] = uuid.New().String() @@ -329,7 +329,7 @@ func (r *TaskRunReconciler) runTaskOnKube(logger *opslog.Logger, ctx context.Con return } -func (r *TaskRunReconciler) getEventBusNodePortAddress(namespace string) string { +func (r *TaskRunReconciler) getOpsServerEndpoint(namespace string) string { // get app.kubernetes.io/name service under current namespace // if svc no nodeport, set to nodeport // get nodeport address and node ip address and return @@ -363,6 +363,7 @@ func (r *TaskRunReconciler) getEventBusNodePortAddress(namespace string) string nodeIp := opsutils.GetNodeInternalIp(anyWorker) r.opsserverEndpoint = fmt.Sprintf("http://%s:%d", nodeIp, svc.Spec.Ports[0].NodePort) + println(r.opsserverEndpoint) return r.opsserverEndpoint }