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

Template not found on initial creation #10899

Open
2 of 3 tasks
drew-viles opened this issue Apr 13, 2023 · 4 comments
Open
2 of 3 tasks

Template not found on initial creation #10899

drew-viles opened this issue Apr 13, 2023 · 4 comments
Labels
P3 Low priority type/bug

Comments

@drew-viles
Copy link

drew-viles commented Apr 13, 2023

Pre-requisites

  • I have double-checked my configuration
  • I can confirm the issues exists when I tested with :latest
  • I'd like to contribute the fix myself (see contributing guide)

What happened/what you expected to happen?

Creating a CronWorkflow fails to find 2nd template in a sequence of steps on initial creation - more details below.

Templates should be detected on first creation and shouldn't need replacing twice.

Version

I'm using helm chart: 0.24.0 - the latest available which gives me AppVersion: v3.4.7

Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

I've created a CronWorkflow and WorkflowTemplates as follows:

apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
  name: test-cron
  namespace: argo-workflows
spec:
  schedule: "* * * * *"
  concurrencyPolicy: "Replace"
  startingDeadlineSeconds: 0
  workflowSpec:
    entrypoint: test
    templates:
      - name: test
        steps:
          - - name: builder-test
              templateRef:
                name: test1
                template: test
          - - name: scanner-test
              templateRef:
                name: test2
                template: test
---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: test1
  namespace: argo-workflows
spec:
  entrypoint: test
  templates:
    - name: test
      script:
        image: ubuntu:22.04
        imagePullPolicy: IfNotPresent
        command: [bash]
        source: | 
          echo "test build complete"
---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: test2
  namespace: argo-workflows
spec:
  entrypoint: test
  templates:
    - name: test
      script:
        image: ubuntu:22.04
        imagePullPolicy: IfNotPresent
        command: [bash]
        source: |
          echo "test scan complete"

And I get the following error in the log (Below)

If I then change the test2 name in CronWorkflow:

          - - name: scanner-test
              templateRef:
                name: test3
                template: test

Apply that and then switch it back to:

          - - name: scanner-test
              templateRef:
                name: test2
                template: test

and apply it again.

It all works fine from that point onwards... It's a bit strange.

Logs from the workflow controller

time="2023-04-13T11:28:38.031Z" level=error msg="cannot validate Workflow: templates.test.steps[1].scanner-test template reference test2.test not found" conditionType=SpecError namespace=argo-workflows workflow=test-cron
time="2023-04-13T11:28:38.031Z" level=error msg="invalid cron workflow" cronWorkflow=argo-workflows/test-cron error="cannot validate Workflow: templates.test.steps[1].scanner-test template reference test2.test not found"

Logs from in your workflow's wait container

N/A

@drew-viles
Copy link
Author

I've had an epiphany this morning in that this is probably a race condition. So if I apply the above example it prevents the cron working due to the error mentioned.

If I put the cron below the templates, it works instantly.

I left it for a while and the reconciliation loop came around and checked again which eventually kicks it into action.

What might be good here as an improvement to UX is an addition to the log that says "Template not found, will check again in X minutes?".

I just feel that it could cause less confusion with a template not being found when the user can see it there.

@drew-viles drew-viles changed the title Tempalte not found on initial creation Template not found on initial creation Apr 18, 2023
@sarabala1979 sarabala1979 added the P3 Low priority label Apr 20, 2023
@stale
Copy link

stale bot commented Jun 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a mentoring request, please provide an update here. Thank you for your contributions.

@stale stale bot added the problem/stale This has not had a response in some time label Jun 18, 2023
@terrytangyuan terrytangyuan removed the problem/stale This has not had a response in some time label Sep 20, 2023
@tooptoop4
Copy link
Contributor

@drew-viles did u try create the cron after the templates?

@drew-viles
Copy link
Author

Yeah that worked for me. Basically it's just an error that occurs if the order of deployment is cron -> templates. If it's templates -> cron then it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Low priority type/bug
Projects
None yet
Development

No branches or pull requests

4 participants