Skip to content

Add diffyml as a backend (alongside dyff) #1

@szhekpisov

Description

@szhekpisov

Description

Add -o diffyml as a third output format, alongside the existing diff and dyff backends.

Motivation

kubectl-diff-watch already supports dyff as a structural-diff backend. diffyml is a similar YAML-aware diff library with a few properties that fit this plugin well:

  • Single module dependency (yaml.v3) — much lighter dep tree than dyff, which matters for a kubectl plugin distributed via krew.
  • Kubernetes-aware — matches resources by apiVersion + kind + name/generateName, handles --ignore-api-version for API migrations, detects renames by content similarity.
  • Inline word-level highlighting in the default formatter.
  • Performance — ~1.5–9× faster than dyff on the benchmarks in PERFORMANCE.md, which adds up when watching frequently-changing resources.

For the watch use case specifically, the K8s-aware matching is mostly a no-op (single resource, identity stable), but the lighter dependency footprint and inline highlighting are concrete wins.

Proposed UX

kubectl diff-watch deployment myapp -o diffyml

Mirroring how -o dyff is wired today.

Implementation

diffyml exposes a library API at github.com/szhekpisov/diffyml/pkg/... (see pkg.go.dev). Happy to open the PR myself if you're open to it.

And thanks for the plugin — it's a nice tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions