I want to ship a “self test” with our product and have the result show up as a StatusInformer in Kots. It should run after install or upgrade.
We could run such a thing as a Pod or a Job in the helm post-install and post-upgrade hooks, but after running there would be a Completed or Error status (for pass/fail) but nothing for a StatusInformer to look at.
One could envision a circuitous hack involving the pod staying up forever via a Deployment and then adding an endpoint and a Service attached there which StatusInformer can check.
But is there a better way, maybe a sanctioned one?
Thanks for reading.
ps: @crdant added the idea of performing a test in one of our deployment’s init containers which would impede its coming up until the test passed
I’m not sure there’s a way to monitor the status of a Pod or Job since we only support status informers for certain higher-level resources (docs).
I think having a post-install/upgrade hook sounds reasonable as the app deployment would fail in KOTS if the hook fails and the user would get a message indicating this.
Alternatively, depending on what you are checking, you could leverage Kubernetes readiness probes to ensure that a component does not report ready until certain conditions are met. This would show up in status informers for something like a Deployment. This approach would have a similar outcome to the init container idea that was suggested.
Hopefully this is helpful. Let us know if there are any additional details you can share that might help us understand your desired outcome a bit more.