Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support archive logs in resource template. Fixes:#9900 #13933

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/argoexec/commands/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ func waitContainer(ctx context.Context) error {
// Don't allow cancellation to impact capture of results, parameters, artifacts, or defers.
bgCtx := context.Background()

if wfExecutor.Template.Resource != nil {
err := wfExecutor.Wait(ctx)
if err != nil {
wfExecutor.AddError(err)
}
wfExecutor.SaveLogs(bgCtx)
return wfExecutor.HasError()
}

defer wfExecutor.HandleError(bgCtx) // Must be placed at the bottom of defers stack.
defer wfExecutor.FinalizeOutput(bgCtx) // Ensures the LabelKeyReportOutputsCompleted is set to true.
defer stats.LogStats()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/resource_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ spec:
serviceAccountName: argo
automountServiceAccountToken: false
executor:
serviceAccountName: argo
serviceAccountName: default
entrypoint: main
templates:
- name: main
Expand Down
5 changes: 3 additions & 2 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,11 @@ func (woc *wfOperationCtx) createWorkflowPod(ctx context.Context, nodeName strin
return nil, err
}

if tmpl.GetType() != wfv1.TemplateTypeResource && tmpl.GetType() != wfv1.TemplateTypeData {
// we do not need the wait container for resource templates because
if tmpl.GetType() != wfv1.TemplateTypeData {
// we do not need the wait container for data templates because
// argoexec runs as the main container and will perform the job of
// annotating the outputs or errors, making the wait container redundant.
// for resource template, add a wait container to collect logs.
waitCtr := woc.newWaitContainer(tmpl)
pod.Spec.Containers = append(pod.Spec.Containers, *waitCtr)
}
Expand Down
Loading