How to resolve the "failed calling webhook" error after upgrading from an old version of Autostopping to the latest one

Hello There :vulcan_salute:

The error

Recently some customers are reporting an error when trying to upgrade the **autostopping-controller** version to the **latest**. The error experienced is felt while the pod with the new version is being started but never reaches healthy status and displays the following error log:
Error from server (InternalError): error when creating "autostopping.yaml": Internal error occurred: failed calling webhook "": failed to call webhook: Post https://autostopping-controller.harness-autostopping.svc:9443/validate-autostoppingrule?timeout=30s: EOF

This error is expected and happens because of the older versions of our autostopping-controller, where we used a deprecated webhook from the previous installation (>= 1.0.4).

How to Fix?

To fix this, you’ll need to run the following command:

kubectl delete validatingwebhookconfiguration

This should delete references to this old, deprecated webhook to allow the new version of the controller to launch smoothly.