Skip to content

Question / issue : '--exclude' failing when used on KUBECTL_EXTERNAL_DIFF #558

@alvarogonzalez-packlink

Description

So I'm using dyff between as a KUBECTL_EXTERNAL_DIFF, and in general it works correctly like this:

export KUBECTL_EXTERNAL_DIFF="dyff between -b "
❯ kubectl -n tools diff -f ./mongodb-cronjob.yaml

metadata.generation
  ± value change
    - 24
    + 25

spec.jobTemplate.spec.template.spec.containers.mongo.image
  ± value change
    - some/mongoimage:1.3.0
    + some/mongoimage:1.4.0

But I wanted to remove the metadata.generation changes, so I added an --exclude option. But then it fails to work:

export KUBECTL_EXTERNAL_DIFF="dyff between -b --exclude 'metadata.generation'"
❯ kubectl -n tools diff -f ./mongodb-cronjob.yaml
╭ Error occurred
│ accepts 2 arg(s), received 1
╵

When I use it on that same yaml on disk, it works properly:

❯ dyff between -b --exclude "metadata.generation" mongo1.yaml mongo2.yaml

spec.jobTemplate.spec.template.spec.containers.mongo.image
  ± value change
    - some/mongoimage:1.3.0
    + some/mongoimage:1.4.0

Testing

  • dyff version 1.10.2
  • macOS 15.7.1 ARM
  • kubectl version
    Client Version: v1.33.3
    Kustomize Version: v5.6.0
    Server Version: v1.32.8-gke.1170000
  • I've tried a bunch of different escaping and quoting options for the exclude parameter, like \"metadata.generation\" or "metadata.generation", but cannot remember all of them... 😬

Question

  • Am I maybe breaking Kubernetes object detection with the exclude option?
  • Can I setup any debug mode that shows me the full command line kubectl is passing to dyff ?
    Adding the --v 9 verbose lebel to kubectl shows tracing and API calls, but not dyffcalls
  • Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions