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: Rename detection for Kubernetes resources #409

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

motoki317
Copy link

@motoki317 motoki317 commented Oct 24, 2024

Hello!

This pull request adds git-like rename detection logic for Kubernetes documents comparison.
For now, I have implemented this only for Kubernetes resources, whose name "keys" can be computed from metadata.name and other fields.
This is because additions and deletions can be computed only if these "keys" are present.

The heuristic rename detection logic was mostly taken from https://github.com/go-git/go-git.

I would love to use this feature in my use-case, that is, using configMapGenerator with kustomize.
Currently, changing file contents a little bit results in a huge diff, because the kustomize adds hash suffix to resource names.
This use-case is added as a test case under ./assets/kubernetes/rename directory.
Example of real-life use-case: traPtitech/manifest#600 (comment)

The implementation may still be rough-cut, so please feel free to correct or point out anything you don't like.

I've prepared a (pre-)release in my forked repository so you can install it and try it out with the following one-line script.
https://github.com/motoki317/dyff/releases

curl --silent --location https://git.io/JYfAY | ORG=motoki317 REPO=dyff bash

Thank you in advance!

resolves #359

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.

Dyff only data of confimaps generated with suffix
1 participant