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(analyzer): enable host os info analyzer to support multiple nodes #1618

Merged
merged 26 commits into from
Sep 25, 2024

Conversation

DexterYan
Copy link
Member

@DexterYan DexterYan commented Sep 19, 2024

Description, Motivation and Context

following PR #1608

  • enable host info analyzer to analyzer multiple nodes
  • save node list into system/hostos_info_nodes.json
  • split collect results into system/nodename/hostos_info.json
  • analyzer result and add node name in the title
  • add tests

Demo Spec

apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: sb
  runHostCollectorsInPod: true  # default is false 
spec:
  hostCollectors:
  - hostOS: {}
  hostAnalyzers:
  - hostOS:
        outcomes:
          - pass:
              when: "ubuntu >= 22.04"
              message: "Ubuntu 22.04 is supported"
          - fail:
              when: "ubuntu <= 16.04"
              message: "Ubuntu 16.04 is not supported"

Folders Structure:
Screenshot 2024-09-19 at 5 00 05 PM

Analyzer Result:

[
    {
        "name": "host.os.info.node.minikube",
        "labels": {
            "desiredPosition": "1",
            "iconKey": "",
            "iconUri": ""
        },
        "insight": {
            "name": "host.os.info.node.minikube",
            "labels": {
                "iconKey": "",
                "iconUri": ""
            },
            "primary": "Host OS Info - Node minikube",
            "detail": "Ubuntu 22.04 is supported",
            "severity": "debug"
        },
        "severity": "debug",
        "analyzerSpec": ""
    }
]

Multiple Nodes:
Screenshot 2024-09-20 at 10 08 59 AM

result:

[
    {
        "name": "host.os.info.node.multinode.demo.m02",
        "labels": {
            "desiredPosition": "1",
            "iconKey": "",
            "iconUri": ""
        },
        "insight": {
            "name": "host.os.info.node.multinode.demo.m02",
            "labels": {
                "iconKey": "",
                "iconUri": ""
            },
            "primary": "Host OS Info - Node multinode-demo-m02",
            "detail": "Ubuntu 22.04 is supported",
            "severity": "debug"
        },
        "severity": "debug",
        "analyzerSpec": ""
    },
    {
        "name": "host.os.info.node.multinode.demo.m02.node.multinode.demo",
        "labels": {
            "desiredPosition": "1",
            "iconKey": "",
            "iconUri": ""
        },
        "insight": {
            "name": "host.os.info.node.multinode.demo.m02.node.multinode.demo",
            "labels": {
                "iconKey": "",
                "iconUri": ""
            },
            "primary": "Host OS Info - Node multinode-demo-m02 - Node multinode-demo",
            "detail": "Ubuntu 22.04 is supported",
            "severity": "debug"
        },
        "severity": "debug",
        "analyzerSpec": ""
    }
]

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

@DexterYan DexterYan requested a review from a team as a code owner September 19, 2024 20:00
@DexterYan DexterYan added the type::feature New feature or request label Sep 19, 2024
@DexterYan DexterYan changed the base branch from dx/sc-111270/host-os-collector to main September 20, 2024 15:29
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, only 1 nit suggest

@DexterYan DexterYan requested a review from nvanthao September 23, 2024 21:16
@xavpaice
Copy link
Member

the main thing to review here is that we have a ..._nodes.json that lists the nodes which were collected, and the analyzer then uses that to find the appropriate files. We chose this over wildcard as it is more precise, a wildcard could pick up stuff we don't want if we later change the collector to add more files (like raw output).

@DexterYan
Copy link
Member Author

Now the code has been improved to create only one file called node_list.json which has all the node name. It can be used for all host collectors without duplicated.

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

@DexterYan DexterYan merged commit 142015c into main Sep 25, 2024
26 checks passed
@DexterYan DexterYan deleted the dx/sc-112288/hostname-path branch September 25, 2024 22:25
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.

3 participants