replicatedhq / troubleshoot

Preflight Checks and Support Bundles Framework for Kubernetes Applications
https://troubleshoot.sh
Apache License 2.0
539 stars 92 forks source link

feat(analyzer): let cluster resource case insensitive to fix name inconsistent #1547

Closed DexterYan closed 2 months ago

DexterYan commented 2 months ago

Description, Motivation and Context

Demo:

apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: default
spec:
  collectors:
    - cluster-resources: {}
  analyzers:
    - clusterResource:
        checkName: check-access-mode
        kind: deployment
        namespace: default
        name: strapi-db
        yamlPath: "spec.replicas"
        regex: "1"
        outcomes:
          - fail:
              when: "false"
              message: is not ReadWriteOnce
          - pass:
              when: "true"
              message: is ReadWriteOnce
    - clusterResource:
        checkName: check-cm-confg
        kind: configmap
        namespace: kube-public
        name: kube-root-ca.crt
        yamlPath: "metadata.name"
        regex: "kube-root-ca.crt"
        outcomes:
          - fail:
              when: "false"
              message: is not kube-root-ca
          - pass:
              when: "true"
              message: is kube-root-ca

Fixes : #1523

Checklist

Does this PR introduce a breaking change?