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: json compare host analyser #1582

Merged
merged 5 commits into from
Jul 24, 2024

Conversation

banjoh
Copy link
Member

@banjoh banjoh commented Jul 19, 2024

Description, Motivation and Context

Add a json compare host analyser that allows types such a HostPreflight to use it. This analyser implementation is the same as for JSON compare in-cluster analyser

Example spec

apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: json-compare-example
spec:
  hostAnalyzers:
    - jsonCompare:
        checkName: Check if we have cgroups enabled
        fileName: host-collectors/cgroups/cgroups.json
        path: "cgroup-enabled"
        value: |
          true
        outcomes:
          - fail:
              when: "false"
              message: The collected data does not match the value.
          - pass:
              when: "true"
              message: The collected data matches the value.

Here is a demo of the analyser in action https://asciinema.org/a/VpfBNWwzYRO5taak15neYEbgX

Fixes: #1579 for the analyser requirement

Checklist

  • New and existing tests pass locally with introduced changes.
  • Tests for the changes have been added (for bug fixes / features)
  • The commit message(s) are informative and highlight any breaking changes
  • Any documentation required has been added/updated. For changes to https://troubleshoot.sh/ create a PR here

Does this PR introduce a breaking change?

  • Yes
  • No

banjoh added 2 commits July 19, 2024 19:32
Signed-off-by: Evans Mungai <evans@replicated.com>
Signed-off-by: Evans Mungai <evans@replicated.com>
@banjoh banjoh requested a review from a team as a code owner July 19, 2024 19:05
@banjoh banjoh added the type::feature New feature or request label Jul 19, 2024
@banjoh banjoh marked this pull request as draft July 19, 2024 19:05
Signed-off-by: Evans Mungai <evans@replicated.com>
@banjoh banjoh mentioned this pull request Jul 19, 2024
6 tasks
@banjoh banjoh marked this pull request as ready for review July 22, 2024 13:45
banjoh added 2 commits July 22, 2024 15:00
Signed-off-by: Evans Mungai <evans@replicated.com>
Signed-off-by: Evans Mungai <evans@replicated.com>
@nvanthao nvanthao self-requested a review July 22, 2024 23:25
Copy link
Member

@nvanthao nvanthao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@diamonwiggins diamonwiggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@banjoh banjoh merged commit 1444c01 into replicatedhq:main Jul 24, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cgroup collector/analyzer
3 participants