troubleshoot
troubleshoot copied to clipboard
Allow custom messages to be passed if a deployment/statefulset is absent
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 existfor 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.
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.
I don't think it would be too hard to add this to the other resources