(ctx *gin.Context)
| 605 | } |
| 606 | |
| 607 | func (m *Modules) ReconcileModule(ctx *gin.Context) { |
| 608 | ctx.Header("Access-Control-Allow-Origin", "*") |
| 609 | |
| 610 | moduleName := ctx.Param("name") |
| 611 | |
| 612 | module, err := m.kubernetesClient.GetModule(moduleName) |
| 613 | if err != nil { |
| 614 | fmt.Println(err) |
| 615 | ctx.JSON(http.StatusInternalServerError, dto.NewError("Error fetching module", err.Error())) |
| 616 | return |
| 617 | } |
| 618 | |
| 619 | annotations := module.GetAnnotations() |
| 620 | if annotations == nil { |
| 621 | annotations = make(map[string]string) |
| 622 | } |
| 623 | |
| 624 | annotations["cyclops/reconciled-at"] = time.Now().Format(time.RFC3339) |
| 625 | module.SetAnnotations(annotations) |
| 626 | |
| 627 | module.Kind = "Module" |
| 628 | module.APIVersion = "cyclops-ui.com/v1alpha1" |
| 629 | |
| 630 | err = m.kubernetesClient.UpdateModule(module) |
| 631 | if err != nil { |
| 632 | fmt.Println(err) |
| 633 | ctx.JSON(http.StatusInternalServerError, dto.NewError("Error updating module", err.Error())) |
| 634 | return |
| 635 | } |
| 636 | |
| 637 | ctx.Status(http.StatusAccepted) |
| 638 | } |
| 639 | |
| 640 | func (m *Modules) ResourcesForModule(ctx *gin.Context) { |
| 641 | ctx.Header("Access-Control-Allow-Origin", "*") |
nothing calls this directly
no test coverage detected