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

Sensor trigger execution order #3075

Open
rship12 opened this issue Mar 19, 2024 · 1 comment
Open

Sensor trigger execution order #3075

rship12 opened this issue Mar 19, 2024 · 1 comment
Labels
bug Something isn't working stale

Comments

@rship12
Copy link

rship12 commented Mar 19, 2024

Hi folks, I'm troubleshooting an issue that I've come across with Sensors. In our trigger, we sequentially call for the creation of several k8s workflow templates. Finally, we create and run a k8s workflow that relies on the previous templates.

Sensor Yaml

apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
  name: create
spec:
  template:
    container:
      envFrom:
        - configMapRef:
            name: {{ .Values.proxy }}
    serviceAccountName: argo-events-events-webhook

  dependencies:
    - name: create
      eventSourceName: webhook
      eventName: create
  
  triggers:

    - template:
        name: wft-worker-containers
        k8s:
          group: argoproj.io
          version: v1alpha1
          resource: workflowtemplates
          operation: patch
          source:
            s3:
              bucket:
              ...omitted...

    - template:
        name: wft-tests
        k8s:
          group: argoproj.io
          version: v1alpha1
          resource: workflowtemplates
          operation: patch
          source:
            s3:
              bucket:
              ...omitted...

    - template:
        name: wft-eks-core
        k8s:
          group: argoproj.io
          version: v1alpha1
          resource: workflowtemplates
          operation: patch
          source:
            s3:
              bucket:
              ...omitted...

    - template:
        name: wft-install-eks-addons
        k8s:
          group: argoproj.io
          version: v1alpha1
          resource: workflowtemplates
          operation: patch
          source:
            s3:
              bucket:
              ...omitted...
                
    - template:
        name: wft-uninstall-eks-addons
        k8s:
          group: argoproj.io
          version: v1alpha1
          resource: workflowtemplates
          operation: patch
          source:
            s3:
              bucket:
              ...omitted...

    - template:
        name: create
        k8s:
          group: argoproj.io
          version: v1alpha1
          resource: workflows
          operation: create
          source:
            s3:
              bucket:
              ...omitted...

The issue that arises is when the Sensor is called for the first time, we get the following error from the workflow:

"invalid spec: templates.create.tasks.test-preflight template reference tests.preflight-tests not found"

In this case, the workflow couldn't find a reference from our wtf-tests template (created within the trigger). When I call the sensor a second time, the workflow is able to complete without issue.

I recreated the scenario several times and occasionally the workflow will complete successfully on the first call. Most times, however, a second call is needed. This leads me to believe that the entries in the trigger section either aren't called sequentially, or do not wait for the previous steps to complete. I guess what I'm trying to figure out is if this is the intended behavior or a possible bug?

Environment:

  • Kubernetes: v 1.27
  • Argo: v 3.5.4
  • Argo Events: v 1.9.0

Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

@rship12 rship12 added the bug Something isn't working label Mar 19, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has not had
any activity in the last 60 days. It will be closed if no further activity
occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

1 participant