Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
shaowenchen committed Nov 25, 2024
1 parent 3141664 commit 58d2777
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions controllers/taskrun_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 58d2777

Please sign in to comment.