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

Allow templating of outcome messages for the Node Resources Analyzer #1594

Open
diamonwiggins opened this issue Aug 14, 2024 · 2 comments
Open
Labels

Comments

@diamonwiggins
Copy link
Member

diamonwiggins commented Aug 14, 2024

Describe the rationale for the suggested feature.

When using the Node Resources, a user may want to template the outcome message with the values retrieved from the node/cluster, so that the outcome messages don't have to be static as they are today. For example, a user may want to write the following spec:

apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
  name: sample
spec:
  analyzers:
    - nodeResources:
        filters:
          cpuArchitecture: amd64
        checkName: Must have at least 3 nodes in the cluster
        outcomes:
          - fail:
              when: "count() < 3"
              message: This application requires at least 3 nodes. Only {{ .NodeCount }} nodes found.
          - pass:
              message: This cluster has enough nodes.

Describe the feature

A user would be able to include certain values gathered by the Node Resources as templates in the outcome message, so they can generate more dynamic messages. The templates we allow for usage in the outcome message would need to account for mulit-node clusters and when filters like cpuArchitecture are used in the spec. For example, in a 10 node cluster where only half the node are amd64, if the {{ .NodeCount }} template was used in conjunction with a filter for `amd64, it should only return the 5 nodes that match that filter.

Describe alternatives you've considered

Describe alternative solutions here. Include any workarounds you've considered.

Additional context

Add additional context about the feature request. If the change is substantial, consider attaching files to the issue outlining architectural changes, data flows, file formats etc., anything that helps describe the requested change.

@diamonwiggins diamonwiggins added the type::feature New feature or request label Aug 14, 2024
@ajp-io
Copy link
Member

ajp-io commented Aug 26, 2024

A customer brought this up today.

I'll add that I really want this capability for our host preflights for EC too. We want EC to be self-documenting and guide the user through any failures. So I'd love for our preflights to say "You need 4 CPU cores but you have 2" instead of just "You need 4 CPU cores." This will make it abundantly clear what users need to do, how far off they are (if the disk can't be more than 80% full, am I close to that threshold or way over it), etc.

So consider me a +1 for this issue, and it would be great for this kind of templating to be available for several of the analyzers we use in our host preflights, including CPU, memory, and disk usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants