From 9bccf91852dfd345f3a6507182c7cc3a46287328 Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Fri, 20 May 2022 17:58:19 +0800 Subject: [PATCH] switch case change simple! --- controllers/rabbitmqcluster_controller.go | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/controllers/rabbitmqcluster_controller.go b/controllers/rabbitmqcluster_controller.go index 9aee8c959..e989cb8c2 100644 --- a/controllers/rabbitmqcluster_controller.go +++ b/controllers/rabbitmqcluster_controller.go @@ -395,25 +395,7 @@ func (r *RabbitmqClusterReconciler) SetupWithManager(mgr ctrl.Manager) error { func addResourceToIndex(rawObj client.Object) []string { switch resourceObject := rawObj.(type) { - case *appsv1.StatefulSet: - owner := metav1.GetControllerOf(resourceObject) - return validateAndGetOwner(owner) - case *corev1.ConfigMap: - owner := metav1.GetControllerOf(resourceObject) - return validateAndGetOwner(owner) - case *corev1.Service: - owner := metav1.GetControllerOf(resourceObject) - return validateAndGetOwner(owner) - case *rbacv1.Role: - owner := metav1.GetControllerOf(resourceObject) - return validateAndGetOwner(owner) - case *rbacv1.RoleBinding: - owner := metav1.GetControllerOf(resourceObject) - return validateAndGetOwner(owner) - case *corev1.ServiceAccount: - owner := metav1.GetControllerOf(resourceObject) - return validateAndGetOwner(owner) - case *corev1.Secret: + case *appsv1.StatefulSet, *corev1.ConfigMap, *corev1.Service, *rbacv1.Role, *rbacv1.RoleBinding, *corev1.ServiceAccount, *corev1.Secret: owner := metav1.GetControllerOf(resourceObject) return validateAndGetOwner(owner) default: