Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Dyff only data of confimaps generated with suffix #359

Open
blackjid opened this issue Apr 8, 2024 · 1 comment · May be fixed by #409
Open

Dyff only data of confimaps generated with suffix #359

blackjid opened this issue Apr 8, 2024 · 1 comment · May be fixed by #409

Comments

@blackjid
Copy link

blackjid commented Apr 8, 2024

Is there a way to tell dyff to match to resources by labels, o maybe a regex of the name?

I use dyff to show the diff of the result of a kustomize build on a pull request. We are using the configmapGenerator with the suffix option enabled. So when any key in the configmap changes the name of the configmap also changes and dyff explains that as the whole configmap has been removed and an new one has been added.

It is difficult to see what keys really changed and it add a bit of noise to the PRs.

I understand is a bit off an edge case, and dyff is really doing it correctly, telling mi what resources are new and what resourcese has been deleted.

I wonder how other people use dyff with the configMapGenerator from kustomize.

@AndiDog
Copy link

AndiDog commented Apr 23, 2024

I also have a case where a hash is added like name: this-is-constant-<hashed suffix>.

With dyff v1.7.1, you get this output:

$ for n in 1 2; do kubectl create configmap -o yaml --dry-run=client --from-literal=key="value-${n}" "conf-${n}" > /tmp/"${n}"; done; dyff between --set-exit-code --ignore-order-changes --omit-header --use-go-patch-style /tmp/{1,2}

(file level)
  - one document removed:           ---
    ---                             apiVersion: v1
    apiVersion: v1                  data:
    data:                           │ key: value-2
    │ key: value-1                  kind: ConfigMap
    kind: ConfigMap                 metadata:
    metadata:                       │ name: conf-2
    │ name: conf-1                  │ creationTimestamp: null
    │ creationTimestamp: null

At best, dyff would detect that most of the non-name content is the same, and detect this situation as rename. Similar to Git's heuristic rewrite detection.

motoki317 added a commit to motoki317/dyff that referenced this issue Oct 24, 2024
@motoki317 motoki317 linked a pull request Oct 24, 2024 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants