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

Return a detailed diff from Diff. #618

Merged
merged 6 commits into from
Jul 3, 2019
Merged

Return a detailed diff from Diff. #618

merged 6 commits into from
Jul 3, 2019

Conversation

pgavlin
Copy link
Member

@pgavlin pgavlin commented Jul 3, 2019

These changes add support for detailed diffs to the Kubernetes provider.
The detailed diff is calculated by computing a JSON merge patch between
the desired and new state, recursively walking the result, and recording
the difference at each leaf property as indicated by the patch.

The particular difference that is recorded for a property depends on the
old and new values:

  • If the patched value is nil, the property is recorded as deleted
  • If the old value is nil, the property is recorded as added
  • If the types of the old and new values differ, the property is recorded
    as updated
  • If both values are maps, the maps are recursively compared on a
    per-property basis and added to the diff
  • If both values are arrays, the arrays are recursively compared on a
    per-element basis and added to the diff
  • If both values are primitives and the values differ, the property is
    recorded as updated
  • Otherwise, no diff is recorded.

If a difference is present at a path and the path matches one of the
patterns in the database of force-new properties, the diff is amended to
indicate that the resource needs to be replaced due to the change in
this property.

These changes add support for detailed diffs to the Kubernetes provider.
The detailed diff is calculated by computing a JSON merge patch between
the desired and new state, recursively walking the result, and recording
the difference at each leaf property as indicated by the patch.

The particular difference that is recorded for a property depends on the
old and new values:
- If the patched value is nil, the property is recorded as deleted
- If the old value is nil, the property is recorded as added
- If the types of the old and new values differ, the property is recorded
  as updated
- If both values are maps, the maps are recursively compared on a
  per-property basis and added to the diff
- If both values are arrays, the arrays are recursively compared on a
  per-element basis and added to the diff
- If both values are primitives and the values differ, the property is
  recorded as updated
- Otherwise, no diff is recorded.

If a difference is present at a path and the path matches one of the
patterns in the database of force-new properties, the diff is amended to
indicate that the resource needs to be replaced due to the change in
this property.
Copy link
Member

@lblackstone lblackstone left a comment

Choose a reason for hiding this comment

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

Looks good overall. Would be nice to see a screenshot of the new diff output in the CLI.

CHANGELOG.md Outdated Show resolved Hide resolved
pkg/metadata/labels.go Outdated Show resolved Hide resolved
pkg/metadata/labels.go Outdated Show resolved Hide resolved
pkg/provider/provider.go Outdated Show resolved Hide resolved
pkg/provider/provider.go Show resolved Hide resolved
pgavlin and others added 4 commits July 3, 2019 10:56
Co-Authored-By: Levi Blackstone <levi@pulumi.com>
Co-Authored-By: Levi Blackstone <levi@pulumi.com>
Co-Authored-By: Levi Blackstone <levi@pulumi.com>
@pgavlin pgavlin requested a review from lblackstone July 3, 2019 18:08
@pgavlin
Copy link
Member Author

pgavlin commented Jul 3, 2019

Looks like the Istio test failed. @lblackstone can you help me interpret the output? It looks like the failure is unrelated, but I'm not sure.

@lblackstone
Copy link
Member

@pgavlin Yeah, it looks like a couple of the Pods failed to start for some reason, so it's probably a flake. I restarted the job.

@pgavlin pgavlin merged commit a30c8ea into master Jul 3, 2019
@pulumi-bot pulumi-bot deleted the pgavlin/detailedDiff branch July 3, 2019 19:40
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.

None yet

2 participants