1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-24 21:07:32 +00:00

add checks for PSP resources in the cluster

This commit is contained in:
Jiaqi Luo
2022-12-28 12:54:17 -07:00
parent fc16be2c65
commit aa5c21bd30
2 changed files with 32 additions and 0 deletions

View File

@@ -30,3 +30,9 @@ func updatePodSecurityPolicy(k8sClient *kubernetes.Clientset, p interface{}) err
return nil
}
// GetPSPList returns the PodSecurityPolicyList containing all PSPs in the cluster and an error.
// The list could be empty if there is no PSP in the cluster.
func GetPSPList(k8sClient *kubernetes.Clientset) (*v1beta1.PodSecurityPolicyList, error) {
return k8sClient.PolicyV1beta1().PodSecurityPolicies().List(context.TODO(), metav1.ListOptions{})
}