This commit is contained in:
Ybehrooz
2025-05-20 20:07:46 +03:30
parent 7bc33a8808
commit 965d6900be
7 changed files with 28 additions and 33 deletions

BIN
__debug_bin439949312 Normal file

Binary file not shown.

View File

@@ -70,13 +70,13 @@ func CreateApp(clustername string, ControlPlane string, PlatformVersion string,
}
// Generate unique cluster name with user prefix
uniqueClusterName := "test"
uniqueClusterName := clustername
app := ApplicationValues{
Name: uniqueClusterName,
Namespace: "ns-" + generateRandomString(4),
Path: "vcluster-0.21.1",
Cluster: "in-cluster",
Cluster: "schoobus-onsite",
Server: "https://kubernetes.default.svc",
RepoURL: "http://192.168.2.20:8015/root/application.git",
UserID: userID,
@@ -110,17 +110,17 @@ func CreateApp(clustername string, ControlPlane string, PlatformVersion string,
Name: "controlPlane.advanced.defaultImageRegistry",
Value: "192.168.2.43:31898",
},
{
Name: "controlPlane.distro.k8s.version",
Value: ControlPlane,
},
// {
// Name: "controlPlane.distro.k8s.version",
// Value: ControlPlane,
// },
{
Name: "controlPlane.distro.k8s.resources.limits.cpu",
Value: Cpu,
},
{
Name: "controlPlane.distro.k8s.resources.limits.memory",
Value: Memory,
Value: Memory + "Mi",
},
{
Name: "controlPlane.distro.k8s.resources.requests.cpu",

View File

@@ -14,7 +14,7 @@ var (
)
func InitDB() {
clientOptions := options.Client().ApplyURI("mongodb://root:example@172.20.158.234:27017/")
clientOptions := options.Client().ApplyURI("mongodb://root:example@192.168.2.177:27017/")
client, err := mongo.Connect(context.TODO(), clientOptions)
if err != nil {
log.Fatal(err)

View File

@@ -19,4 +19,4 @@ services:
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example
ME_CONFIG_MONGODB_URL: mongodb://root:example@192.168.1.10:27017/
ME_CONFIG_MONGODB_URL: mongodb://root:example@192.168.2.177:27017/

View File

@@ -6,9 +6,8 @@ import (
"main/argohandler"
"main/db"
"net/http"
"log"
// "github.com/gorilla/mux"
// "github.com/gorilla/mux"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
)
@@ -37,10 +36,6 @@ func CreateClusterHandler(w http.ResponseWriter, r *http.Request) {
var header Header
header.Authorization = r.Header.Get("Authorization")
log.Fatal("--------------")
log.Fatal(r.Header.Get("Authorization"))
log.Fatal("--------------")
// 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 == "" {

View File

@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"main/db"
"main/handler"
"net/http"
@@ -72,6 +71,7 @@ func registerHnadler(w http.ResponseWriter, r *http.Request) {
_, err := db.UserCollection.InsertOne(context.TODO(), user)
if err != nil {
http.Error(w, `{"message": "Could not create user"}`, http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusCreated)
@@ -129,12 +129,12 @@ func main() {
//handler.RegsiterClusterRoute(router)
// Enable CORS
c := cors.New(cors.Options{
AllowedOrigins: []string{"*"}, // Allow all origins
AllowedOrigins: []string{"*"}, // Allow all origins
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowedHeaders: []string{"Content-Type", "Authorization", "X-Requested-With", "Accept", "Origin"},
ExposedHeaders: []string{"Content-Length"},
AllowCredentials: true,
Debug: true, // Enable debug logging
Debug: true, // Enable debug logging
})
http.ListenAndServe("0.0.0.0:8082", c.Handler(router))