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(controller): show invalid spec on cronwf res #13926

Closed
wants to merge 1 commit into from

Conversation

carlosrodfern
Copy link
Contributor

Fixes: #6781

Motivation

Help the user see the validation errors on the cronwf resources early, before they find out later that the workflow didn't trigger.

Modifications

Add the event to the description of the cronwf, e.g.

Events:
  Type     Reason     Age   From                 Message
  ----     ------     ----  ----                 -------
  Warning  Invalid  14s   workflow-controller  cron workflow name "test-cron-wf-very-very-very-very-very-very-very-very-very-very-very-very-long" must not be more than 52 characters long (currently 77)

Verification

I created my own image of workflow-controller and deployed it in a local k3s kubernetes with argo-workflow.

I used this artifact as a test:

apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
  name: test-cron-wf-very-very-very-very-very-very-very-very-very-very-very-very-long
spec:
  schedule: "5 * * * *"
  concurrencyPolicy: "Replace"
  startingDeadlineSeconds: 0
  workflowSpec:
    entrypoint: date
    templates:
    - name: date
      container:
        image: alpine:3.6
        command: [sh, -c]
        args: ["date; sleep 90"]

Fixes: argoproj#6781

Signed-off-by: Carlos Rodriguez-Fernandez <[email protected]>
@carlosrodfern
Copy link
Contributor Author

carlosrodfern commented Nov 22, 2024

I'm still investigating the possibiilty to actually make it a status, e.g. Ready if the cronworkflow is good, or something else otherwise. The goal is that if I deploy an invalid cronworkflow with ArgoCD, for example, the health status of the cronworkflow would be failed because of invalid spec, and ArgoCD would mark the app syncing as failed.

Copy link
Contributor

@tooptoop4 tooptoop4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if woc.controller.Config.WorkflowEvents.IsEnabled() { like https://github.com/argoproj/argo-workflows/pull/13746/files

@Joibel
Copy link
Member

Joibel commented Nov 22, 2024

There is already a metric for this.

The best solution is an admission controller which will reject them. This is started in #13879

@carlosrodfern
Copy link
Contributor Author

There is already a metric for this.

The best solution is an admission controller which will reject them. This is started in #13879

That looks like the best solution. That specific PR is for the Workflow artifact. We would need another validating webhook for CronWorkflow, and even for the WorkflowTemplates as well, correct?

@Joibel
Copy link
Member

Joibel commented Nov 22, 2024

That looks like the best solution. That specific PR is for the Workflow artifact. We would need another validating webhook for CronWorkflow, and even for the WorkflowTemplates as well, correct?

Yes. Initially getting it in with the framework is the hard part, but then it should be extended to cover those two, ClusterWFTemplates, and EventBindings to cover all the "user facing" custom resources.

@carlosrodfern
Copy link
Contributor Author

carlosrodfern commented Nov 22, 2024

That looks like the best solution. That specific PR is for the Workflow artifact. We would need another validating webhook for CronWorkflow, and even for the WorkflowTemplates as well, correct?

Yes. Initially getting it in with the framework is the hard part, but then it should be extended to cover those two, ClusterWFTemplates, and EventBindings to cover all the "user facing" custom resources.

Awesome :). I'll close this PR then, and I'll just watch the one being worked on, to then bring a new PR extending the new webhook 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

argo cron should report when CronWorkflow names exceed the length limit
3 participants