-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat: Add meta.Duration as known type for diffing (issue #6008) #16587
Conversation
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>
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
I think this is a solid solution. I wish we could solve it universally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
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>
💯 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 |
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>
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>
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>
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
: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 notmeta/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 simplerthan
if !assert.Blah(...) { return }
which the other tests in thisfile are using.
Checklist: