fix
This commit is contained in:
28
.vscode/launch.json
vendored
28
.vscode/launch.json
vendored
@@ -1,15 +1,15 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Package",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"program": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Package",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"program": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
__debug_bin439949312
Normal file
BIN
__debug_bin439949312
Normal file
Binary file not shown.
@@ -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",
|
||||
|
||||
2
db/db.go
2
db/db.go
@@ -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)
|
||||
|
||||
@@ -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/
|
||||
@@ -5,10 +5,9 @@ import (
|
||||
"encoding/json"
|
||||
"main/argohandler"
|
||||
"main/db"
|
||||
"net/http"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
// "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 == "" {
|
||||
|
||||
6
main.go
6
main.go
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user