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: Add meta.Duration as known type for diffing (issue #6008) #16587

Conversation

matthewhughes934
Copy link
Contributor

So that this can be used for custom resources. The motivation for this
is issue #6008: with this change one should be able to use the known
type to ensure equal durations don't present a diff, e,g. via adding to
argocd-cm:

data:
  resource.customizations.knownTypeFields.cert-manager.io_Certificate: |
    - field: spec.duration
      type: meta/v1/Duration

This change is based on 5b464c9, though
I've included the API version in the type path to be consistent with the
generated type (i.e. meta/v1/Duration and not meta/Duration).

For documentation I've just manually listed the extra types that aren't
auto-generated, though this requires having to keep this list and the
code in-sync but this is probably not a big issue since the number of
extra types is not frequently changed.

In the tests I've used require.* methods since I find this simpler
than if !assert.Blah(...) { return } which the other tests in this
file are using.

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.
  • 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. Note: I've noted the related issue, but I'm not sure if this is sufficient to close that.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them. N/A: nothing to expose
  • Does this PR require documentation updates?
  • []x I've updated documentation as required by this PR.
  • 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.
  • 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.
  • 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).

So that this can be used for custom resources. The motivation for this
is issue argoproj#6008: with this change one should be able to use the known
type to ensure equal durations don't present a diff, e,g. via adding to
`argocd-cm`:

    data:
      resource.customizations.knownTypeFields.cert-manager.io_Certificate: |
        - field: spec.duration
          type: meta/v1/Duration

This change is based on 5b464c9, though
I've included the API version in the type path to be consistent with the
generated type (i.e. `meta/v1/Duration` and not `meta/Duration`).

For documentation I've just manually listed the extra types that aren't
auto-generated, though this requires having to keep this list and the
code in-sync but this is probably not a big issue since the number of
extra types is not frequently changed.

In the tests I've used `require.*` methods since I find this simpler
than `if !assert.Blah(...) { return }` which the other tests in this
file are using.

Signed-off-by: Matthew Hughes <matthewhughes934@gmail.com>
@matthewhughes934 matthewhughes934 requested review from a team as code owners December 10, 2023 09:48
@matthewhughes934 matthewhughes934 changed the title feat: Add meta.Duration as known type for diffing #6008 feat: Add meta.Duration as known type for diffing (issue #6008) Dec 10, 2023
Copy link

codecov bot commented Dec 10, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (07a2e64) 49.49% compared to head (40fe65c) 49.50%.
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #16587   +/-   ##
=======================================
  Coverage   49.49%   49.50%           
=======================================
  Files         270      270           
  Lines       47489    47491    +2     
=======================================
+ Hits        23506    23509    +3     
+ Misses      21672    21671    -1     
  Partials     2311     2311           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@todaywasawesome
Copy link
Contributor

I think this is a solid solution. I wish we could solve it universally.

Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

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

LGTM!!

@ishitasequeira ishitasequeira merged commit a7d0da9 into argoproj:master Dec 14, 2023
26 checks passed
tesla59 pushed a commit to tesla59/argo-cd that referenced this pull request Dec 16, 2023
So that this can be used for custom resources. The motivation for this
is issue argoproj#6008: with this change one should be able to use the known
type to ensure equal durations don't present a diff, e,g. via adding to
`argocd-cm`:

    data:
      resource.customizations.knownTypeFields.cert-manager.io_Certificate: |
        - field: spec.duration
          type: meta/v1/Duration

This change is based on 5b464c9, though
I've included the API version in the type path to be consistent with the
generated type (i.e. `meta/v1/Duration` and not `meta/Duration`).

For documentation I've just manually listed the extra types that aren't
auto-generated, though this requires having to keep this list and the
code in-sync but this is probably not a big issue since the number of
extra types is not frequently changed.

In the tests I've used `require.*` methods since I find this simpler
than `if !assert.Blah(...) { return }` which the other tests in this
file are using.

Signed-off-by: Matthew Hughes <matthewhughes934@gmail.com>
@matthewhughes934 matthewhughes934 deleted the add-meta-duration-as-known-type-for-diffing branch December 20, 2023 10:06
@matthewhughes934
Copy link
Contributor Author

I think this is a solid solution. I wish we could solve it universally.

💯 are you aware of any viable approaches to a general solution?

This was my first time poking around the codebase, so I'm far from aware of all the possible solutions

JulienFuix pushed a commit to JulienFuix/argo-cd that referenced this pull request Feb 6, 2024
So that this can be used for custom resources. The motivation for this
is issue argoproj#6008: with this change one should be able to use the known
type to ensure equal durations don't present a diff, e,g. via adding to
`argocd-cm`:

    data:
      resource.customizations.knownTypeFields.cert-manager.io_Certificate: |
        - field: spec.duration
          type: meta/v1/Duration

This change is based on 5b464c9, though
I've included the API version in the type path to be consistent with the
generated type (i.e. `meta/v1/Duration` and not `meta/Duration`).

For documentation I've just manually listed the extra types that aren't
auto-generated, though this requires having to keep this list and the
code in-sync but this is probably not a big issue since the number of
extra types is not frequently changed.

In the tests I've used `require.*` methods since I find this simpler
than `if !assert.Blah(...) { return }` which the other tests in this
file are using.

Signed-off-by: Matthew Hughes <matthewhughes934@gmail.com>
lyda pushed a commit to lyda/argo-cd that referenced this pull request Mar 28, 2024
So that this can be used for custom resources. The motivation for this
is issue argoproj#6008: with this change one should be able to use the known
type to ensure equal durations don't present a diff, e,g. via adding to
`argocd-cm`:

    data:
      resource.customizations.knownTypeFields.cert-manager.io_Certificate: |
        - field: spec.duration
          type: meta/v1/Duration

This change is based on 5b464c9, though
I've included the API version in the type path to be consistent with the
generated type (i.e. `meta/v1/Duration` and not `meta/Duration`).

For documentation I've just manually listed the extra types that aren't
auto-generated, though this requires having to keep this list and the
code in-sync but this is probably not a big issue since the number of
extra types is not frequently changed.

In the tests I've used `require.*` methods since I find this simpler
than `if !assert.Blah(...) { return }` which the other tests in this
file are using.

Signed-off-by: Matthew Hughes <matthewhughes934@gmail.com>
Signed-off-by: Kevin Lyda <kevin@lyda.ie>
Hariharasuthan99 pushed a commit to AmadeusITGroup/argo-cd that referenced this pull request Jun 16, 2024
So that this can be used for custom resources. The motivation for this
is issue argoproj#6008: with this change one should be able to use the known
type to ensure equal durations don't present a diff, e,g. via adding to
`argocd-cm`:

    data:
      resource.customizations.knownTypeFields.cert-manager.io_Certificate: |
        - field: spec.duration
          type: meta/v1/Duration

This change is based on 5b464c9, though
I've included the API version in the type path to be consistent with the
generated type (i.e. `meta/v1/Duration` and not `meta/Duration`).

For documentation I've just manually listed the extra types that aren't
auto-generated, though this requires having to keep this list and the
code in-sync but this is probably not a big issue since the number of
extra types is not frequently changed.

In the tests I've used `require.*` methods since I find this simpler
than `if !assert.Blah(...) { return }` which the other tests in this
file are using.

Signed-off-by: Matthew Hughes <matthewhughes934@gmail.com>
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.

3 participants