-
Notifications
You must be signed in to change notification settings - Fork 6.6k
fix: respect ignore differences for individual array elements in CRDs #24197
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: respect ignore differences for individual array elements in CRDs #24197
Conversation
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
|
The problem that I'm stuck at right now is how to get the OpenAPISchema for CRDs in order to use that in my tests. Can anyone provide some hints here? |
|
Here is how open api schema is loaded from real cluster: oapiGetter := openapi.NewOpenAPIGetter(disco)
oapiResources, err := openapi.NewOpenAPIParser(oapiGetter).Parse()I suggest to create fake implementation of type OpenAPISchemaInterface interface {
// OpenAPISchema retrieves and parses the swagger API schema the server supports.
OpenAPISchema() (*openapi_v2.Document, error)
} |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #24197 +/- ##
==========================================
+ Coverage 60.32% 60.34% +0.01%
==========================================
Files 350 350
Lines 60047 60072 +25
==========================================
+ Hits 36224 36250 +26
+ Misses 20912 20905 -7
- Partials 2911 2917 +6 ☔ View full report in Codecov by Sentry. |
c749e22 to
af54a98
Compare
|
@nitishfy looks reasonable to me, apart from the linting issues |
controller/sync.go
Outdated
| } | ||
| if lookupPatchMeta != nil { | ||
| return strategicpatch.CreateThreeWayMergePatch(modifiedJSON, modifiedJSON, originalJSON, lookupPatchMeta, true) | ||
| return strategicpatch.CreateThreeWayMergePatch(originalJSON, modifiedJSON, originalJSON, lookupPatchMeta, true) |
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.
Why does this change from modifiedJSON to originalJSON?
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.
I ran the unit tests and they were unaffected when switching it back to the previous impl - so my question remains, why do we need to modify the merge patch?
Can you add a test which needs this (alternatively create a test that fails if this were to be modified)?
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.
I can't remember why i modified this field. I looked at it again today and i think it makes sense to keep the field as it was initially.
controller/sync.go
Outdated
| } | ||
| if lookupPatchMeta != nil { | ||
| return strategicpatch.CreateThreeWayMergePatch(modifiedJSON, modifiedJSON, originalJSON, lookupPatchMeta, true) | ||
| return strategicpatch.CreateThreeWayMergePatch(originalJSON, modifiedJSON, originalJSON, lookupPatchMeta, true) |
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.
I ran the unit tests and they were unaffected when switching it back to the previous impl - so my question remains, why do we need to modify the merge patch?
Can you add a test which needs this (alternatively create a test that fails if this were to be modified)?
Signed-off-by: nitishfy <[email protected]>
Signed-off-by: nitishfy <[email protected]>
Signed-off-by: nitishfy <[email protected]>
Signed-off-by: nitishfy <[email protected]>
Signed-off-by: nitishfy <[email protected]>
Signed-off-by: nitishfy <[email protected]>
Signed-off-by: nitishfy <[email protected]>
Signed-off-by: nitishfy <[email protected]>
Signed-off-by: nitishfy <[email protected]> remove skip statement Signed-off-by: nitishfy <[email protected]>
Signed-off-by: nitishfy <[email protected]>
6578fe4 to
fd9e2e8
Compare
… in CRDs (argoproj#24197)" This reverts commit 22d3ef0. Signed-off-by: Blake Pettersson <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]> Co-authored-by: Blake Pettersson <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]> Signed-off-by: Revital Barletz <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>
Fixes #17694
Checklist: