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

Node aggregate analyzers #132

Merged
merged 4 commits into from
Feb 6, 2020
Merged

Node aggregate analyzers #132

merged 4 commits into from
Feb 6, 2020

Conversation

marccampbell
Copy link
Member

This adds support for node resource aggregate (min, max, count and sum) functions for cpu, memory, pods and ephemeralStorage: capacity and allocatable.

This operates on the filtered nodes, so you can filter based on a condition, and then aggregate and compare.

Examples:

apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
metadata:
  name: sample
spec:
  analyzers:
    - nodeResources:
        checkName: Must have at least 3 nodes in the cluster
        outcomes:
          - fail:
              when: "count() < 3"
              message: This application requires at least 3 nodes
          - warn:
              when: "count() < 5"
              message: This application recommends at last 5 nodes.
          - pass:
              message: This cluster has enough nodes.
    - nodeResources:
        checkName: Every node in the cluster must have at least 16Gi of memory
        filters:
          allocatableMemory: "16Gi"
        outcomes:
          - fail:
              when: "min(memoryCapacity) < 16Gi"
              message: All nodes must have at least 16 GB of memory
          - pass:
              message: All nodes have at least 16 GB of memory
    - nodeResources:
        checkName: Total CPU Cores in the cluster is 20 or greater
        outcomes:
          - fail:
              when: "sum(cpuCapacity) < 20"
              message: The cluster must contain at least 20 cores
          - pass:
              message: There are at over 20 cores in the cluster
    - nodeResources:
        checkName: Nodes that have 6 cores have at least 16 GB of memory also
        filters:
          cpuCapacity: "6"
          outcomes:
            - fail:
                when: "min(memoryCapacity) < 16Gi"
                message: All nodes that have 6 or more cores must have at least 16 GB of memory
            - pass:
                message:  All nodes with 6 or more cores have at least 16 GB of memory
    - nodeResources:
        checkName: Must have 3 nodes with at least 6 cores
        filters:
          cpuCapacity: "6"
        outcomes:
          - fail:
              when: "count() < 3"
              message: This application requires at least 3 nodes with 6 cores each
          - pass:
              message: This cluster has enough nodes with enough codes
    - nodeResources:
        checkName: Must have 1 node with 16 GB (available) memory and 5 cores (on a single node)
        filters:
          allocatableMemory: 16Gi
          cpuCapacity: "5"
        outcomes:
          - fail:
              when: "count() < 1"
              message: This application requires at least 1 node with 16GB available memory
          - pass:
              message: This cluster has a node with enough memory.

@marccampbell marccampbell merged commit 1424faa into master Feb 6, 2020
@marccampbell marccampbell deleted the node-aggregate-analyzers branch February 6, 2020 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants