Fix Kyverno policies related to Thanos compactor in order to check for the existence of the Deployment
What does this MR do and why?
This MR was raised to address the issue present under #1975 (closed). It was observed that during a CI run, the suspend-thanos-compactor ClusterPolicy was in FAIL/WARN/ERROR. This was, most likely, due to the fact that cluster-machines-ready Kustomization reconciled before the deployment thanos-compactor was ready. Starting from this, the resume-thanos-compactor ClusterPolicy was using the some logic and it might have caused issues in some scenarios.
With this MR, the Kubernetes API is being queried for the existence of the thanos-compactor Deployment and the result is being stored under the variable thanosDeploymentExists. Then, a precondition checks if the previous variable is not null. If the check fails (deployment not ready/found), the ClusterPolicy will be skipped, instead of throwing an error.
Related reference(s)
Closes #1975 (closed)