fix issues

This commit is contained in:
Ybehrooz
2025-08-30 20:08:19 +03:30
parent 36a36a232f
commit 06b7aaa548
3 changed files with 4 additions and 1 deletions

View File

@@ -271,6 +271,7 @@ func updateConfig(objectID string, configStrings string, namespace string) {
"$set": bson.M{ "$set": bson.M{
"cluster_config": configStrings, "cluster_config": configStrings,
"namespace": namespace, "namespace": namespace,
"EndPoine": "https://" + namespace + ".bugx.ir",
}, },
} }
@@ -365,6 +366,7 @@ func ListUserClusters(userID string) (error, []Clusters) {
Name: app.Name, Name: app.Name,
Status: string(app.Status.Health.Status), Status: string(app.Status.Health.Status),
ClusterID: strings.Split(string(app.ObjectMeta.UID), "-")[0], ClusterID: strings.Split(string(app.ObjectMeta.UID), "-")[0],
EndPoint: "https://" + app.Spec.Destination.Namespace + ".bugx.ir",
} }
clusters = append(clusters, newCluster) clusters = append(clusters, newCluster)
} }

View File

@@ -59,7 +59,7 @@ func CreateClusterHandler(w http.ResponseWriter, r *http.Request) {
// vclusterCollection := db.Vclusters_details.FindOne(context.TODO(), bson.M{"name": Cluster.Name}).Decode(&existsCluster) // vclusterCollection := db.Vclusters_details.FindOne(context.TODO(), bson.M{"name": Cluster.Name}).Decode(&existsCluster)
if cluster.Name == "" || cluster.ControlPlane == "" || cluster.PlatformVersion == "" || cluster.Cpu == "" || cluster.Memory == "" { if strings.ToLower(cluster.Name) == "" || cluster.ControlPlane == "" || cluster.PlatformVersion == "" || cluster.Cpu == "" || cluster.Memory == "" {
http.Error(w, "Invalid input", http.StatusBadRequest) http.Error(w, "Invalid input", http.StatusBadRequest)
return return
} }

View File

@@ -22,6 +22,7 @@ type Cluster struct {
CreatedAt string `json:"createdAt"` CreatedAt string `json:"createdAt"`
UserID primitive.ObjectID `json:"userId"` UserID primitive.ObjectID `json:"userId"`
Cluster_config string `json:"clusterconfig"` Cluster_config string `json:"clusterconfig"`
EndPoint string `json:"endPoint"`
} }
type Header struct { type Header struct {