diff --git a/README.md b/README.md index e8c8c36..e4d3dd9 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,9 @@ If default Swagger page is displayed instead of tyour api, change url in swagger url: "swagger.json" Note on particular process : -- set a bookin delete all related workflow booking before creating new ones. (no update of existing ones) \ No newline at end of file +- set a bookin delete all related workflow booking before creating new ones. (no update of existing ones) + +# Docker Kube Settings + +Set up your base64 key from your ~/.kube/config. +Don't forget to set up your external IP in docker_datacenter.json \ No newline at end of file diff --git a/conf/config.go b/conf/config.go new file mode 100644 index 0000000..cb4cf0f --- /dev/null +++ b/conf/config.go @@ -0,0 +1,22 @@ +package conf + +import "sync" + +type Config struct { + Mode string + KubeHost string + KubePort string + KubeCA string + KubeCert string + KubeData string +} + +var instance *Config +var once sync.Once + +func GetConfig() *Config { + once.Do(func() { + instance = &Config{} + }) + return instance +} diff --git a/controllers/booking.go b/controllers/booking.go index cd89666..87598d1 100644 --- a/controllers/booking.go +++ b/controllers/booking.go @@ -4,12 +4,13 @@ import ( "encoding/json" "errors" "fmt" + "oc-datacenter/infrastructure" "time" oclib "cloud.o-forge.io/core/oc-lib" "cloud.o-forge.io/core/oc-lib/dbs" + "cloud.o-forge.io/core/oc-lib/models/booking" b "cloud.o-forge.io/core/oc-lib/models/booking" - "cloud.o-forge.io/core/oc-lib/models/workflow_execution" beego "github.com/beego/beego/v2/server/web" "go.mongodb.org/mongo-driver/bson/primitive" ) @@ -19,10 +20,40 @@ type BookingController struct { beego.Controller } +// @Title Search +// @Description search bookings by execution +// @Param id path string true "id execution" +// @Param is_draft query string false "draft wished" +// @Success 200 {workspace} models.workspace +// @router /search/execution/:id [get] +func (o *BookingController) ExecutionSearch() { + /* + * This is a sample of how to use the search function + * The search function is used to search for data in the database + * The search function takes in a filter and a data type + * The filter is a struct that contains the search parameters + * The data type is an enum that specifies the type of data to search for + * The search function returns a list of data that matches the filter + * The data is then returned as a json object + */ + // store and return Id or post with UUID + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) + id := o.Ctx.Input.Param(":id") + isDraft := o.Ctx.Input.Query("is_draft") + f := dbs.Filters{ + Or: map[string][]dbs.Filter{ // filter by name if no filters are provided + "execution_id": {{Operator: dbs.EQUAL.String(), Value: id}}, + }, + } + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).Search(&f, "", isDraft == "true") + o.ServeJSON() +} + // @Title Search // @Description search bookings // @Param start_date path string true "the word search you want to get" // @Param end_date path string true "the word search you want to get" +// @Param is_draft query string false "draft wished" // @Success 200 {workspace} models.workspace // @router /search/:start_date/:end_date [get] func (o *BookingController) Search() { @@ -36,25 +67,30 @@ func (o *BookingController) Search() { * The data is then returned as a json object */ // store and return Id or post with UUID + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) start_date, _ := time.Parse("2006-01-02", o.Ctx.Input.Param(":start_date")) end_date, _ := time.Parse("2006-01-02", o.Ctx.Input.Param(":end_date")) + isDraft := o.Ctx.Input.Query("is_draft") sd := primitive.NewDateTimeFromTime(start_date) ed := primitive.NewDateTimeFromTime(end_date) f := dbs.Filters{ And: map[string][]dbs.Filter{ - "workflowexecution.execution_date": {{Operator: "gte", Value: sd}, {Operator: "lte", Value: ed}}, + "execution_date": {{Operator: "gte", Value: sd}, {Operator: "lte", Value: ed}}, }, } - o.Data["json"] = oclib.Search(&f, "", oclib.LibDataEnum(oclib.BOOKING)) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).Search(&f, "", isDraft == "true") o.ServeJSON() } // @Title GetAll // @Description find booking by id +// @Param is_draft query string false "draft wished" // @Success 200 {booking} models.booking // @router / [get] func (o *BookingController) GetAll() { - o.Data["json"] = oclib.LoadAll(oclib.LibDataEnum(oclib.BOOKING)) + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) + isDraft := o.Ctx.Input.Query("is_draft") + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).LoadAll(isDraft == "true") o.ServeJSON() } @@ -64,8 +100,43 @@ func (o *BookingController) GetAll() { // @Success 200 {booking} models.booking // @router /:id [get] func (o *BookingController) Get() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) id := o.Ctx.Input.Param(":id") - o.Data["json"] = oclib.LoadOne(oclib.LibDataEnum(oclib.BOOKING), id) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).LoadOne(id) + o.ServeJSON() +} + +// @Title Update +// @Description create computes +// @Param id path string true "the compute id you want to get" +// @Param body body models.compute true "The compute content" +// @Success 200 {compute} models.compute +// @router /:id [put] +func (o *BookingController) Put() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) + // store and return Id or post with UUID + var res map[string]interface{} + id := o.Ctx.Input.Param(":id") + book := oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).LoadOne(id) + if book.Code != 200 { + o.Data["json"] = map[string]interface{}{ + "data": nil, + "code": book.Code, + "error": book.Err, + } + o.ServeJSON() + return + } + booking := book.Data.(*b.Booking) + if time.Now().After(booking.ExpectedStartDate) { + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).UpdateOne(res, id) + } else { + o.Data["json"] = map[string]interface{}{ + "data": nil, + "code": 409, + "error": "booking is not already started", + } + } o.ServeJSON() } @@ -74,6 +145,7 @@ func (o *BookingController) Get() { // @Param id path string "id of the datacenter" // @Param start_date path string "the booking start date" format "2006-01-02T15:04:05" // @Param end_date path string "the booking end date" format "2006-01-02T15:04:05" +// @Param is_draft query string false "draft wished" // @Success 200 {object} models.object // @router /check/:id/:start_date/:end_date [get] func (o *BookingController) Check() { @@ -81,7 +153,7 @@ func (o *BookingController) Check() { * This function is used to check if a booking is available for a specific datacenter. * It takes the following parameters: * - id: the id of the datacenter - * - start_date: the start date of the booking + * - start_date: the start date of the booking/search/execution/:id * - end_date: the end date of the booking */ id := o.Ctx.Input.Param(":id") @@ -96,8 +168,8 @@ func (o *BookingController) Check() { "error": errors.New("invalid date format"), } } else { - booking := &b.Booking{} // create a new booking object - isAvailable, err2 := booking.CheckBooking(id, date, &date2) // check if the booking is available + booking := &b.Booking{} // create a new booking object + isAvailable, err2 := booking.Check(id, date, &date2, 1) // check if the booking is available fmt.Println(isAvailable, err2) code := 200 err := "" @@ -119,12 +191,14 @@ func (o *BookingController) Check() { o.ServeJSON() } -// @Title Post +// @Title Post. // @Description create booking // @Param booking body string true "the booking you want to post" +// @Param is_draft query string false "draft wished" // @Success 200 {object} models.object // @router / [post] func (o *BookingController) Post() { + fmt.Println("POST") /* * This function is used to create a booking. * It takes the following parameters: @@ -133,15 +207,16 @@ func (o *BookingController) Post() { * - datacenter_resource_id: the id of the datacenter * - workflow_execution: the workflow execution */ - var resp workflow_execution.WorkflowExecutions - json.Unmarshal(o.Ctx.Input.CopyBody(10000), &resp) + var resp booking.Booking + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) + json.Unmarshal(o.Ctx.Input.CopyBody(10000000), &resp) dc_id := resp.ResourceID // delete all previous bookings - fmt.Println("Deleting previous bookings", resp) - res := oclib.Search(&dbs.Filters{And: map[string][]dbs.Filter{ - "workflowexecution.workflow_id": {{Operator: dbs.EQUAL.String(), Value: resp.WorkflowID}}, - "compute_resource_id": {{Operator: dbs.EQUAL.String(), Value: dc_id}}, - }}, "", oclib.LibDataEnum(oclib.BOOKING)) + isDraft := o.Ctx.Input.Query("is_draft") + res := oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).Search(&dbs.Filters{And: map[string][]dbs.Filter{ + "workflow_id": {{Operator: dbs.EQUAL.String(), Value: resp.WorkflowID}}, + "resource_id": {{Operator: dbs.EQUAL.String(), Value: dc_id}}, + }}, "", isDraft == "true") if res.Code != 200 { o.Data["json"] = map[string]interface{}{ "data": nil, @@ -152,37 +227,62 @@ func (o *BookingController) Post() { return } for _, b := range res.Data { // delete all previous bookings - oclib.DeleteOne(oclib.LibDataEnum(oclib.BOOKING), b.GetID()) + oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).DeleteOne(b.GetID()) } - books := make([]interface{}, 0) - errormsg := "" - for _, exec := range resp.Executions { // create new bookings - if ok, _ := (&b.Booking{}).CheckBooking(dc_id, *exec.ExecDate, exec.EndDate); !ok { - res.Err += " -> the booking from " + exec.ExecDate.String() + " is already taken." - o.Data["json"] = map[string]interface{}{ - "data": nil, - "code": res.Code, - "error": res.Err + " -> the booking from " + exec.ExecDate.String() + " is already taken.", - } - o.ServeJSON() - return - } - new := &b.Booking{ - ComputeResourceID: dc_id, - WorkflowExecution: *exec, - } - // store the booking - b := oclib.StoreOne(oclib.LibDataEnum(oclib.BOOKING), new.Serialize()) - if b.Code == 200 { - books = append(books, b.Data) - } else { - errormsg += " -> " + b.Err + b := oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).StoreOne(resp.Serialize(&resp)) + if b.Code != 200 { + o.Data["json"] = map[string]interface{}{ + "data": nil, + "code": b.Code, + "error": b.Err, } + o.ServeJSON() + return } + fmt.Println("there was an error creating the namespace", o.createNamespace(resp.ExecutionsID)) o.Data["json"] = map[string]interface{}{ - "data": books, + "data": []interface{}{b}, "code": 200, - "error": errormsg, + "error": "", } o.ServeJSON() } + +func (o *BookingController) createNamespace(ns string) error { + /* + * This function is used to create a namespace. + * It takes the following parameters: + * - ns: the namespace you want to create + */ + serv, err := infrastructure.NewService() + if err != nil { + return nil + } + err = serv.CreateNamespace(o.Ctx.Request.Context(), ns) + if err != nil { + return err + } + err = serv.CreateServiceAccount(o.Ctx.Request.Context(), ns) + if err != nil { + return err + } + role := "argo-role" + err = serv.CreateRole(o.Ctx.Request.Context(), ns, role, + [][]string{ + {"coordination.k8s.io"}, + {""}, + {""}}, + [][]string{ + {"leases"}, + {"secrets"}, + {"pods"}}, + [][]string{ + {"get", "create", "update"}, + {"get"}, + {"patch"}}) + if err != nil { + return err + } + fmt.Println("ROLLLLLE BIND") + return serv.CreateRoleBinding(o.Ctx.Request.Context(), ns, "argo-role-binding", role) +} diff --git a/controllers/datacenter.go b/controllers/datacenter.go new file mode 100644 index 0000000..313f78a --- /dev/null +++ b/controllers/datacenter.go @@ -0,0 +1,85 @@ +package controllers + +import ( + oclib "cloud.o-forge.io/core/oc-lib" + "cloud.o-forge.io/core/oc-lib/dbs" + beego "github.com/beego/beego/v2/server/web" +) + +// Operations about workspace +type DatacenterController struct { + beego.Controller +} + +// @Title GetAll +// @Description find booking by id +// @Param is_draft query string false "draft wished" +// @Success 200 {booking} models.booking +// @router / [get] +func (o *DatacenterController) GetAll() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) + isDraft := o.Ctx.Input.Query("is_draft") + storages := oclib.NewRequest(oclib.LibDataEnum(oclib.STORAGE_RESOURCE), user, peerID, groups, nil).Search(&dbs.Filters{ + Or: map[string][]dbs.Filter{ + "abstractintanciatedresource.abstractresource.abstractobject.creator_id": {{Operator: dbs.EQUAL.String(), Value: peerID}}, + }, + }, "", isDraft == "true") + computes := oclib.NewRequest(oclib.LibDataEnum(oclib.COMPUTE_RESOURCE), user, peerID, groups, nil).Search(&dbs.Filters{ + Or: map[string][]dbs.Filter{ + "abstractintanciatedresource.abstractresource.abstractobject.creator_id": {{Operator: dbs.EQUAL.String(), Value: peerID}}, + }, + }, "", isDraft == "true") + storages.Data = append(storages.Data, computes.Data...) + if storages.Err != "" { + storages.Err += " - " + computes.Err + } + o.Data["json"] = storages + o.ServeJSON() +} + +// @Title Get +// @Description find booking by id +// @Param id path string true "the id you want to get" +// @Param is_draft query string false "draft wished" +// @Success 200 {booking} models.booking +// @router /:id [get] +func (o *DatacenterController) Get() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) + isDraft := o.Ctx.Input.Query("is_draft") + id := o.Ctx.Input.Param(":id") + storages := oclib.NewRequest(oclib.LibDataEnum(oclib.STORAGE_RESOURCE), user, peerID, groups, nil).Search(&dbs.Filters{ + Or: map[string][]dbs.Filter{ + "abstractintanciatedresource.abstractresource.abstractobject.id": {{Operator: dbs.EQUAL.String(), Value: id}}, + "abstractintanciatedresource.abstractresource.abstractobject.creator_id": {{Operator: dbs.EQUAL.String(), Value: peerID}}, + }, + }, "", isDraft == "true") + if len(storages.Data) == 0 { + computes := oclib.NewRequest(oclib.LibDataEnum(oclib.COMPUTE_RESOURCE), user, peerID, groups, nil).Search(&dbs.Filters{ + Or: map[string][]dbs.Filter{ + "abstractintanciatedresource.abstractresource.abstractobject.id": {{Operator: dbs.EQUAL.String(), Value: id}}, + "abstractintanciatedresource.abstractresource.abstractobject.creator_id": {{Operator: dbs.EQUAL.String(), Value: peerID}}, + }, + }, "", isDraft == "true") + if len(computes.Data) == 0 { + o.Data["json"] = map[string]interface{}{ + "data": nil, + "code": computes.Code, + "err": computes.Err, + } + } else { + o.Data["json"] = map[string]interface{}{ + "data": computes.Data[0], + "code": computes.Code, + "err": computes.Err, + } + } + + } else { + o.Data["json"] = map[string]interface{}{ + "data": storages.Data[0], + "code": storages.Code, + "err": storages.Err, + } + } + o.ServeJSON() +} diff --git a/controllers/session.go b/controllers/session.go new file mode 100644 index 0000000..e2acf89 --- /dev/null +++ b/controllers/session.go @@ -0,0 +1,53 @@ +package controllers + +import ( + "fmt" + "oc-datacenter/infrastructure" + "strconv" + + beego "github.com/beego/beego/v2/server/web" +) + +type SessionController struct { + beego.Controller +} + +// @Title GetToken +// @Description find booking by id +// @Param id path string "id of the datacenter" +// @Param duration path string "duration of the token" +// @Success 200 {booking} models.booking +// @router /token/:id/:duration [get] +func (o *SessionController) GetToken() { + id := o.Ctx.Input.Param(":id") + durationSTR := o.Ctx.Input.Param(":duration") + + duration, err := strconv.Atoi(durationSTR) + if err != nil { + // change code to 400 + o.Ctx.Output.SetStatus(400) + o.Data["json"] = map[string]string{"error": "duration invalid"} + o.ServeJSON() + return + } + + serv, err := infrastructure.NewService() + if err != nil { + // change code to 500 + o.Ctx.Output.SetStatus(500) + o.Data["json"] = map[string]string{"error": err.Error()} + o.ServeJSON() + return + } + fmt.Println("BLAPO", id, duration) + token, err := serv.GetToken(o.Ctx.Request.Context(), id, duration) + if err != nil { + // change code to 500 + o.Ctx.Output.SetStatus(500) + o.Data["json"] = map[string]string{"error": err.Error()} + o.ServeJSON() + return + } + o.Data["json"] = token + o.ServeJSON() +} diff --git a/docker_datacenter.json b/docker_datacenter.json index 853922f..204ace5 100644 --- a/docker_datacenter.json +++ b/docker_datacenter.json @@ -1,5 +1,9 @@ { "MONGO_URL":"mongodb://mongo:27017/", "NATS_URL":"nats://nats:4222", - "MONGO_DATABASE":"DC_myDC" + "MONGO_DATABASE":"DC_myDC", + "KUBERNETES_SERVICE_HOST" : "192.168.1.69", + "KUBE_CA" : "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJkekNDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUzTWpNeE1USXdNell3SGhjTk1qUXdPREE0TVRBeE16VTJXaGNOTXpRd09EQTJNVEF4TXpVMgpXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUzTWpNeE1USXdNell3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFTVlk3ZHZhNEdYTVdkMy9jMlhLN3JLYjlnWXgyNSthaEE0NmkyNVBkSFAKRktQL2UxSVMyWVF0dzNYZW1TTUQxaStZdzJSaVppNUQrSVZUamNtNHdhcnFvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVWtlUVJpNFJiODduME5yRnZaWjZHClc2SU55NnN3Q2dZSUtvWkl6ajBFQXdJRFNBQXdSUUlnRXA5ck04WmdNclRZSHYxZjNzOW5DZXZZeWVVa3lZUk4KWjUzazdoaytJS1FDSVFDbk05TnVGKzlTakIzNDFacGZ5ays2NEpWdkpSM3BhcmVaejdMd2lhNm9kdz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K", + "KUBE_CERT":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrVENDQVRlZ0F3SUJBZ0lJWUxWNkFPQkdrU1F3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjhHQTFVRUF3d1kKYXpOekxXTnNhV1Z1ZEMxallVQXhOekl6TVRFeU1ETTJNQjRYRFRJME1EZ3dPREV3TVRNMU5sb1hEVEkxTURndwpPREV3TVRNMU5sb3dNREVYTUJVR0ExVUVDaE1PYzNsemRHVnRPbTFoYzNSbGNuTXhGVEFUQmdOVkJBTVRESE41CmMzUmxiVHBoWkcxcGJqQlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJGQ2Q1MFdPeWdlQ2syQzcKV2FrOWY4MVAvSkJieVRIajRWOXBsTEo0ck5HeHFtSjJOb2xROFYxdUx5RjBtOTQ2Nkc0RmRDQ2dqaXFVSk92Swp3NVRPNnd5alNEQkdNQTRHQTFVZER3RUIvd1FFQXdJRm9EQVRCZ05WSFNVRUREQUtCZ2dyQmdFRkJRY0RBakFmCkJnTlZIU01FR0RBV2dCVFJkOFI5cXVWK2pjeUVmL0ovT1hQSzMyS09XekFLQmdncWhrak9QUVFEQWdOSUFEQkYKQWlFQTArbThqTDBJVldvUTZ0dnB4cFo4NVlMalF1SmpwdXM0aDdnSXRxS3NmUVVDSUI2M2ZNdzFBMm5OVWU1TgpIUGZOcEQwSEtwcVN0Wnk4djIyVzliYlJUNklZCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0KLS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJlRENDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdFkyeHAKWlc1MExXTmhRREUzTWpNeE1USXdNell3SGhjTk1qUXdPREE0TVRBeE16VTJXaGNOTXpRd09EQTJNVEF4TXpVMgpXakFqTVNFd0h3WURWUVFEREJock0zTXRZMnhwWlc1MExXTmhRREUzTWpNeE1USXdNell3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFRc3hXWk9pbnIrcVp4TmFEQjVGMGsvTDF5cE01VHAxOFRaeU92ektJazQKRTFsZWVqUm9STW0zNmhPeVljbnN3d3JoNnhSUnBpMW5RdGhyMzg0S0Z6MlBvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVTBYZkVmYXJsZm8zTWhIL3lmemx6Cnl0OWlqbHN3Q2dZSUtvWkl6ajBFQXdJRFNRQXdSZ0loQUxJL2dNYnNMT3MvUUpJa3U2WHVpRVMwTEE2cEJHMXgKcnBlTnpGdlZOekZsQWlFQW1wdjBubjZqN3M0MVI0QzFNMEpSL0djNE53MHdldlFmZWdEVGF1R2p3cFk9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K", + "KUBE_DATA": "LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSU5ZS1BFb1dhd1NKUzJlRW5oWmlYMk5VZlY1ZlhKV2krSVNnV09TNFE5VTlvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFVUozblJZN0tCNEtUWUx0WnFUMS96VS84a0Z2Sk1lUGhYMm1Vc25pczBiR3FZblkyaVZEeApYVzR2SVhTYjNqcm9iZ1YwSUtDT0twUWs2OHJEbE03ckRBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=" } \ No newline at end of file diff --git a/go.mod b/go.mod index 3287db0..78216b7 100644 --- a/go.mod +++ b/go.mod @@ -1,57 +1,87 @@ module oc-datacenter -go 1.22.0 +go 1.23.0 -toolchain go1.22.4 +toolchain go1.23.3 require ( - cloud.o-forge.io/core/oc-lib v0.0.0-20250110163958-fd1c579ec418 + cloud.o-forge.io/core/oc-lib v0.0.0-20250213085018-271cc2caa026 github.com/beego/beego/v2 v2.3.1 go.mongodb.org/mongo-driver v1.17.1 + k8s.io/api v0.32.1 + k8s.io/apimachinery v0.32.1 + k8s.io/client-go v0.32.1 ) require ( github.com/beorn7/perks v1.0.1 // indirect + github.com/biter777/countries v1.7.5 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.6 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.22.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect + github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/goraz/onion v0.1.3 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.11 // indirect - github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/montanaflynn/stats v0.7.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/nats-io/nats.go v1.37.0 // indirect github.com/nats-io/nkeys v0.4.7 // indirect github.com/nats-io/nuid v1.0.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect - github.com/robfig/cron/v3 v3.0.1 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/robfig/cron v1.2.0 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect github.com/smartystreets/goconvey v1.7.2 // indirect + github.com/x448/float16 v0.8.4 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/net v0.30.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.7.0 // indirect google.golang.org/protobuf v1.35.1 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/klog/v2 v2.130.1 // indirect + k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect + k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect + sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 45e60fd..d72e0db 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,12 @@ -cloud.o-forge.io/core/oc-lib v0.0.0-20250110163958-fd1c579ec418 h1:24nc5qA6AkV6pIbJJeRASeUZmWuGkl+FO/r2oXazJ8w= -cloud.o-forge.io/core/oc-lib v0.0.0-20250110163958-fd1c579ec418/go.mod h1:ya7Q+zHhaKM+XF6sAJ+avqHEVzaMnFJQih2X3TlTlGo= +cloud.o-forge.io/core/oc-lib v0.0.0-20250213085018-271cc2caa026 h1:CYwpofGfpAhMDrT6jqvu9NI/tcgxCD8PKJZDKEfTvVI= +cloud.o-forge.io/core/oc-lib v0.0.0-20250213085018-271cc2caa026/go.mod h1:2roQbUpv3a6mTIr5oU1ux31WbN8YucyyQvCQ0FqwbcE= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/beego/beego/v2 v2.3.1 h1:7MUKMpJYzOXtCUsTEoXOxsDV/UcHw6CPbaWMlthVNsc= github.com/beego/beego/v2 v2.3.1/go.mod h1:5cqHsOHJIxkq44tBpRvtDe59GuVRVv/9/tyVDxd5ce4= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/biter777/countries v1.7.5 h1:MJ+n3+rSxWQdqVJU8eBy9RqcdH6ePPn4PJHocVWUa+Q= +github.com/biter777/countries v1.7.5/go.mod h1:1HSpZ526mYqKJcpT5Ti1kcGQ0L0SrXWIaptUWjFfv2E= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/coreos/etcd v3.3.17+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -17,10 +19,24 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw= github.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/etcd-io/etcd v3.3.17+incompatible/go.mod h1:cdZ77EstHBwVtD6iTgzgvogwcjo9m4iOqoijouPJ4bs= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc= github.com/gabriel-vasile/mimetype v1.4.6/go.mod h1:JX1qVKqZd40hUPpAfiNTe0Sne7hdfKSbOqqmkq8GCXc= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -29,12 +45,25 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA= github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= @@ -44,13 +73,22 @@ github.com/goraz/onion v0.1.3/go.mod h1:XEmz1XoBz+wxTgWB8NwuvRm4RAu3vKxvrmYtzK+X github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -58,6 +96,8 @@ github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -68,9 +108,12 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= @@ -82,7 +125,12 @@ github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDm github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/ogier/pflag v0.0.1/go.mod h1:zkFki7tvTa0tafRvTBIZTvzYyAu6kQhPZFnshFFPE+g= +github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= +github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= +github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= +github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= @@ -95,10 +143,10 @@ github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPA github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= -github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= +github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= @@ -111,10 +159,19 @@ github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYl github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= @@ -123,29 +180,42 @@ github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6 github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM= github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM= go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -157,23 +227,57 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc= +k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k= +k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs= +k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= +k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU= +k8s.io/client-go v0.32.1/go.mod h1:aTTKZY7MdxUaJ/KiUs8D+GssR9zJZi77ZqtzcGXIiDg= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= +sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/infrastructure/interface.go b/infrastructure/interface.go new file mode 100644 index 0000000..0fcc234 --- /dev/null +++ b/infrastructure/interface.go @@ -0,0 +1,28 @@ +package infrastructure + +import ( + "context" + "errors" + "oc-datacenter/conf" +) + +type Infrastructure interface { + CreateNamespace(ctx context.Context, ns string) error + DeleteNamespace(ctx context.Context, ns string) error + GetToken(ctx context.Context, ns string, duration int) (string, error) + CreateServiceAccount(ctx context.Context, ns string) error + CreateRoleBinding(ctx context.Context, ns string, roleBinding string, role string) error + CreateRole(ctx context.Context, ns string, role string, groups [][]string, resources [][]string, verbs [][]string) error +} + +var _service = map[string]func() (Infrastructure, error){ + "kubernetes": NewKubernetesService, +} + +func NewService() (Infrastructure, error) { + service, ok := _service[conf.GetConfig().Mode] + if !ok { + return nil, errors.New("service not found") + } + return service() +} diff --git a/infrastructure/kubernetes.go b/infrastructure/kubernetes.go new file mode 100644 index 0000000..7096275 --- /dev/null +++ b/infrastructure/kubernetes.go @@ -0,0 +1,158 @@ +package infrastructure + +import ( + "context" + "errors" + "fmt" + "oc-datacenter/conf" + + authv1 "k8s.io/api/authentication/v1" + v1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" +) + +type KubernetesService struct { + Set *kubernetes.Clientset +} + +func NewKubernetesService() (Infrastructure, error) { + config := &rest.Config{ + Host: conf.GetConfig().KubeHost + ":" + conf.GetConfig().KubePort, + TLSClientConfig: rest.TLSClientConfig{ + CAData: []byte(conf.GetConfig().KubeCA), + CertData: []byte(conf.GetConfig().KubeCert), + KeyData: []byte(conf.GetConfig().KubeData), + }, + } + // Create clientset + clientset, err := kubernetes.NewForConfig(config) + fmt.Println("NewForConfig", clientset, err) + if err != nil { + return nil, errors.New("Error creating Kubernetes client: " + err.Error()) + } + if clientset == nil { + return nil, errors.New("Error creating Kubernetes client: clientset is nil") + } + + return &KubernetesService{ + Set: clientset, + }, nil +} + +func (k *KubernetesService) CreateNamespace(ctx context.Context, ns string) error { + // Define the namespace + namespace := &v1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: ns, + }, + } + // Create the namespace + fmt.Println("Creating namespace...", k.Set) + if _, err := k.Set.CoreV1().Namespaces().Create(ctx, namespace, metav1.CreateOptions{}); err != nil { + return errors.New("Error creating namespace: " + err.Error()) + } + fmt.Println("Namespace created successfully!") + return nil +} + +func (k *KubernetesService) CreateServiceAccount(ctx context.Context, ns string) error { + // Create the ServiceAccount object + serviceAccount := &v1.ServiceAccount{ + ObjectMeta: metav1.ObjectMeta{ + Name: "sa-" + ns, + Namespace: ns, + }, + } + // Create the ServiceAccount in the specified namespace + _, err := k.Set.CoreV1().ServiceAccounts(ns).Create(ctx, serviceAccount, metav1.CreateOptions{}) + if err != nil { + return errors.New("Failed to create ServiceAccount: " + err.Error()) + } + return nil +} + +func (k *KubernetesService) CreateRole(ctx context.Context, ns string, role string, groups [][]string, resources [][]string, verbs [][]string) error { + // Create the Role object + if len(groups) != len(resources) || len(resources) != len(verbs) { + return errors.New("Invalid input: groups, resources, and verbs must have the same length") + } + rules := []rbacv1.PolicyRule{} + for i, group := range groups { + rules = append(rules, rbacv1.PolicyRule{ + APIGroups: group, + Resources: resources[i], + Verbs: verbs[i], + }) + } + r := &rbacv1.Role{ + ObjectMeta: metav1.ObjectMeta{ + Name: role, + Namespace: ns, + }, + Rules: rules, + } + // Create the Role in the specified namespace + _, err := k.Set.RbacV1().Roles(ns).Create(ctx, r, metav1.CreateOptions{}) + if err != nil { + return errors.New("Failed to create Role: " + err.Error()) + } + return nil +} + +func (k *KubernetesService) CreateRoleBinding(ctx context.Context, ns string, roleBinding string, role string) error { + // Create the RoleBinding object + rb := &rbacv1.RoleBinding{ + ObjectMeta: metav1.ObjectMeta{ + Name: roleBinding, + Namespace: ns, + }, + Subjects: []rbacv1.Subject{ + { + Kind: "ServiceAccount", + Name: "sa-" + ns, + Namespace: ns, + }, + }, + RoleRef: rbacv1.RoleRef{ + Kind: "Role", + Name: role, + APIGroup: "rbac.authorization.k8s.io", + }, + } + // Create the RoleBinding in the specified namespace + _, err := k.Set.RbacV1().RoleBindings(ns).Create(ctx, rb, metav1.CreateOptions{}) + if err != nil { + return errors.New("Failed to create RoleBinding: " + err.Error()) + } + return nil +} + +func (k *KubernetesService) DeleteNamespace(ctx context.Context, ns string) error { + // Delete the namespace + if err := k.Set.CoreV1().Namespaces().Delete(ctx, ns, metav1.DeleteOptions{}); err != nil { + return errors.New("Error deleting namespace: " + err.Error()) + } + fmt.Println("Namespace deleted successfully!") + return nil +} + +func (k *KubernetesService) GetToken(ctx context.Context, ns string, duration int) (string, error) { + // Define TokenRequest (valid for 1 hour) + d := int64(duration) + tokenRequest := &authv1.TokenRequest{ + Spec: authv1.TokenRequestSpec{ + ExpirationSeconds: &d, // 1 hour validity + }, + } + // Generate the token + token, err := k.Set.CoreV1(). + ServiceAccounts(ns). + CreateToken(ctx, "sa-"+ns, tokenRequest, metav1.CreateOptions{}) + if err != nil { + return "", errors.New("Failed to create token for ServiceAccount: " + err.Error()) + } + return token.Status.Token, nil +} diff --git a/main.go b/main.go index 41b175c..5971b56 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,8 @@ package main import ( + "encoding/base64" + "oc-datacenter/conf" _ "oc-datacenter/routers" oclib "cloud.o-forge.io/core/oc-lib" @@ -17,7 +19,22 @@ func main() { // Load the right config file o := oclib.GetConfLoader() + conf.GetConfig().Mode = o.GetStringDefault("MODE", "kubernetes") + conf.GetConfig().KubeHost = o.GetStringDefault("KUBERNETES_SERVICE_HOST", "") + conf.GetConfig().KubePort = o.GetStringDefault("KUBERNETES_SERVICE_PORT", "6443") + sDec, err := base64.StdEncoding.DecodeString(o.GetStringDefault("KUBE_CA", "")) + if err == nil { + conf.GetConfig().KubeCA = string(sDec) + } + sDec, err = base64.StdEncoding.DecodeString(o.GetStringDefault("KUBE_CERT", "")) + if err == nil { + conf.GetConfig().KubeCert = string(sDec) + } + sDec, err = base64.StdEncoding.DecodeString(o.GetStringDefault("KUBE_DATA", "")) + if err == nil { + conf.GetConfig().KubeData = string(sDec) + } // feed the library with the loaded config oclib.SetConfig( o.GetStringDefault("MONGO_URL", "mongodb://127.0.0.1:27017"), diff --git a/routers/commentsRouter.go b/routers/commentsRouter.go index e7dd0e8..0f7e53d 100644 --- a/routers/commentsRouter.go +++ b/routers/commentsRouter.go @@ -34,6 +34,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["oc-datacenter/controllers:BookingController"] = append(beego.GlobalControllerRouter["oc-datacenter/controllers:BookingController"], + beego.ControllerComments{ + Method: "Put", + Router: `/:id`, + AllowHTTPMethods: []string{"put"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["oc-datacenter/controllers:BookingController"] = append(beego.GlobalControllerRouter["oc-datacenter/controllers:BookingController"], beego.ControllerComments{ Method: "Check", @@ -52,6 +61,42 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["oc-datacenter/controllers:BookingController"] = append(beego.GlobalControllerRouter["oc-datacenter/controllers:BookingController"], + beego.ControllerComments{ + Method: "ExecutionSearch", + Router: `/search/execution/:id`, + AllowHTTPMethods: []string{"get"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + + beego.GlobalControllerRouter["oc-datacenter/controllers:DatacenterController"] = append(beego.GlobalControllerRouter["oc-datacenter/controllers:DatacenterController"], + beego.ControllerComments{ + Method: "GetAll", + Router: `/`, + AllowHTTPMethods: []string{"get"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + + beego.GlobalControllerRouter["oc-datacenter/controllers:DatacenterController"] = append(beego.GlobalControllerRouter["oc-datacenter/controllers:DatacenterController"], + beego.ControllerComments{ + Method: "Get", + Router: `/:id`, + AllowHTTPMethods: []string{"get"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + + beego.GlobalControllerRouter["oc-datacenter/controllers:SessionController"] = append(beego.GlobalControllerRouter["oc-datacenter/controllers:SessionController"], + beego.ControllerComments{ + Method: "GetToken", + Router: `/token/:id/:duration`, + AllowHTTPMethods: []string{"get"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["oc-datacenter/controllers:VersionController"] = append(beego.GlobalControllerRouter["oc-datacenter/controllers:VersionController"], beego.ControllerComments{ Method: "GetAll", diff --git a/routers/router.go b/routers/router.go index f3e8838..dc5ce3c 100644 --- a/routers/router.go +++ b/routers/router.go @@ -15,6 +15,14 @@ import ( func init() { ns := beego.NewNamespace("/oc/", + beego.NSInclude( + &controllers.DatacenterController{}, + ), + beego.NSNamespace("/session", + beego.NSInclude( + &controllers.SessionController{}, + ), + ), beego.NSNamespace("/booking", beego.NSInclude( &controllers.BookingController{}, diff --git a/swagger/swagger.json b/swagger/swagger.json index 2095ab2..2dbac83 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -15,6 +15,28 @@ }, "basePath": "/oc/", "paths": { + "/": { + "get": { + "tags": [ + "oc-datacenter/controllersDatacenterController" + ], + "description": "find booking by id\n\u003cbr\u003e", + "operationId": "DatacenterController.GetAll", + "parameters": [ + { + "in": "query", + "name": "is_draft", + "description": "draft wished", + "type": "string" + } + ], + "responses": { + "200": { + "description": "{booking} models.booking" + } + } + } + }, "/booking/": { "get": { "tags": [ @@ -22,6 +44,14 @@ ], "description": "find booking by id\n\u003cbr\u003e", "operationId": "BookingController.GetAll", + "parameters": [ + { + "in": "query", + "name": "is_draft", + "description": "draft wished", + "type": "string" + } + ], "responses": { "200": { "description": "{booking} models.booking" @@ -33,7 +63,7 @@ "booking" ], "description": "create booking\n\u003cbr\u003e", - "operationId": "BookingController.Post", + "operationId": "BookingController.Post.", "parameters": [ { "in": "body", @@ -44,6 +74,12 @@ "type": "string" }, "type": "string" + }, + { + "in": "query", + "name": "is_draft", + "description": "draft wished", + "type": "string" } ], "responses": { @@ -83,6 +119,12 @@ "description": "2006-01-02T15:04:05", "type": "string", "default": "the booking end date" + }, + { + "in": "query", + "name": "is_draft", + "description": "draft wished", + "type": "string" } ], "responses": { @@ -95,6 +137,35 @@ } } }, + "/booking/search/execution/{id}": { + "get": { + "tags": [ + "booking" + ], + "description": "search bookings by execution\n\u003cbr\u003e", + "operationId": "BookingController.Search", + "parameters": [ + { + "in": "path", + "name": "id", + "description": "id execution", + "required": true, + "type": "string" + }, + { + "in": "query", + "name": "is_draft", + "description": "draft wished", + "type": "string" + } + ], + "responses": { + "200": { + "description": "{workspace} models.workspace" + } + } + } + }, "/booking/search/{start_date}/{end_date}": { "get": { "tags": [ @@ -116,6 +187,12 @@ "description": "the word search you want to get", "required": true, "type": "string" + }, + { + "in": "query", + "name": "is_draft", + "description": "draft wished", + "type": "string" } ], "responses": { @@ -146,6 +223,64 @@ "description": "{booking} models.booking" } } + }, + "put": { + "tags": [ + "booking" + ], + "description": "create computes\n\u003cbr\u003e", + "operationId": "BookingController.Update", + "parameters": [ + { + "in": "path", + "name": "id", + "description": "the compute id you want to get", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "The compute content", + "required": true, + "schema": { + "$ref": "#/definitions/models.compute" + } + } + ], + "responses": { + "200": { + "description": "{compute} models.compute" + } + } + } + }, + "/session/token/{id}/{duration}": { + "get": { + "tags": [ + "session" + ], + "description": "find booking by id\n\u003cbr\u003e", + "operationId": "SessionController.GetToken", + "parameters": [ + { + "in": "path", + "name": "id", + "description": "id of the datacenter", + "type": "string" + }, + { + "in": "path", + "name": "duration", + "description": "duration of the token", + "type": "string" + } + ], + "responses": { + "200": { + "description": "{booking} models.booking" + } + } } }, "/version/": { @@ -175,15 +310,52 @@ } } } + }, + "/{id}": { + "get": { + "tags": [ + "oc-datacenter/controllersDatacenterController" + ], + "description": "find booking by id\n\u003cbr\u003e", + "operationId": "DatacenterController.Get", + "parameters": [ + { + "in": "path", + "name": "id", + "description": "the id you want to get", + "required": true, + "type": "string" + }, + { + "in": "query", + "name": "is_draft", + "description": "draft wished", + "type": "string" + } + ], + "responses": { + "200": { + "description": "{booking} models.booking" + } + } + } } }, "definitions": { + "models.compute": { + "title": "compute", + "type": "object" + }, "models.object": { "title": "object", "type": "object" } }, "tags": [ + { + "name": "oc-datacenter/controllersDatacenterController", + "description": "Operations about workspace\n" + }, { "name": "booking", "description": "Operations about workspace\n" diff --git a/swagger/swagger.yml b/swagger/swagger.yml index 667b1b5..2d0ab1b 100644 --- a/swagger/swagger.yml +++ b/swagger/swagger.yml @@ -12,6 +12,43 @@ info: url: https://www.gnu.org/licenses/agpl-3.0.html basePath: /oc/ paths: + /: + get: + tags: + - oc-datacenter/controllersDatacenterController + description: |- + find booking by id +
+ operationId: DatacenterController.GetAll + parameters: + - in: query + name: is_draft + description: draft wished + type: string + responses: + "200": + description: '{booking} models.booking' + /{id}: + get: + tags: + - oc-datacenter/controllersDatacenterController + description: |- + find booking by id +
+ operationId: DatacenterController.Get + parameters: + - in: path + name: id + description: the id you want to get + required: true + type: string + - in: query + name: is_draft + description: draft wished + type: string + responses: + "200": + description: '{booking} models.booking' /booking/: get: tags: @@ -20,6 +57,11 @@ paths: find booking by id
operationId: BookingController.GetAll + parameters: + - in: query + name: is_draft + description: draft wished + type: string responses: "200": description: '{booking} models.booking' @@ -29,7 +71,7 @@ paths: description: |- create booking
- operationId: BookingController.Post + operationId: BookingController.Post. parameters: - in: body name: booking @@ -38,6 +80,10 @@ paths: schema: type: string type: string + - in: query + name: is_draft + description: draft wished + type: string responses: "200": description: "" @@ -60,6 +106,28 @@ paths: responses: "200": description: '{booking} models.booking' + put: + tags: + - booking + description: |- + create computes +
+ operationId: BookingController.Update + parameters: + - in: path + name: id + description: the compute id you want to get + required: true + type: string + - in: body + name: body + description: The compute content + required: true + schema: + $ref: '#/definitions/models.compute' + responses: + "200": + description: '{compute} models.compute' /booking/check/{id}/{start_date}/{end_date}: get: tags: @@ -83,6 +151,10 @@ paths: description: 2006-01-02T15:04:05 type: string default: the booking end date + - in: query + name: is_draft + description: draft wished + type: string responses: "200": description: "" @@ -107,9 +179,54 @@ paths: description: the word search you want to get required: true type: string + - in: query + name: is_draft + description: draft wished + type: string responses: "200": description: '{workspace} models.workspace' + /booking/search/execution/{id}: + get: + tags: + - booking + description: |- + search bookings by execution +
+ operationId: BookingController.Search + parameters: + - in: path + name: id + description: id execution + required: true + type: string + - in: query + name: is_draft + description: draft wished + type: string + responses: + "200": + description: '{workspace} models.workspace' + /session/token/{id}/{duration}: + get: + tags: + - session + description: |- + find booking by id +
+ operationId: SessionController.GetToken + parameters: + - in: path + name: id + description: id of the datacenter + type: string + - in: path + name: duration + description: duration of the token + type: string + responses: + "200": + description: '{booking} models.booking' /version/: get: tags: @@ -133,10 +250,16 @@ paths: "200": description: "" definitions: + models.compute: + title: compute + type: object models.object: title: object type: object tags: +- name: oc-datacenter/controllersDatacenterController + description: | + Operations about workspace - name: booking description: | Operations about workspace