cluster.go 681 B

1234567891011121314151617181920212223242526272829303132
  1. package service
  2. import (
  3. "context"
  4. "strings"
  5. "go-common/app/admin/ep/merlin/model"
  6. )
  7. // QueryCluster query cluster.
  8. func (s *Service) QueryCluster(c context.Context) (clusters []*model.Cluster, err error) {
  9. var tmpClusters []*model.Cluster
  10. if tmpClusters, err = s.dao.QueryClusters(c); err != nil {
  11. return
  12. }
  13. for _, tmpCluster := range tmpClusters {
  14. if !strings.Contains(tmpCluster.Name, "uat") {
  15. clusters = append(clusters, tmpCluster)
  16. }
  17. }
  18. for _, cluster := range clusters {
  19. for _, supportName := range s.c.BiliHub.SupportNetWork {
  20. if strings.Contains(cluster.Name, supportName) {
  21. cluster.IsSupportSnapShot = true
  22. continue
  23. }
  24. }
  25. }
  26. return
  27. }