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): allow templating for Node Resources Analyzer #1605

Merged
merged 2 commits into from
Sep 1, 2024

Conversation

DexterYan
Copy link
Member

@DexterYan DexterYan commented Aug 29, 2024

Description, Motivation and Context

  • align Architecture to CPUArchitecture
  • allow message templating with troubleshootv1beta2.NodeResourceFilters and NodeCount
  • add test

test support bundle yaml

  • multiple filter
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: sample
spec:
  collectors:
    - clusterInfo: {}
  analyzers:
    - nodeResources:
        filters:
          cpuArchitecture: arm64
          cpuCapacity: "2"        
        checkName: Must have at least 3 nodes in the cluster
        outcomes:
          - fail:
              when: "count() < 3"
              message: "This application requires at least 3 nodes. {{ .CPUArchitecture }}-{{ .CPUCapacity }}, it should only return the {{ .NodeCount }} nodes that match that filter"
          - warn:
              when: "count() < 5"
              message: This application recommends at last 5 nodes.
          - pass:
              message: This cluster has enough nodes.

Screenshot 2024-08-30 at 3 07 29 PM
  • simple filter
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: sample
spec:
  collectors:
    - clusterInfo: {}
  analyzers:
    - nodeResources:
        filters:
          cpuArchitecture: arm64 
        checkName: Must have at least 3 nodes in the cluster
        outcomes:
          - fail:
              when: "count() < 3"
              message: "This application requires at least 3 nodes. {{ .CPUArchitecture }}, it should only return the {{ .NodeCount }} nodes that match that filter"
          - warn:
              when: "count() < 5"
              message: This application recommends at last 5 nodes.
          - pass:
              message: This cluster has enough nodes.

Screenshot 2024-08-30 at 3 08 00 PM

sc-110574

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 added the type::feature New feature or request label Aug 29, 2024
@DexterYan DexterYan requested a review from a team as a code owner August 29, 2024 05:59
@DexterYan DexterYan marked this pull request as draft August 29, 2024 05:59
@DexterYan DexterYan marked this pull request as ready for review August 30, 2024 03:11
@DexterYan DexterYan changed the title WIP: feat(analyzer): allow templating for Node Resources Analyzer feat(analyzer): allow templating for Node Resources Analyzer Aug 30, 2024
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 0a2c9c7 into main Sep 1, 2024
50 of 51 checks passed
@DexterYan DexterYan deleted the dx/sc-110574/allow-templating-node-resources-msg branch September 1, 2024 21:42
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.

2 participants