argoproj / argoproj/argo-workflows
template validation/submit fail if dynamic templateRef is used in deeply nested template
- Dominant language
- Go
- Stars
- 17k
- Forks
- 3.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 138
Description
### Pre-requisites
- [x] I have double-checked my configuration
- [x] I have tested with the `:latest` image tag (i.e. `quay.io/argoproj/workflow-controller:latest`) and can confirm the issue still exists on `:latest`. If not, I have explained why, **in detail**, in my description below.
- [x] I have searched existing issues and could not find a match for this bug
- [ ] I'd like to contribute the fix myself (see [contributing guide](https://github.com/argoproj/argo-workflows/blob/main/docs/CONTRIBUTING.md))
### What happened? What did you expect to happen?
This is a continuation of the [issue](https://github.com/argoproj/argo-workflows/issues/13773) that was previously closed, but the problem still persists.
When using dynamic templates in nested workflow template calls, the setup works only if the called workflow is one level deep from the submitted workflow. However, if the nesting goes beyond one level, validation fails and the workflow cannot be submitted.
The error received is:
template reference placeholder-270.main not found
### Version(s)
v3.7.1, v4.0.4
### Paste a minimal workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflow that uses private images.
```YAML
kind: ClusterWorkflowTemplate
metadata:
name: top-parent-workflow
spec:
templates:
- name: main
inputs:
parameters:
- name: workflowName
- name: workflowParameters
dag:
tasks:
- name: direct-parent-workflow
templateRef:
name: direct-parent-workflow
template: main
clusterScope: true
arguments:
parameters:
- name: workflowName
value: '{{inputs.parameters.workflowName}}'
- name: workflowParameters
value: '{{inputs.parameters.workflowParameters}}'
---
apiVersion: argoproj.io/v1alpha1
kind: ClusterWorkflowTemplate
metadata:
name: direct-parent-workflow
spec:
templates:
- name: main
inputs:
parameters:
- name: workflowParameters
- name: workflowName
dag:
tasks:
- name: run-external-workflow
templateRef:
name: '{{inputs.parameters.workflowName}}'
template: main
clusterScope: true
arguments:
parameters:
- name: parameters
value: '{{inputs.parameters.workflowParameters}}'
---
apiVersion: argoproj.io/v1alpha1
kind: ClusterWorkflowTemplate
metadata:
name: external-workflow
spec:
templates:
- name: main
inputs:
parameters:
- name: parameters
steps:
- - name: hello1
template: print-message
arguments:
parameters:
- name: message
value: '{{inputs.parameters.parameters}}'
- name: print-message
inputs:
parameters:
- name: message
script:
image: alpine:latest
command: [sh]
source: |
echo "supplied parameters: {{inputs.parameters.message}}"
```
### Logs from the workflow controller
```text
kubectl logs -n argo deploy/workflow-controller | grep ${workflow}
template reference placeholder-270.main not found
```
### Logs from in your workflow's wait container
```text
kubectl logs -n argo -c wait -l workflows.argoproj.io/workflow=${workflow},workflow.argoproj.io/phase!=Succeeded
```
Contributor guide
Research direction
Start by running the minimal nested ClusterWorkflowTemplate YAML and tracing validation and submission of the dynamic templateRef that produces “template reference placeholder-270.main not found.” Read the templateRef resolution path and compare one-level nesting with deeper nesting. Done means the reproduced workflow validates and submits successfully with dynamic references at any shown nesting depth.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- backend, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100