PodSecurityPolicy was removed from K8s since v1.25.
Our GKE cluster had been forcely upgraded to v1.25 from v1.24 and we forgot to
retire the PodSecurityPolicy resources in the chart, so the subsequent helm
upgrade from pipeline failed due to the disappearance of PodSecurityPolicy
kind and version policy/v1beta1.
Even if I disabled the PodSecurityPolicy from the chart but the helm upgrade
still would reference to the resource from existing release and the “not found”
showed up:
[2023-07-08T01:12:20.712Z] Error: UPGRADE FAILED: unable to build kubernetes objects from current release manifest: [resource mapping not found for name: "xxx" namespace: "" from "": no matches for kind "PodSecurityPolicy"in version "policy/v1beta1"
The helm uninstall on existing release also failed and got stuck with the same
reason:
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION 1 Sat Nov 20 00:21:31 2021 superseded xxx-1.0.3 v1.4.1 Install complete 2 Thu Aug 11 10:30:45 2022 superseded xxxr-1.0.5 v1.7.3 Upgrade complete 3 Thu Aug 11 10:58:10 2022 superseded xxx-1.0.3 v1.4.1 Upgrade complete # helm uninstall failed and hung 4 Mon Aug 15 23:30:33 2022 superseded xxx-1.0.5 v1.7.3 Deletion in progress (or silently failed) # mapkubeapis helped re-map the deprecated API 5 Sat Jul 8 01:56:17 2023 deployed xxx-1.0.5 v1.7.3 Kubernetes deprecated API upgrade - DO NOT rollback from this version
Then the next helm uninstall/upgrade should be good.