litmus icon indicating copy to clipboard operation
litmus copied to clipboard

Custom CronWorkflow Schedule Not Respected

Open cryslam opened this issue 3 years ago • 4 comments
trafficstars

What happened: When creating custom cron workflows in chaos center by importing the YAML as shown here the schedule isn't recognized/ respected.

What you expected to happen: If importing YAML or using pre-defined chaos workflow from my own custom chaos hub, the cron workflow schedule set in YAML is not recognized/ respected and it's required to set a schedule through UI. Next the YAML looks like this -- with two schedules:

kind: CronWorkflow
metadata:
  name: custom-workflow-1646680408
  namespace: litmus
  labels:
    subject: custom-workflow-1646680408_litmus
spec:
  schedule: 13 14 * * 0-6
  concurrencyPolicy: Forbid
  startingDeadlineSeconds: 0
  workflowSpec:
    schedule: 00 10 * * 1-5
    concurrencyPolicy: Forbid
    startingDeadlineSeconds: 0
    workflowSpec:
      arguments:
        parameters:```

**How to reproduce it (as minimally and precisely as possible)**:
You can copy or save the YAML I linked above, or any CronWorkflow YAML and import it through chaos center & as you progress through the steps in creating workflow, the schedule set in YAML isn't respected or recognized.

**Anything else we need to know?**: N/A

cryslam avatar Mar 07 '22 20:03 cryslam

cc: @amityt

imrajdas avatar Mar 14 '22 08:03 imrajdas

@amityt @rajdas98 any updates on the above question?

cryslam avatar May 05 '22 19:05 cryslam

Hi @lamc , The workflow that you are importing is wrong according to schema.

The workflow that you are importing is not a cron workflow. Please check the kind in line-2 kind: Workflow, for cron-workflow this should be kind: CronWorkflow

If we look at this section in manifest -

  schedule: 00 10 * * 1-5
  concurrencyPolicy: Forbid
  startingDeadlineSeconds: 0
  workflowSpec:
    arguments:
      parameters:
        - name: adminModeNamespace
          value: litmus
        - name: appNamespace
          value: djin-shared

The above section will be respected only if you provide kind: CronWorkflow, otherwise the workflow will be considered as non cron workflow.

And because ChaosCenter is considering it as non-cron workflow, that's why the final cron workflow looks like as you posted above -

kind: CronWorkflow
metadata:
  name: custom-workflow-1646680408
  namespace: litmus
  labels:
    subject: custom-workflow-1646680408_litmus
spec:
  schedule: 13 14 * * 0-6
  concurrencyPolicy: Forbid
  startingDeadlineSeconds: 0
  workflowSpec:
    schedule: 00 10 * * 1-5
    concurrencyPolicy: Forbid
    startingDeadlineSeconds: 0
    workflowSpec:
      arguments:
        parameters:```

Please change the kind to kind: CronWorkflow and check again. @amityt can add more information.

Jonsy13 avatar Jun 08 '22 04:06 Jonsy13

Hello, I have changed the kind to CronWorkflow in the yaml, however when I still try to schedule workflow it's not respected. here are the steps I take & here is the pre-defined chaos workflow template I use:

  1. Schedule Workflow in Chaos Center
  2. Select agent
  3. Select "create new workflow from one of the pre-defined workflow templates"
  4. Choose "djin-shared-test" (as provided in link above)
  5. Tune and adjust weights
  6. I have to set a schedule either now or recurring

I have checked if my yaml is valid and the indentation/ CronWorkflow resource documentation. Please let me know if I'm missing some steps.

cryslam avatar Jun 10 '22 15:06 cryslam