replicatedhq / troubleshoot

Preflight Checks and Support Bundles Framework for Kubernetes Applications
https://troubleshoot.sh
Apache License 2.0
543 stars 92 forks source link

Host analysers are not deduplicating during multiple spec merges #1485

Closed ricardomaraschini closed 3 months ago

ricardomaraschini commented 6 months ago

Bug Description

If I have the same host analyser defined in two different specs they end up showing twice when I run kubectl support-bundle spec0 spec1. The same does not happen with a regular analyser, only with host analysers. It seems like the same deduplication applied for analysers is not applied for host analysers.

Expected Behavior

My duplicated host analyser to show up only once.

Steps To Reproduce

Create two specs with the same host analyser:

apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: embedded-cluster-host-support-bundle
spec:
  hostCollectors:
  - memory: {}
  hostAnalyzers:
  - memory:
      checkName: Amount of Memory
      outcomes:
      - warn:
          when: "< 2G"
          message: At least 2G of memory is recommended
      - pass:
          message: The system has at least 2G of memory

Then run the support-bundle passing both specs:

kubectl support-bundle spec0.yaml spec1.yaml

With the --dry-run flag I can see that the same host analyser is duplicated in the merged result.