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

fix: Pass logger to differ in diff command #17871

Merged

Conversation

matthewhughes-uw
Copy link
Contributor

@matthewhughes-uw matthewhughes-uw commented Apr 17, 2024

So that log messages are propagated up, this caused issues for me when trying to diagnose an issue linked to issue #17811. I've just copied the approach used e.g. in controller/appcontroller.go when calling argodiff.NewDiffConfigBuilder.

Sample output before this change:

$ argocd --loglevel debug --server argocd-system.dev.aws.uw.systems app diff dev-enablement/dev-enablement

===== apps/Deployment dev-enablement/go-docs ======
272c272
<             cpu: "0"
---
>             cpu: 0m
275c275
<             cpu: "0"
---
>             cpu: 0m

Output with this change:

$ argocd --loglevel debug --server argocd-system.dev.aws.uw.systems app diff dev-enablement/dev-enablement
INFO[0000] Could not unmarshal to object of type apps/v1, Kind=Deployment: json: unknown field "restartPolicy"
INFO[0000] Could not unmarshal to object of type apps/v1, Kind=Deployment: json: unknown field "restartPolicy"

===== apps/Deployment dev-enablement/go-docs ======
272c272
<             cpu: "0"
---
>             cpu: 0m
275c275
<             cpu: "0"
---
>             cpu: 0m
INFO[0000] Could not create new object of type argoproj.io/v1alpha1, Kind=Application: no kind "Application" is registered for version "argoproj.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
INFO[0000] Could not create new object of type argoproj.io/v1alpha1, Kind=Application: no kind "Application" is registered for version "argoproj.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes. (b) this is a bug fix
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue. N/A
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them. N/A
  • Does this PR require documentation updates? N/A
  • I've updated documentation as required by this PR. N/A
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged. N/A
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves. N/A
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@matthewhughes-uw matthewhughes-uw requested a review from a team as a code owner April 17, 2024 12:19
@matthewhughes-uw matthewhughes-uw force-pushed the pass-logger-to-diff-log branch from fb7783b to 712db3c Compare April 17, 2024 12:20
@matthewhughes-uw matthewhughes-uw changed the title Pass logger to differ in diff command fix: Pass logger to differ in diff command Apr 17, 2024
@matthewhughes-uw matthewhughes-uw force-pushed the pass-logger-to-diff-log branch from 712db3c to 543858f Compare April 17, 2024 12:23
So that log messages are propagated up, this caused issues for me when
trying to diagnose an issue linked to issue argoproj#17811. I've just copied the
approach used e.g. in `controller/appcontroller.go` when calling
`argodiff.NewDiffConfigBuilder`.

Sample output before this change:

    $ argocd --loglevel debug --server argocd-system.dev.aws.uw.systems app diff dev-enablement/dev-enablement

    ===== apps/Deployment dev-enablement/go-docs ======
    272c272
    <             cpu: "0"
    ---
    >             cpu: 0m
    275c275
    <             cpu: "0"
    ---
    >             cpu: 0m

Output with this change:

    $ argocd --loglevel debug --server argocd-system.dev.aws.uw.systems app diff dev-enablement/dev-enablement
    INFO[0000] Could not unmarshal to object of type apps/v1, Kind=Deployment: json: unknown field "restartPolicy"
    INFO[0000] Could not unmarshal to object of type apps/v1, Kind=Deployment: json: unknown field "restartPolicy"

    ===== apps/Deployment dev-enablement/go-docs ======
    272c272
    <             cpu: "0"
    ---
    >             cpu: 0m
    275c275
    <             cpu: "0"
    ---
    >             cpu: 0m
    INFO[0000] Could not create new object of type argoproj.io/v1alpha1, Kind=Application: no kind "Application" is registered for version "argoproj.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type argoproj.io/v1alpha1, Kind=Application: no kind "Application" is registered for version "argoproj.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"

Signed-off-by: Matt Hughes <mhughes@uw.co.uk>
@matthewhughes-uw matthewhughes-uw force-pushed the pass-logger-to-diff-log branch from 543858f to 1853936 Compare April 17, 2024 12:33
Copy link
Member

@pasha-codefresh pasha-codefresh left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@pasha-codefresh pasha-codefresh merged commit 2031a07 into argoproj:master Apr 17, 2024
27 checks passed
@matthewhughes-uw matthewhughes-uw deleted the pass-logger-to-diff-log branch April 17, 2024 14:44
mkieweg pushed a commit to mkieweg/argo-cd that referenced this pull request Jun 11, 2024
So that log messages are propagated up, this caused issues for me when
trying to diagnose an issue linked to issue argoproj#17811. I've just copied the
approach used e.g. in `controller/appcontroller.go` when calling
`argodiff.NewDiffConfigBuilder`.

Sample output before this change:

    $ argocd --loglevel debug --server argocd-system.dev.aws.uw.systems app diff dev-enablement/dev-enablement

    ===== apps/Deployment dev-enablement/go-docs ======
    272c272
    <             cpu: "0"
    ---
    >             cpu: 0m
    275c275
    <             cpu: "0"
    ---
    >             cpu: 0m

Output with this change:

    $ argocd --loglevel debug --server argocd-system.dev.aws.uw.systems app diff dev-enablement/dev-enablement
    INFO[0000] Could not unmarshal to object of type apps/v1, Kind=Deployment: json: unknown field "restartPolicy"
    INFO[0000] Could not unmarshal to object of type apps/v1, Kind=Deployment: json: unknown field "restartPolicy"

    ===== apps/Deployment dev-enablement/go-docs ======
    272c272
    <             cpu: "0"
    ---
    >             cpu: 0m
    275c275
    <             cpu: "0"
    ---
    >             cpu: 0m
    INFO[0000] Could not create new object of type argoproj.io/v1alpha1, Kind=Application: no kind "Application" is registered for version "argoproj.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type argoproj.io/v1alpha1, Kind=Application: no kind "Application" is registered for version "argoproj.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"

Signed-off-by: Matt Hughes <mhughes@uw.co.uk>
Hariharasuthan99 pushed a commit to AmadeusITGroup/argo-cd that referenced this pull request Jun 16, 2024
So that log messages are propagated up, this caused issues for me when
trying to diagnose an issue linked to issue argoproj#17811. I've just copied the
approach used e.g. in `controller/appcontroller.go` when calling
`argodiff.NewDiffConfigBuilder`.

Sample output before this change:

    $ argocd --loglevel debug --server argocd-system.dev.aws.uw.systems app diff dev-enablement/dev-enablement

    ===== apps/Deployment dev-enablement/go-docs ======
    272c272
    <             cpu: "0"
    ---
    >             cpu: 0m
    275c275
    <             cpu: "0"
    ---
    >             cpu: 0m

Output with this change:

    $ argocd --loglevel debug --server argocd-system.dev.aws.uw.systems app diff dev-enablement/dev-enablement
    INFO[0000] Could not unmarshal to object of type apps/v1, Kind=Deployment: json: unknown field "restartPolicy"
    INFO[0000] Could not unmarshal to object of type apps/v1, Kind=Deployment: json: unknown field "restartPolicy"

    ===== apps/Deployment dev-enablement/go-docs ======
    272c272
    <             cpu: "0"
    ---
    >             cpu: 0m
    275c275
    <             cpu: "0"
    ---
    >             cpu: 0m
    INFO[0000] Could not create new object of type argoproj.io/v1alpha1, Kind=Application: no kind "Application" is registered for version "argoproj.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type argoproj.io/v1alpha1, Kind=Application: no kind "Application" is registered for version "argoproj.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
    INFO[0000] Could not create new object of type traefik.containo.us/v1alpha1, Kind=IngressRoute: no kind "IngressRoute" is registered for version "traefik.containo.us/v1alpha1" in scheme "pkg/runtime/scheme.go:100"

Signed-off-by: Matt Hughes <mhughes@uw.co.uk>
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.

2 participants