troubleshoot icon indicating copy to clipboard operation
troubleshoot copied to clipboard

Allow custom messages to be passed if a deployment/statefulset is absent

Open danj-replicated opened this issue 3 years ago • 3 comments
trafficstars

This is an attempt to address internal shortcut 49195.

We would like to be able to add custom messages when a deployment (e.g EKCO) is absent from the cluster to better explain how to resolve it's absence.

This change introduces a new special keyword "absent" that can be used in the "When" statement in a deploymentStatus or statefulSetStatus analyzer to allow absent deployments and statefulsets to be handled with custom messages.

for example:

apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: example
spec:
  analyzers:
    - deploymentStatus:
        name: ekc-operator
        namespace: kurl
        outcomes:
          - fail:
              when: "absent"
              message: "The ekc-operator deployment is not instaled. Without it, this cluster may not behave as intended"

While the change acheives this objective, I do have some reservations that I'd like to discuss:

  • currently the when: "absent" statement would need to be the first outcome for an analyzer due to how I'm catching it. comments on how I can improve this would be greatly appreciated.
  • I'm currently having to repeat a block to allow for the default the <resource> <name> does not exist for each warn|pass|fail outcome when we aren't specifically looking for the absence of a deployment. I'd like to reduce this repitition if possible.

danj-replicated avatar Aug 03 '22 10:08 danj-replicated

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 03 '22 10:08 CLAassistant

Overall approach looks ok to me. Can we have this for all other related resources: jobs, replicate sets, and stateful sets?

Also this needs tests.

divolgin avatar Aug 09 '22 18:08 divolgin

I don't think it would be too hard to add this to the other resources

danj-replicated avatar Aug 12 '22 10:08 danj-replicated