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

argo lint is not case sensitive #13006

Open
3 of 4 tasks
martin-redmaple opened this issue May 3, 2024 · 2 comments
Open
3 of 4 tasks

argo lint is not case sensitive #13006

martin-redmaple opened this issue May 3, 2024 · 2 comments
Labels
area/cli The `argo` CLI P2 Important. All bugs with >=3 thumbs up that aren’t P0 or P1, plus: Any other bugs deemed important type/bug

Comments

@martin-redmaple
Copy link

Pre-requisites

  • I have double-checked my configuration
  • 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.
  • 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)

What happened/what did you expect to happen?

When attempting to lint a CronWorkflow definition file, argo lint does not detect keys with incorrect capitalisation. If these are applied using kubectl, then the cron workflow does not work as expected. Using argo cron create works, as this tool appears to correct the capitalisation.

See example below, with upper case U in schedUle. I would expect argo lint to produce an error. Instead it produces the following:

➜  argo lint cronWorkflow.yaml
✔ no linting errors found!

Version

v3.5.6

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.

apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
  name: test-cronworkflow
  namespace: argo
spec:
  schedUle: "30 13 * * *"
  timezone: "Europe/London"
  workflowspec:
    entrypoint: main
    templates:
      - name: main
        steps:
          - - name: 1-test-echo
              template: test-echo
      - name: test-echo
        container:
          image: alpine:3.7
          command: [echo, "Hello world"]

Logs from the workflow controller

N/A

Logs from in your workflow's wait container

N/A
@agilgur5 agilgur5 added area/cli The `argo` CLI P2 Important. All bugs with >=3 thumbs up that aren’t P0 or P1, plus: Any other bugs deemed important labels May 3, 2024
@miltalex
Copy link
Contributor

miltalex commented May 6, 2024

I could have a look.

@miltalex
Copy link
Contributor

miltalex commented May 10, 2024

I checked a bit the codebase and it seems that the issues traces to the case-insensitivity from golang's encoding/json. The encoding/json will unmarshal both schedule and schedUle and therefore the argo lint command will not complain.

We could use a json package from kubernetes-sig project , which allows unmarshaling with case-sensitive field tags. That will work only on the strict mode and the spec.schedUle will be reported as an unknown field. On non-strict it will not be reported, cause of the unknown field opt not enabled.

image

However since the jsonpkg is coming from argoproj/pkg it will always accept something like schedUle when you submit the wf. And finally another option would be to develop a checker for the keys against the schema which will be a bit more complicated approach.

edit: argo lint is by default running on strict mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli The `argo` CLI P2 Important. All bugs with >=3 thumbs up that aren’t P0 or P1, plus: Any other bugs deemed important type/bug
Projects
None yet
Development

No branches or pull requests

3 participants