func GetClustersName(clusters []corev1.Secret) string {
	var names []string
	for _, c := range clusters {
		names = append(names, c.GetName())
	}
	return fmt.Sprint(strings.Join(names, ", "))
}
GetClustersName returns a string containing a comma-separated list of names of the given clusters
package utils
import (
	"fmt"
	"sort"
	"strings"
	syncv1alpha1 "github.com/Skyscanner/applicationset-progressive-sync/api/v1alpha1"
	"github.com/Skyscanner/applicationset-progressive-sync/internal/consts"
	argov1alpha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
	"github.com/argoproj/gitops-engine/pkg/health"
	corev1 "k8s.io/api/core/v1"
)
func IsArgoCDCluster(labels map[string]string) bool {
	val, ok := labels[consts.ArgoCDSecretTypeLabel]
	return val == consts.ArgoCDSecretTypeCluster && ok
}
func SortSecretsByName(secrets *corev1.SecretList) {
	sort.SliceStable(secrets.Items, func(i, j int) bool { return secrets.Items[i].Name < secrets.Items[j].Name })
}
func SortAppsByName(apps []argov1alpha1.Application) {
	sort.SliceStable(apps, func(i, j int) bool { return (apps)[i].Name < (apps)[j].Name })
}
func GetAppsBySyncStatusCode(apps []argov1alpha1.Application, code argov1alpha1.SyncStatusCode) []argov1alpha1.Application {
	var result []argov1alpha1.Application
	for _, app := range apps {
		if app.Status.Sync.Status == code {
			result = append(result, app)
		}
	}
	return result
}
func GetAppsByHealthStatusCode(apps []argov1alpha1.Application, code health.HealthStatusCode) []argov1alpha1.Application {
	var result []argov1alpha1.Application
	for _, app := range apps {
		if app.Status.Health.Status == code {
			result = append(result, app)
		}
	}
	return result
}
func GetSyncedAppsByStage(apps []argov1alpha1.Application, stage syncv1alpha1.ProgressiveSyncStage, pss ProgressiveSyncState) []argov1alpha1.Application {
	var result []argov1alpha1.Application
	for _, app := range apps {
		if app.Status.Sync.Status == argov1alpha1.SyncStatusCodeSynced && pss.IsAppMarkedInStage(app, stage) {
			result = append(result, app)
		}
	}
	return result
}
func GetAppsName(apps []argov1alpha1.Application) string {
	var names []string
	for _, a := range apps {
		names = append(names, a.GetName())
	}
	return fmt.Sprint(strings.Join(names, ", "))
}