MCPcopy
hub / github.com/cyclops-ui/cyclops / ReconcileModule

Method ReconcileModule

cyclops-ctrl/internal/controller/modules.go:607–638  ·  view source on GitHub ↗
(ctx *gin.Context)

Source from the content-addressed store, hash-verified

605}
606
607func (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
640func (m *Modules) ResourcesForModule(ctx *gin.Context) {
641 ctx.Header("Access-Control-Allow-Origin", "*")

Callers

nothing calls this directly

Calls 4

PrintlnMethod · 0.80
ErrorMethod · 0.80
GetModuleMethod · 0.65
UpdateModuleMethod · 0.65

Tested by

no test coverage detected