From c3baa65793b481219d57539f7511c781ffd995e2 Mon Sep 17 00:00:00 2001 From: Andrew Melnick Date: Tue, 17 Sep 2024 22:38:51 -0600 Subject: [PATCH] feat: Set steps.*.ip to a json list if the node is an aggregate Signed-off-by: Andrew Melnick --- workflow/controller/operator.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/workflow/controller/operator.go b/workflow/controller/operator.go index 32a7e2aa57ce..ff68faf39703 100644 --- a/workflow/controller/operator.go +++ b/workflow/controller/operator.go @@ -2842,7 +2842,6 @@ func (woc *wfOperationCtx) executeContainer(ctx context.Context, nodeName string onExitPod: opts.onExitTemplate, executionDeadline: opts.executionDeadline, }) - if err != nil { return woc.requeueIfTransientErr(err, node.Name) } @@ -3198,6 +3197,7 @@ func (woc *wfOperationCtx) processAggregateNodeOutputs(scope *wfScope, prefix st paramList := make([]map[string]string, 0) outputParamValueLists := make(map[string][]string) resultsList := make([]wfv1.Item, 0) + ipList := make([]string, 0) for _, node := range childNodes { if node.Outputs == nil || node.Phase != wfv1.NodeSucceeded || node.Type == wfv1.NodeTypeRetry { continue @@ -3221,6 +3221,9 @@ func (woc *wfOperationCtx) processAggregateNodeOutputs(scope *wfScope, prefix st } resultsList = append(resultsList, item) } + if node.Daemoned != nil && *node.Daemoned { + ipList = append(ipList, node.PodIP) + } } { resultsJSON, err := json.Marshal(resultsList) @@ -3245,6 +3248,14 @@ func (woc *wfOperationCtx) processAggregateNodeOutputs(scope *wfScope, prefix st } scope.addParamToScope(key, valueListJson) } + { + ipListJSON, err := json.Marshal(ipList) + if err != nil { + return err + } + key := fmt.Sprintf("%s.ip", prefix) + scope.addParamToScope(key, string(ipListJSON)) + } return nil }