|
|
@@ -93,6 +93,23 @@ func initData(conf *config.Config) error {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
+ // determine if there are any clusters in the project already
|
|
|
+ clusters, err := conf.Repo.Cluster().ListClustersByProjectID(1)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ // if there are already clusters in the project, determine if any of the clusters are using an
|
|
|
+ // in-cluster auth mechanism
|
|
|
+ if len(clusters) > 0 {
|
|
|
+ for _, cluster := range clusters {
|
|
|
+ if cluster.AuthMechanism == models.InCluster {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
_, err = conf.Repo.Cluster().ReadCluster(1, 1)
|
|
|
|
|
|
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
|