Browse Source

Fix pushsecret lint regression

Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>
Moritz Johner 2 months ago
parent
commit
a0889ed850

+ 3 - 7
pkg/controllers/pushsecret/pushsecret_controller.go

@@ -202,11 +202,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
 		}
 	}
 
-	filteredV1Stores, err := removeUnmanagedStores(ctx, req.Namespace, r, activeSecretStoresV1)
-	if err != nil {
-		r.markAsFailed(err.Error(), &ps, nil)
-		return ctrl.Result{}, err
-	}
+	filteredV1Stores := removeUnmanagedStores(ctx, req.Namespace, r, activeSecretStoresV1)
 
 	finalStores := make(map[esapi.PushSecretStoreRef]any)
 	for ref, store := range filteredV1Stores {
@@ -825,14 +821,14 @@ func statusRef(ref esv1.PushSecretData) string {
 
 // removeUnmanagedStores iterates over all SecretStore references and evaluates the controllerClass property.
 // Returns a map containing only managed stores.
-func removeUnmanagedStores(ctx context.Context, namespace string, r *Reconciler, ss map[esapi.PushSecretStoreRef]esv1.GenericStore) (map[esapi.PushSecretStoreRef]esv1.GenericStore, error) {
+func removeUnmanagedStores(_ context.Context, _ string, r *Reconciler, ss map[esapi.PushSecretStoreRef]esv1.GenericStore) map[esapi.PushSecretStoreRef]esv1.GenericStore {
 	for ref, store := range ss {
 		class := store.GetSpec().Controller
 		if class != "" && class != r.ControllerClass {
 			delete(ss, ref)
 		}
 	}
-	return ss, nil
+	return ss
 }
 
 // matchKeys filters secret keys based on the provided match pattern.

+ 1 - 4
pkg/controllers/pushsecret/pushsecret_controller_v2_test.go

@@ -833,12 +833,9 @@ func TestRemoveUnmanagedStoresSupportsOmittedKindRefs(t *testing.T) {
 		Log:             logr.Discard(),
 	}
 
-	stores, err := removeUnmanagedStores(context.Background(), "tenant-a", r, map[esapi.PushSecretStoreRef]esv1.GenericStore{
+	stores := removeUnmanagedStores(context.Background(), "tenant-a", r, map[esapi.PushSecretStoreRef]esv1.GenericStore{
 		{Name: "shared-name"}: secretStore,
 	})
-	if err != nil {
-		t.Fatalf("removeUnmanagedStores() error = %v", err)
-	}
 
 	if _, ok := stores[esapi.PushSecretStoreRef{Name: "shared-name"}]; !ok {
 		t.Fatalf("expected omitted-kind store ref to be retained, got %#v", stores)