From 521a9af83ada1a625fe3470743d431d99a41ab14 Mon Sep 17 00:00:00 2001 From: "jose.vazquez" Date: Thu, 10 Oct 2024 14:47:59 +0200 Subject: [PATCH] Reuse local contains func --- pkg/controller/connectionsecret/connectionsecrets.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/pkg/controller/connectionsecret/connectionsecrets.go b/pkg/controller/connectionsecret/connectionsecrets.go index d78b3a2163..5b4a1a798e 100644 --- a/pkg/controller/connectionsecret/connectionsecrets.go +++ b/pkg/controller/connectionsecret/connectionsecrets.go @@ -39,7 +39,7 @@ func ReapOrphanConnectionSecrets(ctx context.Context, k8sClient client.Client, p if !ok { continue } - if clusterExists := contains(projectDeploymentNames, clusterName); clusterExists { + if clusterExists := stringutil.Contains(projectDeploymentNames, clusterName); clusterExists { continue } if err := k8sClient.Delete(ctx, &secret); err != nil { @@ -51,15 +51,6 @@ func ReapOrphanConnectionSecrets(ctx context.Context, k8sClient client.Client, p return removedOrphanSecrets, nil } -func contains(list []string, item string) bool { - for _, v := range list { - if v == item { - return true - } - } - return false -} - func CreateOrUpdateConnectionSecrets(ctx *workflow.Context, k8sClient client.Client, ds deployment.AtlasDeploymentsService, recorder record.EventRecorder, project *project.Project, dbUser akov2.AtlasDatabaseUser) workflow.Result { conns, err := ds.ListDeploymentConnections(ctx.Context, project.ID) if err != nil {