Skip to content

Commit 79fa510

Browse files
committed
fix: delete all provider resources
Client proxy defines among which types we will search for objects with the desired labels. Currently this list is not full and we skip some types, like ClusterRole or ClusterRole bindings. It leads to the fact that objects of these types stay in the system when their provider is deleted. This PR updates the list of resource types we need to scan.
1 parent 9c380ac commit 79fa510

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

internal/controller/client_proxy.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ func (k *controllerProxy) ListResources(labels map[string]string, namespaces ...
7676
{Kind: "Secret", Namespaced: true},
7777
{Kind: "ConfigMap", Namespaced: true},
7878
{Kind: "Service", Namespaced: true},
79+
{Kind: "ServiceAccount", Namespaced: true},
80+
{Kind: "Namespace"},
7981
},
8082
},
8183
{
@@ -88,8 +90,30 @@ func (k *controllerProxy) ListResources(labels map[string]string, namespaces ...
8890
{
8991
GroupVersion: "admissionregistration.k8s.io/v1",
9092
APIResources: []metav1.APIResource{
91-
{Kind: "ValidatingWebhookConfiguration", Namespaced: true},
92-
{Kind: "MutatingWebhookConfiguration", Namespaced: true},
93+
{Kind: "ValidatingWebhookConfiguration"},
94+
{Kind: "MutatingWebhookConfiguration"},
95+
},
96+
},
97+
{
98+
GroupVersion: "apiextensions.k8s.io/v1",
99+
APIResources: []metav1.APIResource{
100+
{Kind: "CustomResourceDefinition"},
101+
},
102+
},
103+
{
104+
GroupVersion: "cert-manager.io/v1",
105+
APIResources: []metav1.APIResource{
106+
{Kind: "Certificate", Namespaced: true},
107+
{Kind: "Issuer", Namespaced: true},
108+
},
109+
},
110+
{
111+
GroupVersion: "rbac.authorization.k8s.io/v1",
112+
APIResources: []metav1.APIResource{
113+
{Kind: "Role", Namespaced: true},
114+
{Kind: "RoleBinding", Namespaced: true},
115+
{Kind: "ClusterRole"},
116+
{Kind: "ClusterRoleBinding"},
93117
},
94118
},
95119
}

0 commit comments

Comments
 (0)